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)
Apr 9 2024, 5:27 AM
Unknown Object (File)
Mar 12 2024, 12:43 AM
Unknown Object (File)
Mar 12 2024, 12:43 AM
Unknown Object (File)
Mar 12 2024, 12:38 AM
Unknown Object (File)
Mar 12 2024, 12:38 AM
Unknown Object (File)
Mar 8 2024, 4:06 AM
Unknown Object (File)
Mar 7 2024, 7:51 PM
Unknown Object (File)
Feb 8 2024, 4:10 PM

Details

Summary

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

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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