diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
commit | cad5364599eb5062d59e0c397ed638ddd61a8d5d (patch) | |
tree | a318d0f03aa076c74b576ea45dc543a5669e8e91 /networking/libiproute | |
parent | e01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff) | |
download | busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2 busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip |
Major coreutils update.
Diffstat (limited to 'networking/libiproute')
-rw-r--r-- | networking/libiproute/ip_parse_common_args.c | 4 | ||||
-rw-r--r-- | networking/libiproute/ipaddress.c | 24 | ||||
-rw-r--r-- | networking/libiproute/iplink.c | 8 | ||||
-rw-r--r-- | networking/libiproute/iproute.c | 34 | ||||
-rw-r--r-- | networking/libiproute/iptunnel.c | 40 | ||||
-rw-r--r-- | networking/libiproute/libnetlink.c | 70 | ||||
-rw-r--r-- | networking/libiproute/ll_addr.c | 6 | ||||
-rw-r--r-- | networking/libiproute/utils.c | 18 |
8 files changed, 102 insertions, 102 deletions
diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c index 4b4355ac1..21e9f74ba 100644 --- a/networking/libiproute/ip_parse_common_args.c +++ b/networking/libiproute/ip_parse_common_args.c | |||
@@ -48,7 +48,7 @@ void ip_parse_common_args(int *argcp, char ***argvp) | |||
48 | argc--; | 48 | argc--; |
49 | argv++; | 49 | argv++; |
50 | if (! argv[1]) | 50 | if (! argv[1]) |
51 | show_usage(); | 51 | bb_show_usage(); |
52 | if (strcmp(argv[1], "inet") == 0) | 52 | if (strcmp(argv[1], "inet") == 0) |
53 | preferred_family = AF_INET; | 53 | preferred_family = AF_INET; |
54 | else if (strcmp(argv[1], "inet6") == 0) | 54 | else if (strcmp(argv[1], "inet6") == 0) |
@@ -66,7 +66,7 @@ void ip_parse_common_args(int *argcp, char ***argvp) | |||
66 | } else if (matches(opt, "-oneline") == 0) { | 66 | } else if (matches(opt, "-oneline") == 0) { |
67 | ++oneline; | 67 | ++oneline; |
68 | } else { | 68 | } else { |
69 | show_usage(); | 69 | bb_show_usage(); |
70 | } | 70 | } |
71 | argc--; argv++; | 71 | argc--; argv++; |
72 | } | 72 | } |
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index 8eba90c77..44e871ee5 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c | |||
@@ -125,7 +125,7 @@ static int print_linkinfo(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg | |||
125 | memset(tb, 0, sizeof(tb)); | 125 | memset(tb, 0, sizeof(tb)); |
126 | parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); | 126 | parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len); |
127 | if (tb[IFLA_IFNAME] == NULL) { | 127 | if (tb[IFLA_IFNAME] == NULL) { |
128 | error_msg("nil ifname"); | 128 | bb_error_msg("nil ifname"); |
129 | return -1; | 129 | return -1; |
130 | } | 130 | } |
131 | if (filter.label && | 131 | if (filter.label && |
@@ -217,7 +217,7 @@ static int print_addrinfo(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg | |||
217 | return 0; | 217 | return 0; |
218 | len -= NLMSG_LENGTH(sizeof(*ifa)); | 218 | len -= NLMSG_LENGTH(sizeof(*ifa)); |
219 | if (len < 0) { | 219 | if (len < 0) { |
220 | error_msg("wrong nlmsg len %d", len); | 220 | bb_error_msg("wrong nlmsg len %d", len); |
221 | return -1; | 221 | return -1; |
222 | } | 222 | } |
223 | 223 | ||
@@ -489,17 +489,17 @@ extern int ipaddr_list_or_flush(int argc, char **argv, int flush) | |||
489 | exit(1); | 489 | exit(1); |
490 | 490 | ||
491 | if (rtnl_wilddump_request(&rth, preferred_family, RTM_GETLINK) < 0) { | 491 | if (rtnl_wilddump_request(&rth, preferred_family, RTM_GETLINK) < 0) { |
492 | perror_msg_and_die("Cannot send dump request"); | 492 | bb_perror_msg_and_die("Cannot send dump request"); |
493 | } | 493 | } |
494 | 494 | ||
495 | if (rtnl_dump_filter(&rth, store_nlmsg, &linfo, NULL, NULL) < 0) { | 495 | if (rtnl_dump_filter(&rth, store_nlmsg, &linfo, NULL, NULL) < 0) { |
496 | error_msg_and_die("Dump terminated"); | 496 | bb_error_msg_and_die("Dump terminated"); |
497 | } | 497 | } |
498 | 498 | ||
499 | if (filter_dev) { | 499 | if (filter_dev) { |
500 | filter.ifindex = ll_name_to_index(filter_dev); | 500 | filter.ifindex = ll_name_to_index(filter_dev); |
501 | if (filter.ifindex <= 0) { | 501 | if (filter.ifindex <= 0) { |
502 | error_msg("Device \"%s\" does not exist.", filter_dev); | 502 | bb_error_msg("Device \"%s\" does not exist.", filter_dev); |
503 | return -1; | 503 | return -1; |
504 | } | 504 | } |
505 | } | 505 | } |
@@ -539,11 +539,11 @@ extern int ipaddr_list_or_flush(int argc, char **argv, int flush) | |||
539 | 539 | ||
540 | if (filter.family != AF_PACKET) { | 540 | if (filter.family != AF_PACKET) { |
541 | if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) { | 541 | if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) { |
542 | perror_msg_and_die("Cannot send dump request"); | 542 | bb_perror_msg_and_die("Cannot send dump request"); |
543 | } | 543 | } |
544 | 544 | ||
545 | if (rtnl_dump_filter(&rth, store_nlmsg, &ainfo, NULL, NULL) < 0) { | 545 | if (rtnl_dump_filter(&rth, store_nlmsg, &ainfo, NULL, NULL) < 0) { |
546 | error_msg_and_die("Dump terminated"); | 546 | bb_error_msg_and_die("Dump terminated"); |
547 | } | 547 | } |
548 | } | 548 | } |
549 | 549 | ||
@@ -749,11 +749,11 @@ static int ipaddr_modify(int cmd, int argc, char **argv) | |||
749 | } | 749 | } |
750 | 750 | ||
751 | if (d == NULL) { | 751 | if (d == NULL) { |
752 | error_msg("Not enough information: \"dev\" argument is required."); | 752 | bb_error_msg("Not enough information: \"dev\" argument is required."); |
753 | return -1; | 753 | return -1; |
754 | } | 754 | } |
755 | if (l && matches(d, l) != 0) { | 755 | if (l && matches(d, l) != 0) { |
756 | error_msg_and_die("\"dev\" (%s) must match \"label\" (%s).", d, l); | 756 | bb_error_msg_and_die("\"dev\" (%s) must match \"label\" (%s).", d, l); |
757 | } | 757 | } |
758 | 758 | ||
759 | if (peer_len == 0 && local_len && cmd != RTM_DELADDR) { | 759 | if (peer_len == 0 && local_len && cmd != RTM_DELADDR) { |
@@ -767,7 +767,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv) | |||
767 | inet_prefix brd; | 767 | inet_prefix brd; |
768 | int i; | 768 | int i; |
769 | if (req.ifa.ifa_family != AF_INET) { | 769 | if (req.ifa.ifa_family != AF_INET) { |
770 | error_msg("Broadcast can be set only for IPv4 addresses"); | 770 | bb_error_msg("Broadcast can be set only for IPv4 addresses"); |
771 | return -1; | 771 | return -1; |
772 | } | 772 | } |
773 | brd = peer; | 773 | brd = peer; |
@@ -791,7 +791,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv) | |||
791 | ll_init_map(&rth); | 791 | ll_init_map(&rth); |
792 | 792 | ||
793 | if ((req.ifa.ifa_index = ll_name_to_index(d)) == 0) { | 793 | if ((req.ifa.ifa_index = ll_name_to_index(d)) == 0) { |
794 | error_msg("Cannot find device \"%s\"", d); | 794 | bb_error_msg("Cannot find device \"%s\"", d); |
795 | return -1; | 795 | return -1; |
796 | } | 796 | } |
797 | 797 | ||
@@ -821,5 +821,5 @@ extern int do_ipaddr(int argc, char **argv) | |||
821 | case 5: /* flush */ | 821 | case 5: /* flush */ |
822 | return ipaddr_list_or_flush(argc-1, argv+1, 1); | 822 | return ipaddr_list_or_flush(argc-1, argv+1, 1); |
823 | } | 823 | } |
824 | error_msg_and_die("Unknown command %s", *argv); | 824 | bb_error_msg_and_die("Unknown command %s", *argv); |
825 | } | 825 | } |
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 1cfaf6d6a..f826ba081 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c | |||
@@ -42,7 +42,7 @@ static int do_link; | |||
42 | 42 | ||
43 | static int on_off(char *msg) | 43 | static int on_off(char *msg) |
44 | { | 44 | { |
45 | error_msg("Error: argument of \"%s\" must be \"on\" or \"off\"", msg); | 45 | bb_error_msg("Error: argument of \"%s\" must be \"on\" or \"off\"", msg); |
46 | return -1; | 46 | return -1; |
47 | } | 47 | } |
48 | 48 | ||
@@ -211,7 +211,7 @@ static int parse_address(char *dev, int hatype, int halen, char *lla, struct ifr | |||
211 | if (alen < 0) | 211 | if (alen < 0) |
212 | return -1; | 212 | return -1; |
213 | if (alen != halen) { | 213 | if (alen != halen) { |
214 | error_msg("Wrong address (%s) length: expected %d bytes", lla, halen); | 214 | bb_error_msg("Wrong address (%s) length: expected %d bytes", lla, halen); |
215 | return -1; | 215 | return -1; |
216 | } | 216 | } |
217 | return 0; | 217 | return 0; |
@@ -293,7 +293,7 @@ static int do_set(int argc, char **argv) | |||
293 | } | 293 | } |
294 | 294 | ||
295 | if (!dev) { | 295 | if (!dev) { |
296 | error_msg("Not enough of information: \"dev\" argument is required."); | 296 | bb_error_msg("Not enough of information: \"dev\" argument is required."); |
297 | exit(-1); | 297 | exit(-1); |
298 | } | 298 | } |
299 | 299 | ||
@@ -358,6 +358,6 @@ int do_iplink(int argc, char **argv) | |||
358 | } else | 358 | } else |
359 | return ipaddr_list_link(0, NULL); | 359 | return ipaddr_list_link(0, NULL); |
360 | 360 | ||
361 | error_msg("Command \"%s\" is unknown, try \"ip link help\".", *argv); | 361 | bb_error_msg("Command \"%s\" is unknown, try \"ip link help\".", *argv); |
362 | exit(-1); | 362 | exit(-1); |
363 | } | 363 | } |
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index be4435f66..3dcafdb6f 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c | |||
@@ -85,7 +85,7 @@ static int print_route(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) | |||
85 | return 0; | 85 | return 0; |
86 | len -= NLMSG_LENGTH(sizeof(*r)); | 86 | len -= NLMSG_LENGTH(sizeof(*r)); |
87 | if (len < 0) { | 87 | if (len < 0) { |
88 | error_msg("wrong nlmsg len %d", len); | 88 | bb_error_msg("wrong nlmsg len %d", len); |
89 | return -1; | 89 | return -1; |
90 | } | 90 | } |
91 | 91 | ||
@@ -385,7 +385,7 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv) | |||
385 | 385 | ||
386 | if (d) { | 386 | if (d) { |
387 | if ((idx = ll_name_to_index(d)) == 0) { | 387 | if ((idx = ll_name_to_index(d)) == 0) { |
388 | error_msg("Cannot find device \"%s\"", d); | 388 | bb_error_msg("Cannot find device \"%s\"", d); |
389 | return -1; | 389 | return -1; |
390 | } | 390 | } |
391 | addattr32(&req.n, sizeof(req), RTA_OIF, idx); | 391 | addattr32(&req.n, sizeof(req), RTA_OIF, idx); |
@@ -549,7 +549,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush) | |||
549 | 549 | ||
550 | if (id) { | 550 | if (id) { |
551 | if ((idx = ll_name_to_index(id)) == 0) { | 551 | if ((idx = ll_name_to_index(id)) == 0) { |
552 | error_msg("Cannot find device \"%s\"", id); | 552 | bb_error_msg("Cannot find device \"%s\"", id); |
553 | return -1; | 553 | return -1; |
554 | } | 554 | } |
555 | filter.iif = idx; | 555 | filter.iif = idx; |
@@ -557,7 +557,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush) | |||
557 | } | 557 | } |
558 | if (od) { | 558 | if (od) { |
559 | if ((idx = ll_name_to_index(od)) == 0) { | 559 | if ((idx = ll_name_to_index(od)) == 0) { |
560 | error_msg("Cannot find device \"%s\"", od); | 560 | bb_error_msg("Cannot find device \"%s\"", od); |
561 | } | 561 | } |
562 | filter.oif = idx; | 562 | filter.oif = idx; |
563 | filter.oifmask = -1; | 563 | filter.oifmask = -1; |
@@ -587,7 +587,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush) | |||
587 | } | 587 | } |
588 | filter.flushed = 0; | 588 | filter.flushed = 0; |
589 | if (rtnl_dump_filter(&rth, print_route, stdout, NULL, NULL) < 0) { | 589 | if (rtnl_dump_filter(&rth, print_route, stdout, NULL, NULL) < 0) { |
590 | error_msg("Flush terminated\n"); | 590 | bb_error_msg("Flush terminated\n"); |
591 | return -1; | 591 | return -1; |
592 | } | 592 | } |
593 | if (filter.flushed == 0) { | 593 | if (filter.flushed == 0) { |
@@ -606,16 +606,16 @@ static int iproute_list_or_flush(int argc, char **argv, int flush) | |||
606 | 606 | ||
607 | if (filter.tb != -1) { | 607 | if (filter.tb != -1) { |
608 | if (rtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE) < 0) { | 608 | if (rtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE) < 0) { |
609 | perror_msg_and_die("Cannot send dump request"); | 609 | bb_perror_msg_and_die("Cannot send dump request"); |
610 | } | 610 | } |
611 | } else { | 611 | } else { |
612 | if (rtnl_rtcache_request(&rth, do_ipv6) < 0) { | 612 | if (rtnl_rtcache_request(&rth, do_ipv6) < 0) { |
613 | perror_msg_and_die("Cannot send dump request"); | 613 | bb_perror_msg_and_die("Cannot send dump request"); |
614 | } | 614 | } |
615 | } | 615 | } |
616 | 616 | ||
617 | if (rtnl_dump_filter(&rth, print_route, stdout, NULL, NULL) < 0) { | 617 | if (rtnl_dump_filter(&rth, print_route, stdout, NULL, NULL) < 0) { |
618 | error_msg_and_die("Dump terminated"); | 618 | bb_error_msg_and_die("Dump terminated"); |
619 | } | 619 | } |
620 | 620 | ||
621 | exit(0); | 621 | exit(0); |
@@ -703,7 +703,7 @@ static int iproute_get(int argc, char **argv) | |||
703 | } | 703 | } |
704 | 704 | ||
705 | if (req.r.rtm_dst_len == 0) { | 705 | if (req.r.rtm_dst_len == 0) { |
706 | error_msg_and_die("need at least destination address"); | 706 | bb_error_msg_and_die("need at least destination address"); |
707 | } | 707 | } |
708 | 708 | ||
709 | if (rtnl_open(&rth, 0) < 0) | 709 | if (rtnl_open(&rth, 0) < 0) |
@@ -716,14 +716,14 @@ static int iproute_get(int argc, char **argv) | |||
716 | 716 | ||
717 | if (idev) { | 717 | if (idev) { |
718 | if ((idx = ll_name_to_index(idev)) == 0) { | 718 | if ((idx = ll_name_to_index(idev)) == 0) { |
719 | error_msg("Cannot find device \"%s\"", idev); | 719 | bb_error_msg("Cannot find device \"%s\"", idev); |
720 | return -1; | 720 | return -1; |
721 | } | 721 | } |
722 | addattr32(&req.n, sizeof(req), RTA_IIF, idx); | 722 | addattr32(&req.n, sizeof(req), RTA_IIF, idx); |
723 | } | 723 | } |
724 | if (odev) { | 724 | if (odev) { |
725 | if ((idx = ll_name_to_index(odev)) == 0) { | 725 | if ((idx = ll_name_to_index(odev)) == 0) { |
726 | error_msg("Cannot find device \"%s\"", odev); | 726 | bb_error_msg("Cannot find device \"%s\"", odev); |
727 | return -1; | 727 | return -1; |
728 | } | 728 | } |
729 | addattr32(&req.n, sizeof(req), RTA_OIF, idx); | 729 | addattr32(&req.n, sizeof(req), RTA_OIF, idx); |
@@ -744,16 +744,16 @@ static int iproute_get(int argc, char **argv) | |||
744 | struct rtattr * tb[RTA_MAX+1]; | 744 | struct rtattr * tb[RTA_MAX+1]; |
745 | 745 | ||
746 | if (print_route(NULL, &req.n, (void*)stdout) < 0) { | 746 | if (print_route(NULL, &req.n, (void*)stdout) < 0) { |
747 | error_msg_and_die("An error :-)"); | 747 | bb_error_msg_and_die("An error :-)"); |
748 | } | 748 | } |
749 | 749 | ||
750 | if (req.n.nlmsg_type != RTM_NEWROUTE) { | 750 | if (req.n.nlmsg_type != RTM_NEWROUTE) { |
751 | error_msg("Not a route?"); | 751 | bb_error_msg("Not a route?"); |
752 | return -1; | 752 | return -1; |
753 | } | 753 | } |
754 | len -= NLMSG_LENGTH(sizeof(*r)); | 754 | len -= NLMSG_LENGTH(sizeof(*r)); |
755 | if (len < 0) { | 755 | if (len < 0) { |
756 | error_msg("Wrong len %d", len); | 756 | bb_error_msg("Wrong len %d", len); |
757 | return -1; | 757 | return -1; |
758 | } | 758 | } |
759 | 759 | ||
@@ -764,7 +764,7 @@ static int iproute_get(int argc, char **argv) | |||
764 | tb[RTA_PREFSRC]->rta_type = RTA_SRC; | 764 | tb[RTA_PREFSRC]->rta_type = RTA_SRC; |
765 | r->rtm_src_len = 8*RTA_PAYLOAD(tb[RTA_PREFSRC]); | 765 | r->rtm_src_len = 8*RTA_PAYLOAD(tb[RTA_PREFSRC]); |
766 | } else if (!tb[RTA_SRC]) { | 766 | } else if (!tb[RTA_SRC]) { |
767 | error_msg("Failed to connect the route"); | 767 | bb_error_msg("Failed to connect the route"); |
768 | return -1; | 768 | return -1; |
769 | } | 769 | } |
770 | if (!odev && tb[RTA_OIF]) { | 770 | if (!odev && tb[RTA_OIF]) { |
@@ -785,7 +785,7 @@ static int iproute_get(int argc, char **argv) | |||
785 | } | 785 | } |
786 | 786 | ||
787 | if (print_route(NULL, &req.n, (void*)stdout) < 0) { | 787 | if (print_route(NULL, &req.n, (void*)stdout) < 0) { |
788 | error_msg_and_die("An error :-)"); | 788 | bb_error_msg_and_die("An error :-)"); |
789 | } | 789 | } |
790 | 790 | ||
791 | exit(0); | 791 | exit(0); |
@@ -830,7 +830,7 @@ int do_iproute(int argc, char **argv) | |||
830 | case 11: /* flush */ | 830 | case 11: /* flush */ |
831 | return iproute_list_or_flush(argc-1, argv+1, 1); | 831 | return iproute_list_or_flush(argc-1, argv+1, 1); |
832 | default: | 832 | default: |
833 | error_msg_and_die("Unknown command %s", *argv); | 833 | bb_error_msg_and_die("Unknown command %s", *argv); |
834 | } | 834 | } |
835 | 835 | ||
836 | return iproute_modify(cmd, flags, argc-1, argv+1); | 836 | return iproute_modify(cmd, flags, argc-1, argv+1); |
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 | } |
diff --git a/networking/libiproute/libnetlink.c b/networking/libiproute/libnetlink.c index fbc555dfe..04411931d 100644 --- a/networking/libiproute/libnetlink.c +++ b/networking/libiproute/libnetlink.c | |||
@@ -34,7 +34,7 @@ int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions) | |||
34 | 34 | ||
35 | rth->fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); | 35 | rth->fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); |
36 | if (rth->fd < 0) { | 36 | if (rth->fd < 0) { |
37 | perror_msg("Cannot open netlink socket"); | 37 | bb_perror_msg("Cannot open netlink socket"); |
38 | return -1; | 38 | return -1; |
39 | } | 39 | } |
40 | 40 | ||
@@ -43,20 +43,20 @@ int rtnl_open(struct rtnl_handle *rth, unsigned subscriptions) | |||
43 | rth->local.nl_groups = subscriptions; | 43 | rth->local.nl_groups = subscriptions; |
44 | 44 | ||
45 | if (bind(rth->fd, (struct sockaddr*)&rth->local, sizeof(rth->local)) < 0) { | 45 | if (bind(rth->fd, (struct sockaddr*)&rth->local, sizeof(rth->local)) < 0) { |
46 | perror_msg("Cannot bind netlink socket"); | 46 | bb_perror_msg("Cannot bind netlink socket"); |
47 | return -1; | 47 | return -1; |
48 | } | 48 | } |
49 | addr_len = sizeof(rth->local); | 49 | addr_len = sizeof(rth->local); |
50 | if (getsockname(rth->fd, (struct sockaddr*)&rth->local, &addr_len) < 0) { | 50 | if (getsockname(rth->fd, (struct sockaddr*)&rth->local, &addr_len) < 0) { |
51 | perror_msg("Cannot getsockname"); | 51 | bb_perror_msg("Cannot getsockname"); |
52 | return -1; | 52 | return -1; |
53 | } | 53 | } |
54 | if (addr_len != sizeof(rth->local)) { | 54 | if (addr_len != sizeof(rth->local)) { |
55 | error_msg("Wrong address length %d", addr_len); | 55 | bb_error_msg("Wrong address length %d", addr_len); |
56 | return -1; | 56 | return -1; |
57 | } | 57 | } |
58 | if (rth->local.nl_family != AF_NETLINK) { | 58 | if (rth->local.nl_family != AF_NETLINK) { |
59 | error_msg("Wrong address family %d", rth->local.nl_family); | 59 | bb_error_msg("Wrong address family %d", rth->local.nl_family); |
60 | return -1; | 60 | return -1; |
61 | } | 61 | } |
62 | rth->seq = time(NULL); | 62 | rth->seq = time(NULL); |
@@ -144,15 +144,15 @@ int rtnl_dump_filter(struct rtnl_handle *rth, | |||
144 | if (status < 0) { | 144 | if (status < 0) { |
145 | if (errno == EINTR) | 145 | if (errno == EINTR) |
146 | continue; | 146 | continue; |
147 | perror_msg("OVERRUN"); | 147 | bb_perror_msg("OVERRUN"); |
148 | continue; | 148 | continue; |
149 | } | 149 | } |
150 | if (status == 0) { | 150 | if (status == 0) { |
151 | error_msg("EOF on netlink"); | 151 | bb_error_msg("EOF on netlink"); |
152 | return -1; | 152 | return -1; |
153 | } | 153 | } |
154 | if (msg.msg_namelen != sizeof(nladdr)) { | 154 | if (msg.msg_namelen != sizeof(nladdr)) { |
155 | error_msg_and_die("sender address length == %d", msg.msg_namelen); | 155 | bb_error_msg_and_die("sender address length == %d", msg.msg_namelen); |
156 | } | 156 | } |
157 | 157 | ||
158 | h = (struct nlmsghdr*)buf; | 158 | h = (struct nlmsghdr*)buf; |
@@ -176,10 +176,10 @@ int rtnl_dump_filter(struct rtnl_handle *rth, | |||
176 | if (h->nlmsg_type == NLMSG_ERROR) { | 176 | if (h->nlmsg_type == NLMSG_ERROR) { |
177 | struct nlmsgerr *l_err = (struct nlmsgerr*)NLMSG_DATA(h); | 177 | struct nlmsgerr *l_err = (struct nlmsgerr*)NLMSG_DATA(h); |
178 | if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) { | 178 | if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) { |
179 | error_msg("ERROR truncated"); | 179 | bb_error_msg("ERROR truncated"); |
180 | } else { | 180 | } else { |
181 | errno = -l_err->error; | 181 | errno = -l_err->error; |
182 | perror_msg("RTNETLINK answers"); | 182 | bb_perror_msg("RTNETLINK answers"); |
183 | } | 183 | } |
184 | return -1; | 184 | return -1; |
185 | } | 185 | } |
@@ -192,11 +192,11 @@ skip_it: | |||
192 | h = NLMSG_NEXT(h, status); | 192 | h = NLMSG_NEXT(h, status); |
193 | } | 193 | } |
194 | if (msg.msg_flags & MSG_TRUNC) { | 194 | if (msg.msg_flags & MSG_TRUNC) { |
195 | error_msg("Message truncated"); | 195 | bb_error_msg("Message truncated"); |
196 | continue; | 196 | continue; |
197 | } | 197 | } |
198 | if (status) { | 198 | if (status) { |
199 | error_msg_and_die("!!!Remnant of size %d", status); | 199 | bb_error_msg_and_die("!!!Remnant of size %d", status); |
200 | } | 200 | } |
201 | } | 201 | } |
202 | } | 202 | } |
@@ -231,7 +231,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | |||
231 | status = sendmsg(rtnl->fd, &msg, 0); | 231 | status = sendmsg(rtnl->fd, &msg, 0); |
232 | 232 | ||
233 | if (status < 0) { | 233 | if (status < 0) { |
234 | perror_msg("Cannot talk to rtnetlink"); | 234 | bb_perror_msg("Cannot talk to rtnetlink"); |
235 | return -1; | 235 | return -1; |
236 | } | 236 | } |
237 | 237 | ||
@@ -245,15 +245,15 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | |||
245 | if (errno == EINTR) { | 245 | if (errno == EINTR) { |
246 | continue; | 246 | continue; |
247 | } | 247 | } |
248 | perror_msg("OVERRUN"); | 248 | bb_perror_msg("OVERRUN"); |
249 | continue; | 249 | continue; |
250 | } | 250 | } |
251 | if (status == 0) { | 251 | if (status == 0) { |
252 | error_msg("EOF on netlink"); | 252 | bb_error_msg("EOF on netlink"); |
253 | return -1; | 253 | return -1; |
254 | } | 254 | } |
255 | if (msg.msg_namelen != sizeof(nladdr)) { | 255 | if (msg.msg_namelen != sizeof(nladdr)) { |
256 | error_msg_and_die("sender address length == %d", msg.msg_namelen); | 256 | bb_error_msg_and_die("sender address length == %d", msg.msg_namelen); |
257 | } | 257 | } |
258 | for (h = (struct nlmsghdr*)buf; status >= sizeof(*h); ) { | 258 | for (h = (struct nlmsghdr*)buf; status >= sizeof(*h); ) { |
259 | int l_err; | 259 | int l_err; |
@@ -262,10 +262,10 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | |||
262 | 262 | ||
263 | if (l<0 || len>status) { | 263 | if (l<0 || len>status) { |
264 | if (msg.msg_flags & MSG_TRUNC) { | 264 | if (msg.msg_flags & MSG_TRUNC) { |
265 | error_msg("Truncated message"); | 265 | bb_error_msg("Truncated message"); |
266 | return -1; | 266 | return -1; |
267 | } | 267 | } |
268 | error_msg_and_die("!!!malformed message: len=%d", len); | 268 | bb_error_msg_and_die("!!!malformed message: len=%d", len); |
269 | } | 269 | } |
270 | 270 | ||
271 | if (h->nlmsg_pid != rtnl->local.nl_pid || | 271 | if (h->nlmsg_pid != rtnl->local.nl_pid || |
@@ -282,7 +282,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | |||
282 | if (h->nlmsg_type == NLMSG_ERROR) { | 282 | if (h->nlmsg_type == NLMSG_ERROR) { |
283 | struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); | 283 | struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h); |
284 | if (l < sizeof(struct nlmsgerr)) { | 284 | if (l < sizeof(struct nlmsgerr)) { |
285 | error_msg("ERROR truncated"); | 285 | bb_error_msg("ERROR truncated"); |
286 | } else { | 286 | } else { |
287 | errno = -err->error; | 287 | errno = -err->error; |
288 | if (errno == 0) { | 288 | if (errno == 0) { |
@@ -291,7 +291,7 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | |||
291 | } | 291 | } |
292 | return 0; | 292 | return 0; |
293 | } | 293 | } |
294 | perror_msg("RTNETLINK answers"); | 294 | bb_perror_msg("RTNETLINK answers"); |
295 | } | 295 | } |
296 | return -1; | 296 | return -1; |
297 | } | 297 | } |
@@ -300,17 +300,17 @@ int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, | |||
300 | return 0; | 300 | return 0; |
301 | } | 301 | } |
302 | 302 | ||
303 | error_msg("Unexpected reply!!!"); | 303 | bb_error_msg("Unexpected reply!!!"); |
304 | 304 | ||
305 | status -= NLMSG_ALIGN(len); | 305 | status -= NLMSG_ALIGN(len); |
306 | h = (struct nlmsghdr*)((char*)h + NLMSG_ALIGN(len)); | 306 | h = (struct nlmsghdr*)((char*)h + NLMSG_ALIGN(len)); |
307 | } | 307 | } |
308 | if (msg.msg_flags & MSG_TRUNC) { | 308 | if (msg.msg_flags & MSG_TRUNC) { |
309 | error_msg("Message truncated"); | 309 | bb_error_msg("Message truncated"); |
310 | continue; | 310 | continue; |
311 | } | 311 | } |
312 | if (status) { | 312 | if (status) { |
313 | error_msg_and_die("!!!Remnant of size %d", status); | 313 | bb_error_msg_and_die("!!!Remnant of size %d", status); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | } | 316 | } |
@@ -346,15 +346,15 @@ int rtnl_listen(struct rtnl_handle *rtnl, | |||
346 | if (status < 0) { | 346 | if (status < 0) { |
347 | if (errno == EINTR) | 347 | if (errno == EINTR) |
348 | continue; | 348 | continue; |
349 | perror_msg("OVERRUN"); | 349 | bb_perror_msg("OVERRUN"); |
350 | continue; | 350 | continue; |
351 | } | 351 | } |
352 | if (status == 0) { | 352 | if (status == 0) { |
353 | error_msg("EOF on netlink"); | 353 | bb_error_msg("EOF on netlink"); |
354 | return -1; | 354 | return -1; |
355 | } | 355 | } |
356 | if (msg.msg_namelen != sizeof(nladdr)) { | 356 | if (msg.msg_namelen != sizeof(nladdr)) { |
357 | error_msg_and_die("Sender address length == %d", msg.msg_namelen); | 357 | bb_error_msg_and_die("Sender address length == %d", msg.msg_namelen); |
358 | } | 358 | } |
359 | for (h = (struct nlmsghdr*)buf; status >= sizeof(*h); ) { | 359 | for (h = (struct nlmsghdr*)buf; status >= sizeof(*h); ) { |
360 | int err; | 360 | int err; |
@@ -363,10 +363,10 @@ int rtnl_listen(struct rtnl_handle *rtnl, | |||
363 | 363 | ||
364 | if (l<0 || len>status) { | 364 | if (l<0 || len>status) { |
365 | if (msg.msg_flags & MSG_TRUNC) { | 365 | if (msg.msg_flags & MSG_TRUNC) { |
366 | error_msg("Truncated message"); | 366 | bb_error_msg("Truncated message"); |
367 | return -1; | 367 | return -1; |
368 | } | 368 | } |
369 | error_msg_and_die("!!!malformed message: len=%d", len); | 369 | bb_error_msg_and_die("!!!malformed message: len=%d", len); |
370 | } | 370 | } |
371 | 371 | ||
372 | err = handler(&nladdr, h, jarg); | 372 | err = handler(&nladdr, h, jarg); |
@@ -378,11 +378,11 @@ int rtnl_listen(struct rtnl_handle *rtnl, | |||
378 | h = (struct nlmsghdr*)((char*)h + NLMSG_ALIGN(len)); | 378 | h = (struct nlmsghdr*)((char*)h + NLMSG_ALIGN(len)); |
379 | } | 379 | } |
380 | if (msg.msg_flags & MSG_TRUNC) { | 380 | if (msg.msg_flags & MSG_TRUNC) { |
381 | error_msg("Message truncated"); | 381 | bb_error_msg("Message truncated"); |
382 | continue; | 382 | continue; |
383 | } | 383 | } |
384 | if (status) { | 384 | if (status) { |
385 | error_msg_and_die("!!!Remnant of size %d", status); | 385 | bb_error_msg_and_die("!!!Remnant of size %d", status); |
386 | } | 386 | } |
387 | } | 387 | } |
388 | } | 388 | } |
@@ -410,7 +410,7 @@ int rtnl_from_file(FILE *rtnl, | |||
410 | if (status < 0) { | 410 | if (status < 0) { |
411 | if (errno == EINTR) | 411 | if (errno == EINTR) |
412 | continue; | 412 | continue; |
413 | perror_msg("rtnl_from_file: fread"); | 413 | bb_perror_msg("rtnl_from_file: fread"); |
414 | return -1; | 414 | return -1; |
415 | } | 415 | } |
416 | if (status == 0) | 416 | if (status == 0) |
@@ -421,7 +421,7 @@ int rtnl_from_file(FILE *rtnl, | |||
421 | l = len - sizeof(*h); | 421 | l = len - sizeof(*h); |
422 | 422 | ||
423 | if (l<0 || len>sizeof(buf)) { | 423 | if (l<0 || len>sizeof(buf)) { |
424 | error_msg("!!!malformed message: len=%d @%lu", | 424 | bb_error_msg("!!!malformed message: len=%d @%lu", |
425 | len, ftell(rtnl)); | 425 | len, ftell(rtnl)); |
426 | return -1; | 426 | return -1; |
427 | } | 427 | } |
@@ -429,11 +429,11 @@ int rtnl_from_file(FILE *rtnl, | |||
429 | status = fread(NLMSG_DATA(h), 1, NLMSG_ALIGN(l), rtnl); | 429 | status = fread(NLMSG_DATA(h), 1, NLMSG_ALIGN(l), rtnl); |
430 | 430 | ||
431 | if (status < 0) { | 431 | if (status < 0) { |
432 | perror_msg("rtnl_from_file: fread"); | 432 | bb_perror_msg("rtnl_from_file: fread"); |
433 | return -1; | 433 | return -1; |
434 | } | 434 | } |
435 | if (status < l) { | 435 | if (status < l) { |
436 | error_msg("rtnl-from_file: truncated message"); | 436 | bb_error_msg("rtnl-from_file: truncated message"); |
437 | return -1; | 437 | return -1; |
438 | } | 438 | } |
439 | 439 | ||
@@ -514,7 +514,7 @@ int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) | |||
514 | rta = RTA_NEXT(rta,len); | 514 | rta = RTA_NEXT(rta,len); |
515 | } | 515 | } |
516 | if (len) { | 516 | if (len) { |
517 | error_msg("!!!Deficit %d, rta_len=%d", len, rta->rta_len); | 517 | bb_error_msg("!!!Deficit %d, rta_len=%d", len, rta->rta_len); |
518 | } | 518 | } |
519 | return 0; | 519 | return 0; |
520 | } | 520 | } |
diff --git a/networking/libiproute/ll_addr.c b/networking/libiproute/ll_addr.c index 39e561fe5..ada685f4e 100644 --- a/networking/libiproute/ll_addr.c +++ b/networking/libiproute/ll_addr.c | |||
@@ -44,7 +44,7 @@ int ll_addr_a2n(unsigned char *lladdr, int len, char *arg) | |||
44 | if (strchr(arg, '.')) { | 44 | if (strchr(arg, '.')) { |
45 | inet_prefix pfx; | 45 | inet_prefix pfx; |
46 | if (get_addr_1(&pfx, arg, AF_INET)) { | 46 | if (get_addr_1(&pfx, arg, AF_INET)) { |
47 | error_msg("\"%s\" is invalid lladdr.", arg); | 47 | bb_error_msg("\"%s\" is invalid lladdr.", arg); |
48 | return -1; | 48 | return -1; |
49 | } | 49 | } |
50 | if (len < 4) { | 50 | if (len < 4) { |
@@ -63,11 +63,11 @@ int ll_addr_a2n(unsigned char *lladdr, int len, char *arg) | |||
63 | cp++; | 63 | cp++; |
64 | } | 64 | } |
65 | if (sscanf(arg, "%x", &temp) != 1) { | 65 | if (sscanf(arg, "%x", &temp) != 1) { |
66 | error_msg("\"%s\" is invalid lladdr.", arg); | 66 | bb_error_msg("\"%s\" is invalid lladdr.", arg); |
67 | return -1; | 67 | return -1; |
68 | } | 68 | } |
69 | if (temp < 0 || temp > 255) { | 69 | if (temp < 0 || temp > 255) { |
70 | error_msg("\"%s\" is invalid lladdr.", arg); | 70 | bb_error_msg("\"%s\" is invalid lladdr.", arg); |
71 | return -1; | 71 | return -1; |
72 | } | 72 | } |
73 | lladdr[i] = temp; | 73 | lladdr[i] = temp; |
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c index 2c23cd294..fa1548609 100644 --- a/networking/libiproute/utils.c +++ b/networking/libiproute/utils.c | |||
@@ -209,10 +209,10 @@ int get_prefix_1(inet_prefix * dst, char *arg, int family) | |||
209 | int get_addr(inet_prefix * dst, char *arg, int family) | 209 | int get_addr(inet_prefix * dst, char *arg, int family) |
210 | { | 210 | { |
211 | if (family == AF_PACKET) { | 211 | if (family == AF_PACKET) { |
212 | error_msg_and_die("\"%s\" may be inet address, but it is not allowed in this context.", arg); | 212 | bb_error_msg_and_die("\"%s\" may be inet address, but it is not allowed in this context.", arg); |
213 | } | 213 | } |
214 | if (get_addr_1(dst, arg, family)) { | 214 | if (get_addr_1(dst, arg, family)) { |
215 | error_msg_and_die("an inet address is expected rather than \"%s\".", arg); | 215 | bb_error_msg_and_die("an inet address is expected rather than \"%s\".", arg); |
216 | } | 216 | } |
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
@@ -220,10 +220,10 @@ int get_addr(inet_prefix * dst, char *arg, int family) | |||
220 | int get_prefix(inet_prefix * dst, char *arg, int family) | 220 | int get_prefix(inet_prefix * dst, char *arg, int family) |
221 | { | 221 | { |
222 | if (family == AF_PACKET) { | 222 | if (family == AF_PACKET) { |
223 | error_msg_and_die("\"%s\" may be inet address, but it is not allowed in this context.", arg); | 223 | bb_error_msg_and_die("\"%s\" may be inet address, but it is not allowed in this context.", arg); |
224 | } | 224 | } |
225 | if (get_prefix_1(dst, arg, family)) { | 225 | if (get_prefix_1(dst, arg, family)) { |
226 | error_msg_and_die("an inet address is expected rather than \"%s\".", arg); | 226 | bb_error_msg_and_die("an inet address is expected rather than \"%s\".", arg); |
227 | } | 227 | } |
228 | return 0; | 228 | return 0; |
229 | } | 229 | } |
@@ -233,32 +233,32 @@ __u32 get_addr32(char *name) | |||
233 | inet_prefix addr; | 233 | inet_prefix addr; |
234 | 234 | ||
235 | if (get_addr_1(&addr, name, AF_INET)) { | 235 | if (get_addr_1(&addr, name, AF_INET)) { |
236 | error_msg_and_die("an IP address is expected rather than \"%s\"", name); | 236 | bb_error_msg_and_die("an IP address is expected rather than \"%s\"", name); |
237 | } | 237 | } |
238 | return addr.data[0]; | 238 | return addr.data[0]; |
239 | } | 239 | } |
240 | 240 | ||
241 | void incomplete_command() | 241 | void incomplete_command() |
242 | { | 242 | { |
243 | error_msg("Command line is not complete. Try option \"help\""); | 243 | bb_error_msg("Command line is not complete. Try option \"help\""); |
244 | exit(-1); | 244 | exit(-1); |
245 | } | 245 | } |
246 | 246 | ||
247 | void invarg(char *msg, char *arg) | 247 | void invarg(char *msg, char *arg) |
248 | { | 248 | { |
249 | error_msg("argument \"%s\" is wrong: %s", arg, msg); | 249 | bb_error_msg("argument \"%s\" is wrong: %s", arg, msg); |
250 | exit(-1); | 250 | exit(-1); |
251 | } | 251 | } |
252 | 252 | ||
253 | void duparg(char *key, char *arg) | 253 | void duparg(char *key, char *arg) |
254 | { | 254 | { |
255 | error_msg("duplicate \"%s\": \"%s\" is the second value.", key, arg); | 255 | bb_error_msg("duplicate \"%s\": \"%s\" is the second value.", key, arg); |
256 | exit(-1); | 256 | exit(-1); |
257 | } | 257 | } |
258 | 258 | ||
259 | void duparg2(char *key, char *arg) | 259 | void duparg2(char *key, char *arg) |
260 | { | 260 | { |
261 | error_msg("either \"%s\" is duplicate, or \"%s\" is a garbage.", key, arg); | 261 | bb_error_msg("either \"%s\" is duplicate, or \"%s\" is a garbage.", key, arg); |
262 | exit(-1); | 262 | exit(-1); |
263 | } | 263 | } |
264 | 264 | ||