diff options
Diffstat (limited to 'networking')
-rw-r--r-- | networking/libiproute/iproute.c | 10 | ||||
-rw-r--r-- | networking/nameif.c | 22 | ||||
-rw-r--r-- | networking/zcip.c | 24 |
3 files changed, 30 insertions, 26 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index ce2cd8b..5ded99b 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c @@ -841,15 +841,17 @@ int do_iproute(char **argv) /*0-3*/ "add\0""append\0""change\0""chg\0" /*4-7*/ "delete\0""get\0""list\0""show\0" /*8..*/ "prepend\0""replace\0""test\0""flush\0"; - int command_num = 6; + int command_num; unsigned flags = 0; int cmd = RTM_NEWROUTE; + if (!*argv) + return iproute_list_or_flush(argv, 0); + /* "Standard" 'ip r a' treats 'a' as 'add', not 'append' */ /* It probably means that it is using "first match" rule */ - if (*argv) { - command_num = index_in_substrings(ip_route_commands, *argv); - } + command_num = index_in_substrings(ip_route_commands, *argv); + switch (command_num) { case 0: /* add */ flags = NLM_F_CREATE|NLM_F_EXCL; diff --git a/networking/nameif.c b/networking/nameif.c index 66376a5..c92b352 100644 --- a/networking/nameif.c +++ b/networking/nameif.c @@ -50,18 +50,18 @@ typedef struct ethtable_s { #define ETHTOOL_BUSINFO_LEN 32 /* these strings are set to whatever the driver author decides... */ struct ethtool_drvinfo { - __u32 cmd; - char driver[32]; /* driver short name, "tulip", "eepro100" */ - char version[32]; /* driver version string */ - char fw_version[32]; /* firmware version string, if applicable */ - char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ + uint32_t cmd; + char driver[32]; /* driver short name, "tulip", "eepro100" */ + char version[32]; /* driver version string */ + char fw_version[32]; /* firmware version string, if applicable */ + char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ /* For PCI devices, use pci_dev->slot_name. */ - char reserved1[32]; - char reserved2[16]; - __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ - __u32 testinfo_len; - __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ - __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ + char reserved1[32]; + char reserved2[16]; + uint32_t n_stats; /* number of u64's from ETHTOOL_GSTATS */ + uint32_t testinfo_len; + uint32_t eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ + uint32_t regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ }; #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ #endif diff --git a/networking/zcip.c b/networking/zcip.c index ef9aa21..8ffed85 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -180,7 +180,7 @@ int zcip_main(int argc, char **argv) char *r_opt; unsigned opts; - /* Ugly trick, but I want these zeroed in one go */ + // ugly trick, but I want these zeroed in one go struct { const struct in_addr null_ip; const struct ether_addr null_addr; @@ -214,8 +214,17 @@ int zcip_main(int argc, char **argv) // exactly 2 args; -v accumulates and implies -f opt_complementary = "=2:vv:vf"; opts = getopt32(argv, "fqr:v", &r_opt, &verbose); +#if !BB_MMU + // on NOMMU reexec early (or else we will rerun things twice) + if (!FOREGROUND) + bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv); +#endif + // open an ARP socket + // (need to do it before openlog to prevent openlog from taking + // fd 3 (sock_fd==3)) + xmove_fd(xsocket(AF_PACKET, SOCK_PACKET, htons(ETH_P_ARP)), sock_fd); if (!FOREGROUND) { - /* Do it early, before all bb_xx_msg calls */ + // do it before all bb_xx_msg calls openlog(applet_name, 0, LOG_DAEMON); logmode |= LOGMODE_SYSLOG; } @@ -226,11 +235,6 @@ int zcip_main(int argc, char **argv) bb_error_msg_and_die("invalid link address"); } } - // On NOMMU reexec early (or else we will rerun things twice) -#if !BB_MMU - if (!FOREGROUND) - bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv); -#endif argc -= optind; argv += optind; @@ -249,8 +253,6 @@ int zcip_main(int argc, char **argv) //TODO: are we leaving sa_family == 0 (AF_UNSPEC)?! safe_strncpy(saddr.sa_data, intf, sizeof(saddr.sa_data)); - // open an ARP socket - xmove_fd(xsocket(AF_PACKET, SOCK_PACKET, htons(ETH_P_ARP)), sock_fd); // bind to the interface's ARP socket xbind(sock_fd, &saddr, sizeof(saddr)); @@ -290,7 +292,7 @@ int zcip_main(int argc, char **argv) // restarting after address conflicts: // - start with some address we want to try // - short random delay - // - arp probes to see if another host else uses it + // - arp probes to see if another host uses it // - arp announcements that we're claiming it // - use it // - defend it, within limits @@ -321,7 +323,7 @@ int zcip_main(int argc, char **argv) switch (safe_poll(fds, 1, timeout_ms)) { default: - /*bb_perror_msg("poll"); - done in safe_poll */ + //bb_perror_msg("poll"); - done in safe_poll return EXIT_FAILURE; // timeout |