diff options
| author | mjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-03-19 09:13:01 +0000 |
|---|---|---|
| committer | mjn3 <mjn3@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-03-19 09:13:01 +0000 |
| commit | e901c15d890dbbdce4c086963cb1513653fc46b5 (patch) | |
| tree | a318d0f03aa076c74b576ea45dc543a5669e8e91 /networking/libiproute/iproute.c | |
| parent | 40758c00616c3b2c85d83eb4afdeb04b1f65c9f1 (diff) | |
| download | busybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.tar.gz busybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.tar.bz2 busybox-w32-e901c15d890dbbdce4c086963cb1513653fc46b5.zip | |
Major coreutils update.
git-svn-id: svn://busybox.net/trunk/busybox@6751 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'networking/libiproute/iproute.c')
| -rw-r--r-- | networking/libiproute/iproute.c | 34 |
1 files changed, 17 insertions, 17 deletions
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); |
