mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-31 06:15:55 +00:00
Intermediate changes to support actual DHCP protocol engine
This commit is contained in:
50
dhclient.c
50
dhclient.c
@@ -189,11 +189,51 @@ int main (argc, argv, envp)
|
||||
|
||||
cons_options ((struct packet *)0,
|
||||
&outgoing, &decl, bufs);
|
||||
memset (&raw.ciaddr, 0, sizeof raw.ciaddr);
|
||||
memset (&raw.yiaddr, 0, sizeof raw.ciaddr);
|
||||
memset (&raw.siaddr, 0, sizeof raw.ciaddr);
|
||||
memset (&raw.giaddr, 0, sizeof raw.ciaddr);
|
||||
|
||||
|
||||
if (decl.ciaddr) {
|
||||
if (tree_evaluate (decl.ciaddr) != 4)
|
||||
warn ("ciaddr is more"
|
||||
" than one address");
|
||||
else
|
||||
memcpy (&raw.ciaddr,
|
||||
decl.ciaddr -> value,
|
||||
decl.ciaddr -> len);
|
||||
} else
|
||||
memset (&raw.ciaddr, 0, sizeof raw.ciaddr);
|
||||
|
||||
if (decl.yiaddr) {
|
||||
if (tree_evaluate (decl.yiaddr) != 4)
|
||||
warn ("yiaddr is more"
|
||||
" than one address");
|
||||
else
|
||||
memcpy (&raw.yiaddr,
|
||||
decl.yiaddr -> value,
|
||||
decl.yiaddr -> len);
|
||||
} else
|
||||
memset (&raw.yiaddr, 0, sizeof raw.yiaddr);
|
||||
|
||||
if (decl.siaddr) {
|
||||
if (tree_evaluate (decl.siaddr) != 4)
|
||||
warn ("siaddr is more"
|
||||
" than one address");
|
||||
else
|
||||
memcpy (&raw.siaddr,
|
||||
decl.siaddr -> value,
|
||||
decl.siaddr -> len);
|
||||
} else
|
||||
memset (&raw.siaddr, 0, sizeof raw.siaddr);
|
||||
|
||||
if (decl.giaddr) {
|
||||
if (tree_evaluate (decl.giaddr) != 4)
|
||||
warn ("giaddr is more"
|
||||
" than one address");
|
||||
else
|
||||
memcpy (&raw.giaddr,
|
||||
decl.giaddr -> value,
|
||||
decl.giaddr -> len);
|
||||
} else
|
||||
memset (&raw.giaddr, 0, sizeof raw.giaddr);
|
||||
|
||||
raw.xid = xid++;
|
||||
raw.xid = htons (raw.xid);
|
||||
raw.secs = 0;
|
||||
|
Reference in New Issue
Block a user