Set IP before starting NMRP loop
This commit is contained in:
parent
644a9ce55f
commit
3b292714ff
1 changed files with 8 additions and 6 deletions
14
nmrp.c
14
nmrp.c
|
|
@ -490,6 +490,14 @@ int nmrp_do(struct nmrpd_args *args)
|
||||||
}
|
}
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (verbosity) {
|
||||||
|
printf("Adding %s to interface %s.\n", args->ipaddr_intf, args->intf);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ethsock_ip_add(sock, intf_addr, ipconf.mask.s_addr, &gundo) != 0) {
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ethsock_set_timeout(sock, args->rx_timeout)) {
|
if (ethsock_set_timeout(sock, args->rx_timeout)) {
|
||||||
|
|
@ -583,12 +591,6 @@ int nmrp_do(struct nmrpd_args *args)
|
||||||
memcpy(arpmac, rx.eh.ether_shost, 6);
|
memcpy(arpmac, rx.eh.ether_shost, 6);
|
||||||
memcpy(&arpip, &ipconf.addr, sizeof(ipconf.addr));
|
memcpy(&arpip, &ipconf.addr, sizeof(ipconf.addr));
|
||||||
|
|
||||||
if (autoip) {
|
|
||||||
if (ethsock_ip_add(sock, intf_addr, ipconf.mask.s_addr, &gundo) != 0) {
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ethsock_arp_add(sock, arpmac, &arpip) != 0) {
|
if (ethsock_arp_add(sock, arpmac, &arpip) != 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue