[c5c522c] | 1 | diff -Nru iproute2-2.6.29-1.orig/ip/ipaddress.c iproute2-2.6.29-1/ip/ipaddress.c |
---|
| 2 | --- iproute2-2.6.29-1.orig/ip/ipaddress.c 2009-03-24 23:40:54.000000000 +0100 |
---|
| 3 | +++ iproute2-2.6.29-1/ip/ipaddress.c 2009-07-11 09:00:32.000000000 +0200 |
---|
| 4 | @@ -37,6 +37,8 @@ |
---|
| 5 | |
---|
| 6 | #define MAX_ROUNDS 10 |
---|
| 7 | |
---|
| 8 | +static struct rtnl_handle rth_flush = { .fd = -1 }; |
---|
| 9 | + |
---|
| 10 | static struct |
---|
| 11 | { |
---|
| 12 | int ifindex; |
---|
| 13 | @@ -339,7 +341,7 @@ |
---|
| 14 | |
---|
| 15 | static int flush_update(void) |
---|
| 16 | { |
---|
| 17 | - if (rtnl_send_check(&rth, filter.flushb, filter.flushp) < 0) { |
---|
| 18 | + if (rtnl_send_check(&rth_flush, filter.flushb, filter.flushp) < 0) { |
---|
| 19 | perror("Failed to send flush request"); |
---|
| 20 | return -1; |
---|
| 21 | } |
---|
| 22 | @@ -697,6 +699,9 @@ |
---|
| 23 | filter.flushp = 0; |
---|
| 24 | filter.flushe = sizeof(flushb); |
---|
| 25 | |
---|
| 26 | + if (rtnl_open(&rth_flush, 0) < 0) |
---|
| 27 | + return 1; |
---|
| 28 | + |
---|
| 29 | while (round < MAX_ROUNDS) { |
---|
| 30 | if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) { |
---|
| 31 | perror("Cannot send dump request"); |
---|
| 32 | @@ -715,18 +720,20 @@ |
---|
| 33 | printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":""); |
---|
| 34 | } |
---|
| 35 | fflush(stdout); |
---|
| 36 | + rtnl_close(&rth_flush); |
---|
| 37 | return 0; |
---|
| 38 | } |
---|
| 39 | round++; |
---|
| 40 | if (flush_update() < 0) |
---|
| 41 | - return 1; |
---|
| 42 | + break; |
---|
| 43 | |
---|
| 44 | if (show_stats) { |
---|
| 45 | printf("\n*** Round %d, deleting %d addresses ***\n", round, filter.flushed); |
---|
| 46 | fflush(stdout); |
---|
| 47 | } |
---|
| 48 | } |
---|
| 49 | - fprintf(stderr, "*** Flush remains incomplete after %d rounds. ***\n", MAX_ROUNDS); fflush(stderr); |
---|
| 50 | + fprintf(stderr, "*** Flush remains incomplete after %d rounds. ***\n", round); fflush(stderr); |
---|
| 51 | + rtnl_close(&rth_flush); |
---|
| 52 | return 1; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | diff -Nru iproute2-2.6.29-1.orig/ip/ipneigh.c iproute2-2.6.29-1/ip/ipneigh.c |
---|
| 56 | --- iproute2-2.6.29-1.orig/ip/ipneigh.c 2009-03-24 23:40:54.000000000 +0100 |
---|
| 57 | +++ iproute2-2.6.29-1/ip/ipneigh.c 2009-07-11 09:04:32.000000000 +0200 |
---|
| 58 | @@ -32,6 +32,8 @@ |
---|
| 59 | #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) |
---|
| 60 | #define MAX_ROUNDS 10 |
---|
| 61 | |
---|
| 62 | +static struct rtnl_handle rth_flush = { .fd = -1 }; |
---|
| 63 | + |
---|
| 64 | static struct |
---|
| 65 | { |
---|
| 66 | int family; |
---|
| 67 | @@ -87,7 +89,7 @@ |
---|
| 68 | |
---|
| 69 | static int flush_update(void) |
---|
| 70 | { |
---|
| 71 | - if (rtnl_send_check(&rth, filter.flushb, filter.flushp) < 0) { |
---|
| 72 | + if (rtnl_send_check(&rth_flush, filter.flushb, filter.flushp) < 0) { |
---|
| 73 | perror("Failed to send flush request"); |
---|
| 74 | return -1; |
---|
| 75 | } |
---|
| 76 | @@ -391,6 +393,9 @@ |
---|
| 77 | filter.flushe = sizeof(flushb); |
---|
| 78 | filter.state &= ~NUD_FAILED; |
---|
| 79 | |
---|
| 80 | + if (rtnl_open(&rth_flush, 0) < 0) |
---|
| 81 | + return 1; |
---|
| 82 | + |
---|
| 83 | while (round < MAX_ROUNDS) { |
---|
| 84 | if (rtnl_wilddump_request(&rth, filter.family, RTM_GETNEIGH) < 0) { |
---|
| 85 | perror("Cannot send dump request"); |
---|
| 86 | @@ -409,18 +414,20 @@ |
---|
| 87 | printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":""); |
---|
| 88 | } |
---|
| 89 | fflush(stdout); |
---|
| 90 | + rtnl_close(&rth_flush); |
---|
| 91 | return 0; |
---|
| 92 | } |
---|
| 93 | round++; |
---|
| 94 | if (flush_update() < 0) |
---|
| 95 | - exit(1); |
---|
| 96 | + break; |
---|
| 97 | + |
---|
| 98 | if (show_stats) { |
---|
| 99 | printf("\n*** Round %d, deleting %d entries ***\n", round, filter.flushed); |
---|
| 100 | fflush(stdout); |
---|
| 101 | } |
---|
| 102 | } |
---|
| 103 | - printf("*** Flush not complete bailing out after %d rounds\n", |
---|
| 104 | - MAX_ROUNDS); |
---|
| 105 | + fprintf(stderr, "*** Flush remains incomplete after %d rounds. ***\n", round); fflush(stderr); |
---|
| 106 | + rtnl_close(&rth_flush); |
---|
| 107 | return 1; |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | diff -Nru iproute2-2.6.29-1.orig/ip/iproute.c iproute2-2.6.29-1/ip/iproute.c |
---|
| 111 | --- iproute2-2.6.29-1.orig/ip/iproute.c 2009-03-24 23:40:54.000000000 +0100 |
---|
| 112 | +++ iproute2-2.6.29-1/ip/iproute.c 2009-07-11 09:04:45.000000000 +0200 |
---|
| 113 | @@ -37,6 +37,7 @@ |
---|
| 114 | #define RTAX_RTTVAR RTAX_HOPS |
---|
| 115 | #endif |
---|
| 116 | |
---|
| 117 | +static struct rtnl_handle rth_flush = { .fd = -1 }; |
---|
| 118 | |
---|
| 119 | static const char *mx_names[RTAX_MAX+1] = { |
---|
| 120 | [RTAX_MTU] = "mtu", |
---|
| 121 | @@ -112,7 +113,7 @@ |
---|
| 122 | |
---|
| 123 | static int flush_update(void) |
---|
| 124 | { |
---|
| 125 | - if (rtnl_send_check(&rth, filter.flushb, filter.flushp) < 0) { |
---|
| 126 | + if (rtnl_send_check(&rth_flush, filter.flushb, filter.flushp) < 0) { |
---|
| 127 | perror("Failed to send flush request"); |
---|
| 128 | return -1; |
---|
| 129 | } |
---|
| 130 | @@ -1210,6 +1211,9 @@ |
---|
| 131 | filter.flushp = 0; |
---|
| 132 | filter.flushe = sizeof(flushb); |
---|
| 133 | |
---|
| 134 | + if (rtnl_open(&rth_flush, 0) < 0) |
---|
| 135 | + return 1; |
---|
| 136 | + |
---|
| 137 | for (;;) { |
---|
| 138 | if (rtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE) < 0) { |
---|
| 139 | perror("Cannot send dump request"); |
---|
| 140 | @@ -1228,6 +1232,7 @@ |
---|
| 141 | printf("*** Flush is complete after %d round%s ***\n", round, round>1?"s":""); |
---|
| 142 | } |
---|
| 143 | fflush(stdout); |
---|
| 144 | + rtnl_close(&rth_flush); |
---|
| 145 | return 0; |
---|
| 146 | } |
---|
| 147 | round++; |
---|
| 148 | diff -Nru iproute2-2.6.29-1.orig/ip/xfrm_policy.c iproute2-2.6.29-1/ip/xfrm_policy.c |
---|
| 149 | --- iproute2-2.6.29-1.orig/ip/xfrm_policy.c 2009-03-24 23:40:54.000000000 +0100 |
---|
| 150 | +++ iproute2-2.6.29-1/ip/xfrm_policy.c 2009-07-11 08:59:34.000000000 +0200 |
---|
| 151 | @@ -756,11 +756,15 @@ |
---|
| 152 | struct xfrm_buffer xb; |
---|
| 153 | char buf[NLMSG_DELETEALL_BUF_SIZE]; |
---|
| 154 | int i; |
---|
| 155 | + struct rtnl_handle rth2; |
---|
| 156 | |
---|
| 157 | xb.buf = buf; |
---|
| 158 | xb.size = sizeof(buf); |
---|
| 159 | xb.rth = &rth; |
---|
| 160 | |
---|
| 161 | + if (rtnl_open(&rth2, 0) < 0) |
---|
| 162 | + exit(1); |
---|
| 163 | + |
---|
| 164 | for (i = 0; ; i++) { |
---|
| 165 | xb.offset = 0; |
---|
| 166 | xb.nlmsg_count = 0; |
---|
| 167 | @@ -783,7 +787,7 @@ |
---|
| 168 | break; |
---|
| 169 | } |
---|
| 170 | |
---|
| 171 | - if (rtnl_send_check(&rth, xb.buf, xb.offset) < 0) { |
---|
| 172 | + if (rtnl_send_check(&rth2, xb.buf, xb.offset) < 0) { |
---|
| 173 | perror("Failed to send delete-all request"); |
---|
| 174 | exit(1); |
---|
| 175 | } |
---|
| 176 | @@ -793,6 +797,8 @@ |
---|
| 177 | xb.offset = 0; |
---|
| 178 | xb.nlmsg_count = 0; |
---|
| 179 | } |
---|
| 180 | + |
---|
| 181 | + rtnl_close(&rth2); |
---|
| 182 | } else { |
---|
| 183 | if (rtnl_wilddump_request(&rth, preferred_family, XFRM_MSG_GETPOLICY) < 0) { |
---|
| 184 | perror("Cannot send dump request"); |
---|
| 185 | diff -Nru iproute2-2.6.29-1.orig/ip/xfrm_state.c iproute2-2.6.29-1/ip/xfrm_state.c |
---|
| 186 | --- iproute2-2.6.29-1.orig/ip/xfrm_state.c 2009-03-24 23:40:54.000000000 +0100 |
---|
| 187 | +++ iproute2-2.6.29-1/ip/xfrm_state.c 2009-07-11 09:03:37.000000000 +0200 |
---|
| 188 | @@ -924,11 +924,15 @@ |
---|
| 189 | struct xfrm_buffer xb; |
---|
| 190 | char buf[NLMSG_DELETEALL_BUF_SIZE]; |
---|
| 191 | int i; |
---|
| 192 | + struct rtnl_handle rth2; |
---|
| 193 | |
---|
| 194 | xb.buf = buf; |
---|
| 195 | xb.size = sizeof(buf); |
---|
| 196 | xb.rth = &rth; |
---|
| 197 | |
---|
| 198 | + if (rtnl_open(&rth2, 0) < 0) |
---|
| 199 | + exit(1); |
---|
| 200 | + |
---|
| 201 | for (i = 0; ; i++) { |
---|
| 202 | xb.offset = 0; |
---|
| 203 | xb.nlmsg_count = 0; |
---|
| 204 | @@ -951,7 +955,7 @@ |
---|
| 205 | break; |
---|
| 206 | } |
---|
| 207 | |
---|
| 208 | - if (rtnl_send_check(&rth, xb.buf, xb.offset) < 0) { |
---|
| 209 | + if (rtnl_send_check(&rth2, xb.buf, xb.offset) < 0) { |
---|
| 210 | perror("Failed to send delete-all request\n"); |
---|
| 211 | exit(1); |
---|
| 212 | } |
---|
| 213 | @@ -962,6 +966,7 @@ |
---|
| 214 | xb.nlmsg_count = 0; |
---|
| 215 | } |
---|
| 216 | |
---|
| 217 | + rtnl_close(&rth2); |
---|
| 218 | } else { |
---|
| 219 | if (rtnl_wilddump_request(&rth, preferred_family, XFRM_MSG_GETSA) < 0) { |
---|
| 220 | perror("Cannot send dump request"); |
---|