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)
Wed, Nov 13, 10:46 AM
Unknown Object (File)
Fri, Nov 1, 9:24 AM
Unknown Object (File)
Thu, Oct 31, 8:05 PM
Unknown Object (File)
Tue, Oct 22, 6:05 PM
Unknown Object (File)
Sat, Oct 19, 6:59 AM
Unknown Object (File)
Oct 15 2024, 6:41 PM
Unknown Object (File)
Sep 23 2024, 9:29 PM
Unknown Object (File)
Sep 23 2024, 7:36 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