zcip: simplify code a bit
This commit is contained in:
parent
a09300a88c
commit
b1bac0dab2
@ -177,7 +177,6 @@ int zcip_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int state = PROBE;
|
int state = PROBE;
|
||||||
struct ether_addr eth_addr;
|
struct ether_addr eth_addr;
|
||||||
const char *why;
|
|
||||||
char *r_opt;
|
char *r_opt;
|
||||||
unsigned opts;
|
unsigned opts;
|
||||||
|
|
||||||
@ -319,8 +318,6 @@ int zcip_main(int argc, char **argv)
|
|||||||
VDBG("...wait %d %s nprobes=%u, nclaims=%u\n",
|
VDBG("...wait %d %s nprobes=%u, nclaims=%u\n",
|
||||||
timeout_ms, intf, nprobes, nclaims);
|
timeout_ms, intf, nprobes, nclaims);
|
||||||
|
|
||||||
// FIXME: do we really receive ALL packets here??
|
|
||||||
// if yes, set up filtering to get ARPs only!!! (see arping)
|
|
||||||
switch (safe_poll(fds, 1, timeout_ms)) {
|
switch (safe_poll(fds, 1, timeout_ms)) {
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -447,8 +444,7 @@ int zcip_main(int argc, char **argv)
|
|||||||
|
|
||||||
// read ARP packet
|
// read ARP packet
|
||||||
if (safe_read(sock_fd, &p, sizeof(p)) < 0) {
|
if (safe_read(sock_fd, &p, sizeof(p)) < 0) {
|
||||||
why = "recv";
|
bb_perror_msg_and_die(bb_msg_read_error);
|
||||||
goto bad;
|
|
||||||
}
|
}
|
||||||
if (p.eth.ether_type != htons(ETHERTYPE_ARP))
|
if (p.eth.ether_type != htons(ETHERTYPE_ARP))
|
||||||
continue;
|
continue;
|
||||||
@ -550,7 +546,4 @@ int zcip_main(int argc, char **argv)
|
|||||||
break; // case 1 (packets arriving)
|
break; // case 1 (packets arriving)
|
||||||
} // switch poll
|
} // switch poll
|
||||||
} // while (1)
|
} // while (1)
|
||||||
bad:
|
|
||||||
bb_perror_msg("%s: %s", intf, why);
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user