Page MenuHomeFreeBSD

dhclient: skip_to_semi() consumes semicolon already
ClosedPublic

Authored by franco_opnsense.org on Aug 13 2021, 11:13 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 5, 9:10 AM
Unknown Object (File)
Tue, Dec 3, 5:16 PM
Unknown Object (File)
Fri, Nov 22, 7:57 AM
Unknown Object (File)
Tue, Nov 19, 9:43 AM
Unknown Object (File)
Sat, Nov 16, 7:02 AM
Unknown Object (File)
Fri, Nov 15, 1:44 AM
Unknown Object (File)
Fri, Nov 15, 1:19 AM
Unknown Object (File)
Thu, Nov 14, 10:16 PM

Details

Summary

When invalid statement is found the next statement is skipped
even if it is valid.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 41024
Build 37913: arc lint + arc unit

Event Timeline

So a snippet like

blahblah;
timeout 60;

will cause the timeout statement to be ignored?

sbin/dhclient/clparse.c
671

Do you have the same bug here?

Correct. Here is the test:

Config:

interface "em0" {
	foo is what this is;
	timeout 123;
}

Before patch:

dh.conf line 2: expecting a statement.
	foo 
 ^
dh.conf line 3: semicolon expected.
	timeout 
 ^
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from 192.168.152.1
bound to 192.168.152.2 -- renewal in 42768 seconds.

After patch:

dh.conf line 2: expecting a statement.
	foo 
 ^
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from 192.168.152.1
bound to 192.168.152.2 -- renewal in 42768 seconds.

And timeout picked up as expected.

sbin/dhclient/clparse.c
671

Ugh, indeed. But this is for the /var/db/dhclient.leases.IFNAME written by dhclient itself and the fix is different because sometimes the code already skips to semi but sometimes not. Not sure if worth digging deeper... there could be more such artefacts in individual skip_to_semi handling.

This revision is now accepted and ready to land.Aug 19 2021, 12:56 PM