1303 files changed, 32187 insertions, 57138 deletions
diff --git a/networking/arp.c b/networking/arp.c index e79b1b6..a62a376 100644 --- a/networking/arp.c +++ b/networking/arp.c @@ -12,6 +12,16 @@ * * modified for getopt32 by Arne Bernin <arne [at] alamut.de> */ +//config:config ARP +//config: bool "arp" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Manipulate the system ARP cache. + +//applet:IF_ARP(APPLET(arp, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_ARP) += arp.o interface.o //usage:#define arp_trivial_usage //usage: "\n[-vn] [-H HWTYPE] [-i IF] -a [HOSTNAME]" @@ -32,6 +42,7 @@ //usage: "\n -H HWTYPE Hardware address type" #include "libbb.h" +#include "common_bufsiz.h" #include "inet_common.h" #include <arpa/inet.h> @@ -68,14 +79,14 @@ struct globals { const struct hwtype *hw; /* current hardware type */ const char *device; /* current device */ smallint hw_set; /* flag if hw-type was set (-H) */ - } FIX_ALIASING; -#define G (*(struct globals*)&bb_common_bufsiz1) +#define G (*(struct globals*)bb_common_bufsiz1) #define ap (G.ap ) #define hw (G.hw ) #define device (G.device ) #define hw_set (G.hw_set ) #define INIT_G() do { \ + setup_common_bufsiz(); \ device = ""; \ } while (0) @@ -177,7 +188,7 @@ static int arp_del(char **args) if (flags == 0) flags = 3; - strncpy(req.arp_dev, device, sizeof(req.arp_dev)); + strncpy_IFNAMSIZ(req.arp_dev, device); err = -1; @@ -218,7 +229,7 @@ static void arp_getdevhw(char *ifname, struct sockaddr *sa) struct ifreq ifr; const struct hwtype *xhw; - strcpy(ifr.ifr_name, ifname); + strncpy_IFNAMSIZ(ifr.ifr_name, ifname); ioctl_or_perror_and_die(sockfd, SIOCGIFHWADDR, &ifr, "can't get HW-Address for '%s'", ifname); if (hw_set && (ifr.ifr_hwaddr.sa_family != hw->type)) { @@ -331,7 +342,7 @@ static int arp_set(char **args) /* Fill in the remainder of the request. */ req.arp_flags = flags; - strncpy(req.arp_dev, device, sizeof(req.arp_dev)); + strncpy_IFNAMSIZ(req.arp_dev, device); /* Call the kernel. */ if (option_mask32 & ARP_OPT_v) |