Add macosx fix from #1407
[openwrt.git] / package / busybox / patches / 160-iproute_fixes.patch
1 diff -urN busybox-1.4.1/networking/ip.c busybox-1.4.1-iproute/networking/ip.c
2 --- busybox-1.4.1/networking/ip.c       2007-01-24 22:34:34.000000000 +0100
3 +++ busybox-1.4.1-iproute/networking/ip.c       2007-01-27 14:07:05.000000000 +0100
4 @@ -33,8 +33,9 @@
5                 if (ENABLE_FEATURE_IP_LINK && matches(argv[1], "link") == 0) {
6                         ret = do_iplink(argc-2, argv+2);
7                 }
8 -               if (ENABLE_FEATURE_IP_TUNNEL &&
9 -                       (matches(argv[1], "tunnel") == 0 || strcmp(argv[1], "tunl") == 0)) {
10 +               if (ENABLE_FEATURE_IP_TUNNEL
11 +                && (matches(argv[1], "tunnel") == 0 || strcmp(argv[1], "tunl") == 0)
12 +               ) {
13                         ret = do_iptunnel(argc-2, argv+2);
14                 }
15                 if (ENABLE_FEATURE_IP_RULE && matches(argv[1], "rule") == 0) {
16 diff -urN busybox-1.4.1/networking/libiproute/iproute.c busybox-1.4.1-iproute/networking/libiproute/iproute.c
17 --- busybox-1.4.1/networking/libiproute/iproute.c       2007-01-24 22:34:33.000000000 +0100
18 +++ busybox-1.4.1-iproute/networking/libiproute/iproute.c       2007-01-27 14:07:05.000000000 +0100
19 @@ -835,9 +835,11 @@
20  
21  int do_iproute(int argc, char **argv)
22  {
23 -       static const char * const ip_route_commands[] =
24 -               { "add", "append", "change", "chg", "delete", "get",
25 -               "list", "show", "prepend", "replace", "test", "flush", 0 };
26 +       static const char * const ip_route_commands[] = {
27 +       /*0-3*/ "add", "append", "change", "chg",
28 +       /*4-7*/ "delete", "get", "list", "show",
29 +       /*8..*/ "prepend", "replace", "test", "flush", 0
30 +       };
31         int command_num = 6;
32         unsigned int flags = 0;
33         int cmd = RTM_NEWROUTE;
34 @@ -848,7 +850,7 @@
35                 command_num = index_in_substr_array(ip_route_commands, *argv);
36         }
37         switch (command_num) {
38 -               case 0: /* add*/
39 +               case 0: /* add */
40                         flags = NLM_F_CREATE|NLM_F_EXCL;
41                         break;
42                 case 1: /* append */
43 @@ -859,21 +861,20 @@
44                         flags = NLM_F_REPLACE;
45                         break;
46                 case 4: /* delete */
47 -               case 5: /* del */
48                         cmd = RTM_DELROUTE;
49                         break;
50 -               case 6: /* get */
51 +               case 5: /* get */
52                         return iproute_get(argc-1, argv+1);
53 -               case 7: /* list */
54 -               case 8: /* show */
55 +               case 6: /* list */
56 +               case 7: /* show */
57                         return iproute_list_or_flush(argc-1, argv+1, 0);
58 -               case 9: /* prepend */
59 +               case 8: /* prepend */
60                         flags = NLM_F_CREATE;
61 -               case 10: /* replace */
62 +               case 9: /* replace */
63                         flags = NLM_F_CREATE|NLM_F_REPLACE;
64 -               case 11: /* test */
65 +               case 10: /* test */
66                         flags = NLM_F_EXCL;
67 -               case 12: /* flush */
68 +               case 11: /* flush */
69                         return iproute_list_or_flush(argc-1, argv+1, 1);
70                 default:
71                         bb_error_msg_and_die("unknown command %s", *argv);