diff options
Diffstat (limited to 'networking')
| -rw-r--r-- | networking/arping.c | 3 | ||||
| -rw-r--r-- | networking/ip.c | 2 | ||||
| -rw-r--r-- | networking/libiproute/iptunnel.c | 45 | ||||
| -rw-r--r-- | networking/ping.c | 4 | ||||
| -rw-r--r-- | networking/udhcp/socket.c | 4 |
5 files changed, 49 insertions, 9 deletions
diff --git a/networking/arping.c b/networking/arping.c index aba32b869..021dc86ea 100644 --- a/networking/arping.c +++ b/networking/arping.c | |||
| @@ -322,8 +322,7 @@ int arping_main(int argc UNUSED_PARAM, char **argv) | |||
| 322 | struct sockaddr_in saddr; | 322 | struct sockaddr_in saddr; |
| 323 | int probe_fd = xsocket(AF_INET, SOCK_DGRAM, 0); | 323 | int probe_fd = xsocket(AF_INET, SOCK_DGRAM, 0); |
| 324 | 324 | ||
| 325 | if (setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device) + 1) == -1) | 325 | setsockopt_bindtodevice(probe_fd, device); |
| 326 | bb_perror_msg("cannot bind to device %s", device); | ||
| 327 | memset(&saddr, 0, sizeof(saddr)); | 326 | memset(&saddr, 0, sizeof(saddr)); |
| 328 | saddr.sin_family = AF_INET; | 327 | saddr.sin_family = AF_INET; |
| 329 | if (src.s_addr) { | 328 | if (src.s_addr) { |
diff --git a/networking/ip.c b/networking/ip.c index 10059c55f..9903c6800 100644 --- a/networking/ip.c +++ b/networking/ip.c | |||
| @@ -31,7 +31,7 @@ static int NORETURN ip_print_help(char **argv UNUSED_PARAM) | |||
| 31 | 31 | ||
| 32 | static int ip_do(int (*ip_func)(char **argv), char **argv) | 32 | static int ip_do(int (*ip_func)(char **argv), char **argv) |
| 33 | { | 33 | { |
| 34 | argv = ip_parse_common_args(argv); | 34 | argv = ip_parse_common_args(argv + 1); |
| 35 | return ip_func(argv); | 35 | return ip_func(argv); |
| 36 | } | 36 | } |
| 37 | 37 | ||
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index 65c27f936..14fc6bbcc 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | * | 6 | * |
| 7 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> | 7 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> |
| 8 | * | 8 | * |
| 9 | * | ||
| 10 | * Changes: | 9 | * Changes: |
| 11 | * | 10 | * |
| 12 | * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses | 11 | * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses |
| @@ -18,10 +17,52 @@ | |||
| 18 | #include <net/if.h> | 17 | #include <net/if.h> |
| 19 | #include <net/if_arp.h> | 18 | #include <net/if_arp.h> |
| 20 | #include <asm/types.h> | 19 | #include <asm/types.h> |
| 20 | |||
| 21 | #ifndef __constant_htons | 21 | #ifndef __constant_htons |
| 22 | #define __constant_htons htons | 22 | #define __constant_htons htons |
| 23 | #endif | 23 | #endif |
| 24 | #include <linux/if_tunnel.h> | 24 | |
| 25 | // FYI: #define SIOCDEVPRIVATE 0x89F0 | ||
| 26 | |||
| 27 | /* From linux/if_tunnel.h. #including it proved troublesome | ||
| 28 | * (redefiniton errors due to name collisions in linux/ and net[inet]/) */ | ||
| 29 | #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) | ||
| 30 | #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) | ||
| 31 | #define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) | ||
| 32 | #define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) | ||
| 33 | //#define SIOCGETPRL (SIOCDEVPRIVATE + 4) | ||
| 34 | //#define SIOCADDPRL (SIOCDEVPRIVATE + 5) | ||
| 35 | //#define SIOCDELPRL (SIOCDEVPRIVATE + 6) | ||
| 36 | //#define SIOCCHGPRL (SIOCDEVPRIVATE + 7) | ||
| 37 | #define GRE_CSUM __constant_htons(0x8000) | ||
| 38 | //#define GRE_ROUTING __constant_htons(0x4000) | ||
| 39 | #define GRE_KEY __constant_htons(0x2000) | ||
| 40 | #define GRE_SEQ __constant_htons(0x1000) | ||
| 41 | //#define GRE_STRICT __constant_htons(0x0800) | ||
| 42 | //#define GRE_REC __constant_htons(0x0700) | ||
| 43 | //#define GRE_FLAGS __constant_htons(0x00F8) | ||
| 44 | //#define GRE_VERSION __constant_htons(0x0007) | ||
| 45 | struct ip_tunnel_parm { | ||
| 46 | char name[IFNAMSIZ]; | ||
| 47 | int link; | ||
| 48 | uint16_t i_flags; | ||
| 49 | uint16_t o_flags; | ||
| 50 | uint32_t i_key; | ||
| 51 | uint32_t o_key; | ||
| 52 | struct iphdr iph; | ||
| 53 | }; | ||
| 54 | /* SIT-mode i_flags */ | ||
| 55 | //#define SIT_ISATAP 0x0001 | ||
| 56 | //struct ip_tunnel_prl { | ||
| 57 | // uint32_t addr; | ||
| 58 | // uint16_t flags; | ||
| 59 | // uint16_t __reserved; | ||
| 60 | // uint32_t datalen; | ||
| 61 | // uint32_t __reserved2; | ||
| 62 | // /* data follows */ | ||
| 63 | //}; | ||
| 64 | ///* PRL flags */ | ||
| 65 | //#define PRL_DEFAULT 0x0001 | ||
| 25 | 66 | ||
| 26 | #include "ip_common.h" /* #include "libbb.h" is inside */ | 67 | #include "ip_common.h" /* #include "libbb.h" is inside */ |
| 27 | #include "rt_names.h" | 68 | #include "rt_names.h" |
diff --git a/networking/ping.c b/networking/ping.c index 01a9f9ac5..f2a612fde 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
| @@ -572,7 +572,7 @@ static void ping4(len_and_sockaddr *lsa) | |||
| 572 | xbind(pingsock, &source_lsa->u.sa, source_lsa->len); | 572 | xbind(pingsock, &source_lsa->u.sa, source_lsa->len); |
| 573 | } | 573 | } |
| 574 | if (str_I) | 574 | if (str_I) |
| 575 | setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, str_I, strlen(str_I) + 1); | 575 | setsockopt_bindtodevice(pingsock, str_I); |
| 576 | 576 | ||
| 577 | /* enable broadcast pings */ | 577 | /* enable broadcast pings */ |
| 578 | setsockopt_broadcast(pingsock); | 578 | setsockopt_broadcast(pingsock); |
| @@ -622,7 +622,7 @@ static void ping6(len_and_sockaddr *lsa) | |||
| 622 | if (source_lsa) | 622 | if (source_lsa) |
| 623 | xbind(pingsock, &source_lsa->u.sa, source_lsa->len); | 623 | xbind(pingsock, &source_lsa->u.sa, source_lsa->len); |
| 624 | if (str_I) | 624 | if (str_I) |
| 625 | setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, str_I, strlen(str_I) + 1); | 625 | setsockopt_bindtodevice(pingsock, str_I); |
| 626 | 626 | ||
| 627 | #ifdef ICMP6_FILTER | 627 | #ifdef ICMP6_FILTER |
| 628 | { | 628 | { |
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c index ea0a2c3a8..385d5c3c0 100644 --- a/networking/udhcp/socket.c +++ b/networking/udhcp/socket.c | |||
| @@ -98,8 +98,8 @@ int FAST_FUNC udhcp_listen_socket(/*uint32_t ip,*/ int port, const char *inf) | |||
| 98 | bb_perror_msg_and_die("SO_BROADCAST"); | 98 | bb_perror_msg_and_die("SO_BROADCAST"); |
| 99 | 99 | ||
| 100 | /* NB: bug 1032 says this doesn't work on ethernet aliases (ethN:M) */ | 100 | /* NB: bug 1032 says this doesn't work on ethernet aliases (ethN:M) */ |
| 101 | if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &inf, strlen(inf) + 1) == -1) | 101 | if (setsockopt_bindtodevice(fd, inf)) |
| 102 | bb_perror_msg_and_die("SO_BINDTODEVICE"); | 102 | xfunc_die(); /* warning is already printed */ |
| 103 | 103 | ||
| 104 | memset(&addr, 0, sizeof(addr)); | 104 | memset(&addr, 0, sizeof(addr)); |
| 105 | addr.sin_family = AF_INET; | 105 | addr.sin_family = AF_INET; |
