busybox: squashed commit of merging cm-12.1
With fixes to LOCAL_C_INCLUDES for libsepol in M and fixed
some missing includes to enable building for 64 bit devices
Conflicts:
Android.mk
android/libc/arch-x86/syscalls/swapoff.S
android/libc/arch-x86/syscalls/swapon.S
android/libc/arch-x86/syscalls/sysinfo.S
android/librpc/pmap_rmt.c
android/reboot.c
include-full/copy-current.sh
include-minimal/copy-current.sh
include/platform.h
networking/interface.c
networking/nslookup.c
Change-Id: If6092fa87f3d21190db1af4f70daa150eb462660
diff --git a/networking/arp.c b/networking/arp.c
index 1c99987..e79b1b6 100644
--- a/networking/arp.c
+++ b/networking/arp.c
@@ -22,12 +22,12 @@
//usage:#define arp_full_usage "\n\n"
//usage: "Manipulate ARP cache\n"
//usage: "\n -a Display (all) hosts"
-//usage: "\n -s Set new ARP entry"
-//usage: "\n -d Delete a specified entry"
+//usage: "\n -d Delete ARP entry"
+//usage: "\n -s Set new entry"
//usage: "\n -v Verbose"
//usage: "\n -n Don't resolve names"
//usage: "\n -i IF Network interface"
-//usage: "\n -D Read <hwaddr> from given device"
+//usage: "\n -D Read HWADDR from IFACE"
//usage: "\n -A,-p AF Protocol family"
//usage: "\n -H HWTYPE Hardware address type"
@@ -213,16 +213,15 @@
}
/* Get the hardware address to a specified interface name */
-static void arp_getdevhw(char *ifname, struct sockaddr *sa,
- const struct hwtype *hwt)
+static void arp_getdevhw(char *ifname, struct sockaddr *sa)
{
struct ifreq ifr;
const struct hwtype *xhw;
strcpy(ifr.ifr_name, ifname);
ioctl_or_perror_and_die(sockfd, SIOCGIFHWADDR, &ifr,
- "cant get HW-Address for '%s'", ifname);
- if (hwt && (ifr.ifr_hwaddr.sa_family != hw->type)) {
+ "can't get HW-Address for '%s'", ifname);
+ if (hw_set && (ifr.ifr_hwaddr.sa_family != hw->type)) {
bb_error_msg_and_die("protocol type mismatch");
}
memcpy(sa, &(ifr.ifr_hwaddr), sizeof(struct sockaddr));
@@ -233,8 +232,8 @@
xhw = get_hwntype(-1);
}
bb_error_msg("device '%s' has HW address %s '%s'",
- ifname, xhw->name,
- xhw->print((unsigned char *) &ifr.ifr_hwaddr.sa_data));
+ ifname, xhw->name,
+ xhw->print((unsigned char *) &ifr.ifr_hwaddr.sa_data));
}
}
@@ -261,7 +260,7 @@
bb_error_msg_and_die("need hardware address");
}
if (option_mask32 & ARP_OPT_D) {
- arp_getdevhw(*args++, &req.arp_ha, hw_set ? hw : NULL);
+ arp_getdevhw(*args++, &req.arp_ha);
} else {
if (hw->input(*args++, &req.arp_ha) < 0) {
bb_error_msg_and_die("invalid hardware address");
@@ -460,12 +459,12 @@
arp_disp(hostname, ip, type, flags, hwa, mask, dev);
}
if (option_mask32 & ARP_OPT_v)
- printf("Entries: %d\tSkipped: %d\tFound: %d\n",
+ printf("Entries: %u\tSkipped: %u\tFound: %u\n",
entries, entries - shown, shown);
if (!shown) {
if (hw_set || host || device[0])
- printf("No match found in %d entries\n", entries);
+ printf("No match found in %u entries\n", entries);
}
if (ENABLE_FEATURE_CLEAN_UP) {
free((char*)host);
@@ -477,28 +476,33 @@
int arp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int arp_main(int argc UNUSED_PARAM, char **argv)
{
- const char *hw_type = "ether";
+ const char *hw_type;
const char *protocol;
unsigned opts;
INIT_G();
xmove_fd(xsocket(AF_INET, SOCK_DGRAM, 0), sockfd);
+
ap = get_aftype(DFLT_AF);
- if (!ap)
- bb_error_msg_and_die("%s: %s not supported", DFLT_AF, "address family");
+ /* Defaults are always supported */
+ //if (!ap)
+ // bb_error_msg_and_die("%s: %s not supported", DFLT_AF, "address family");
+ hw = get_hwtype(DFLT_HW);
+ //if (!hw)
+ // bb_error_msg_and_die("%s: %s not supported", DFLT_HW, "hardware type");
opts = getopt32(argv, "A:p:H:t:i:adnDsv", &protocol, &protocol,
&hw_type, &hw_type, &device);
argv += optind;
if (opts & (ARP_OPT_A | ARP_OPT_p)) {
ap = get_aftype(protocol);
- if (ap == NULL)
+ if (!ap)
bb_error_msg_and_die("%s: unknown %s", protocol, "address family");
}
- if (opts & (ARP_OPT_A | ARP_OPT_p)) {
+ if (opts & (ARP_OPT_H | ARP_OPT_t)) {
hw = get_hwtype(hw_type);
- if (hw == NULL)
+ if (!hw)
bb_error_msg_and_die("%s: unknown %s", hw_type, "hardware type");
hw_set = 1;
}
@@ -507,14 +511,6 @@
if (ap->af != AF_INET) {
bb_error_msg_and_die("%s: kernel only supports 'inet'", ap->name);
}
-
- /* If no hw type specified get default */
- if (!hw) {
- hw = get_hwtype(DFLT_HW);
- if (!hw)
- bb_error_msg_and_die("%s: %s not supported", DFLT_HW, "hardware type");
- }
-
if (hw->alen <= 0) {
bb_error_msg_and_die("%s: %s without ARP support",
hw->name, "hardware type");
@@ -528,6 +524,7 @@
return arp_set(argv);
return arp_del(argv);
}
+
//if (opts & ARP_OPT_a) - default
return arp_show(argv[0]);
}