diff options
Diffstat (limited to 'networking/libiproute/iptunnel.c')
-rw-r--r-- | networking/libiproute/iptunnel.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index 1eb17799c..eae5bb091 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c | |||
@@ -47,7 +47,7 @@ static int do_ioctl_get_ifindex(char *dev) | |||
47 | strcpy(ifr.ifr_name, dev); | 47 | strcpy(ifr.ifr_name, dev); |
48 | fd = socket(AF_INET, SOCK_DGRAM, 0); | 48 | fd = socket(AF_INET, SOCK_DGRAM, 0); |
49 | if (ioctl(fd, SIOCGIFINDEX, &ifr)) { | 49 | if (ioctl(fd, SIOCGIFINDEX, &ifr)) { |
50 | perror_msg("ioctl"); | 50 | bb_perror_msg("ioctl"); |
51 | return 0; | 51 | return 0; |
52 | } | 52 | } |
53 | close(fd); | 53 | close(fd); |
@@ -62,7 +62,7 @@ static int do_ioctl_get_iftype(char *dev) | |||
62 | strcpy(ifr.ifr_name, dev); | 62 | strcpy(ifr.ifr_name, dev); |
63 | fd = socket(AF_INET, SOCK_DGRAM, 0); | 63 | fd = socket(AF_INET, SOCK_DGRAM, 0); |
64 | if (ioctl(fd, SIOCGIFHWADDR, &ifr)) { | 64 | if (ioctl(fd, SIOCGIFHWADDR, &ifr)) { |
65 | perror_msg("ioctl"); | 65 | bb_perror_msg("ioctl"); |
66 | return -1; | 66 | return -1; |
67 | } | 67 | } |
68 | close(fd); | 68 | close(fd); |
@@ -78,7 +78,7 @@ static char *do_ioctl_get_ifname(int idx) | |||
78 | ifr.ifr_ifindex = idx; | 78 | ifr.ifr_ifindex = idx; |
79 | fd = socket(AF_INET, SOCK_DGRAM, 0); | 79 | fd = socket(AF_INET, SOCK_DGRAM, 0); |
80 | if (ioctl(fd, SIOCGIFNAME, &ifr)) { | 80 | if (ioctl(fd, SIOCGIFNAME, &ifr)) { |
81 | perror_msg("ioctl"); | 81 | bb_perror_msg("ioctl"); |
82 | return NULL; | 82 | return NULL; |
83 | } | 83 | } |
84 | close(fd); | 84 | close(fd); |
@@ -98,7 +98,7 @@ static int do_get_ioctl(char *basedev, struct ip_tunnel_parm *p) | |||
98 | fd = socket(AF_INET, SOCK_DGRAM, 0); | 98 | fd = socket(AF_INET, SOCK_DGRAM, 0); |
99 | err = ioctl(fd, SIOCGETTUNNEL, &ifr); | 99 | err = ioctl(fd, SIOCGETTUNNEL, &ifr); |
100 | if (err) { | 100 | if (err) { |
101 | perror_msg("ioctl"); | 101 | bb_perror_msg("ioctl"); |
102 | } | 102 | } |
103 | close(fd); | 103 | close(fd); |
104 | return err; | 104 | return err; |
@@ -119,7 +119,7 @@ static int do_add_ioctl(int cmd, char *basedev, struct ip_tunnel_parm *p) | |||
119 | fd = socket(AF_INET, SOCK_DGRAM, 0); | 119 | fd = socket(AF_INET, SOCK_DGRAM, 0); |
120 | err = ioctl(fd, cmd, &ifr); | 120 | err = ioctl(fd, cmd, &ifr); |
121 | if (err) { | 121 | if (err) { |
122 | perror_msg("ioctl"); | 122 | bb_perror_msg("ioctl"); |
123 | } | 123 | } |
124 | close(fd); | 124 | close(fd); |
125 | return err; | 125 | return err; |
@@ -140,7 +140,7 @@ static int do_del_ioctl(char *basedev, struct ip_tunnel_parm *p) | |||
140 | fd = socket(AF_INET, SOCK_DGRAM, 0); | 140 | fd = socket(AF_INET, SOCK_DGRAM, 0); |
141 | err = ioctl(fd, SIOCDELTUNNEL, &ifr); | 141 | err = ioctl(fd, SIOCDELTUNNEL, &ifr); |
142 | if (err) { | 142 | if (err) { |
143 | perror_msg("ioctl"); | 143 | bb_perror_msg("ioctl"); |
144 | } | 144 | } |
145 | close(fd); | 145 | close(fd); |
146 | return err; | 146 | return err; |
@@ -166,26 +166,26 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) | |||
166 | if (strcmp(*argv, "ipip") == 0 || | 166 | if (strcmp(*argv, "ipip") == 0 || |
167 | strcmp(*argv, "ip/ip") == 0) { | 167 | strcmp(*argv, "ip/ip") == 0) { |
168 | if (p->iph.protocol && p->iph.protocol != IPPROTO_IPIP) { | 168 | if (p->iph.protocol && p->iph.protocol != IPPROTO_IPIP) { |
169 | error_msg("You managed to ask for more than one tunnel mode."); | 169 | bb_error_msg("You managed to ask for more than one tunnel mode."); |
170 | exit(-1); | 170 | exit(-1); |
171 | } | 171 | } |
172 | p->iph.protocol = IPPROTO_IPIP; | 172 | p->iph.protocol = IPPROTO_IPIP; |
173 | } else if (strcmp(*argv, "gre") == 0 || | 173 | } else if (strcmp(*argv, "gre") == 0 || |
174 | strcmp(*argv, "gre/ip") == 0) { | 174 | strcmp(*argv, "gre/ip") == 0) { |
175 | if (p->iph.protocol && p->iph.protocol != IPPROTO_GRE) { | 175 | if (p->iph.protocol && p->iph.protocol != IPPROTO_GRE) { |
176 | error_msg("You managed to ask for more than one tunnel mode."); | 176 | bb_error_msg("You managed to ask for more than one tunnel mode."); |
177 | exit(-1); | 177 | exit(-1); |
178 | } | 178 | } |
179 | p->iph.protocol = IPPROTO_GRE; | 179 | p->iph.protocol = IPPROTO_GRE; |
180 | } else if (strcmp(*argv, "sit") == 0 || | 180 | } else if (strcmp(*argv, "sit") == 0 || |
181 | strcmp(*argv, "ipv6/ip") == 0) { | 181 | strcmp(*argv, "ipv6/ip") == 0) { |
182 | if (p->iph.protocol && p->iph.protocol != IPPROTO_IPV6) { | 182 | if (p->iph.protocol && p->iph.protocol != IPPROTO_IPV6) { |
183 | error_msg("You managed to ask for more than one tunnel mode."); | 183 | bb_error_msg("You managed to ask for more than one tunnel mode."); |
184 | exit(-1); | 184 | exit(-1); |
185 | } | 185 | } |
186 | p->iph.protocol = IPPROTO_IPV6; | 186 | p->iph.protocol = IPPROTO_IPV6; |
187 | } else { | 187 | } else { |
188 | error_msg("Cannot guess tunnel mode."); | 188 | bb_error_msg("Cannot guess tunnel mode."); |
189 | exit(-1); | 189 | exit(-1); |
190 | } | 190 | } |
191 | } else if (strcmp(*argv, "key") == 0) { | 191 | } else if (strcmp(*argv, "key") == 0) { |
@@ -197,7 +197,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) | |||
197 | p->i_key = p->o_key = get_addr32(*argv); | 197 | p->i_key = p->o_key = get_addr32(*argv); |
198 | else { | 198 | else { |
199 | if (get_unsigned(&uval, *argv, 0)<0) { | 199 | if (get_unsigned(&uval, *argv, 0)<0) { |
200 | error_msg("invalid value of \"key\""); | 200 | bb_error_msg("invalid value of \"key\""); |
201 | exit(-1); | 201 | exit(-1); |
202 | } | 202 | } |
203 | p->i_key = p->o_key = htonl(uval); | 203 | p->i_key = p->o_key = htonl(uval); |
@@ -210,7 +210,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) | |||
210 | p->o_key = get_addr32(*argv); | 210 | p->o_key = get_addr32(*argv); |
211 | else { | 211 | else { |
212 | if (get_unsigned(&uval, *argv, 0)<0) { | 212 | if (get_unsigned(&uval, *argv, 0)<0) { |
213 | error_msg("invalid value of \"ikey\""); | 213 | bb_error_msg("invalid value of \"ikey\""); |
214 | exit(-1); | 214 | exit(-1); |
215 | } | 215 | } |
216 | p->i_key = htonl(uval); | 216 | p->i_key = htonl(uval); |
@@ -223,7 +223,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) | |||
223 | p->o_key = get_addr32(*argv); | 223 | p->o_key = get_addr32(*argv); |
224 | else { | 224 | else { |
225 | if (get_unsigned(&uval, *argv, 0)<0) { | 225 | if (get_unsigned(&uval, *argv, 0)<0) { |
226 | error_msg("invalid value of \"okey\""); | 226 | bb_error_msg("invalid value of \"okey\""); |
227 | exit(-1); | 227 | exit(-1); |
228 | } | 228 | } |
229 | p->o_key = htonl(uval); | 229 | p->o_key = htonl(uval); |
@@ -308,7 +308,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) | |||
308 | 308 | ||
309 | if (p->iph.protocol == IPPROTO_IPIP || p->iph.protocol == IPPROTO_IPV6) { | 309 | if (p->iph.protocol == IPPROTO_IPIP || p->iph.protocol == IPPROTO_IPV6) { |
310 | if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) { | 310 | if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) { |
311 | error_msg("Keys are not allowed with ipip and sit."); | 311 | bb_error_msg("Keys are not allowed with ipip and sit."); |
312 | return -1; | 312 | return -1; |
313 | } | 313 | } |
314 | } | 314 | } |
@@ -328,7 +328,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) | |||
328 | p->o_flags |= GRE_KEY; | 328 | p->o_flags |= GRE_KEY; |
329 | } | 329 | } |
330 | if (IN_MULTICAST(ntohl(p->iph.daddr)) && !p->iph.saddr) { | 330 | if (IN_MULTICAST(ntohl(p->iph.daddr)) && !p->iph.saddr) { |
331 | error_msg("Broadcast tunnel requires a source address."); | 331 | bb_error_msg("Broadcast tunnel requires a source address."); |
332 | return -1; | 332 | return -1; |
333 | } | 333 | } |
334 | return 0; | 334 | return 0; |
@@ -343,7 +343,7 @@ static int do_add(int cmd, int argc, char **argv) | |||
343 | return -1; | 343 | return -1; |
344 | 344 | ||
345 | if (p.iph.ttl && p.iph.frag_off == 0) { | 345 | if (p.iph.ttl && p.iph.frag_off == 0) { |
346 | error_msg("ttl != 0 and noptmudisc are incompatible"); | 346 | bb_error_msg("ttl != 0 and noptmudisc are incompatible"); |
347 | return -1; | 347 | return -1; |
348 | } | 348 | } |
349 | 349 | ||
@@ -355,7 +355,7 @@ static int do_add(int cmd, int argc, char **argv) | |||
355 | case IPPROTO_IPV6: | 355 | case IPPROTO_IPV6: |
356 | return do_add_ioctl(cmd, "sit0", &p); | 356 | return do_add_ioctl(cmd, "sit0", &p); |
357 | default: | 357 | default: |
358 | error_msg("cannot determine tunnel mode (ipip, gre or sit)"); | 358 | bb_error_msg("cannot determine tunnel mode (ipip, gre or sit)"); |
359 | return -1; | 359 | return -1; |
360 | } | 360 | } |
361 | return -1; | 361 | return -1; |
@@ -464,7 +464,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p) | |||
464 | buf[sizeof(buf) - 1] = 0; | 464 | buf[sizeof(buf) - 1] = 0; |
465 | if ((ptr = strchr(buf, ':')) == NULL || | 465 | if ((ptr = strchr(buf, ':')) == NULL || |
466 | (*ptr++ = 0, sscanf(buf, "%s", name) != 1)) { | 466 | (*ptr++ = 0, sscanf(buf, "%s", name) != 1)) { |
467 | error_msg("Wrong format of /proc/net/dev. Sorry."); | 467 | bb_error_msg("Wrong format of /proc/net/dev. Sorry."); |
468 | return -1; | 468 | return -1; |
469 | } | 469 | } |
470 | if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld", | 470 | if (sscanf(ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld", |
@@ -477,7 +477,7 @@ static int do_tunnels_list(struct ip_tunnel_parm *p) | |||
477 | continue; | 477 | continue; |
478 | type = do_ioctl_get_iftype(name); | 478 | type = do_ioctl_get_iftype(name); |
479 | if (type == -1) { | 479 | if (type == -1) { |
480 | error_msg("Failed to get type of [%s]", name); | 480 | bb_error_msg("Failed to get type of [%s]", name); |
481 | continue; | 481 | continue; |
482 | } | 482 | } |
483 | if (type != ARPHRD_TUNNEL && type != ARPHRD_IPGRE && type != ARPHRD_SIT) | 483 | if (type != ARPHRD_TUNNEL && type != ARPHRD_IPGRE && type != ARPHRD_SIT) |
@@ -543,6 +543,6 @@ int do_iptunnel(int argc, char **argv) | |||
543 | } else | 543 | } else |
544 | return do_show(0, NULL); | 544 | return do_show(0, NULL); |
545 | 545 | ||
546 | error_msg("Command \"%s\" is unknown, try \"ip tunnel help\".", *argv); | 546 | bb_error_msg("Command \"%s\" is unknown, try \"ip tunnel help\".", *argv); |
547 | exit(-1); | 547 | exit(-1); |
548 | } | 548 | } |