Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/networking/libiproute/iproute.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/networking/libiproute/iproute.c
r2725 r3232 32 32 //int typemask; - unused 33 33 //int tos, tosmask; - unused 34 int iif , iifmask;35 int oif , oifmask;34 int iif; 35 int oif; 36 36 //int realm, realmmask; - unused 37 37 //inet_prefix rprefsrc; - read-only … … 83 83 struct rtmsg *r = NLMSG_DATA(n); 84 84 int len = n->nlmsg_len; 85 struct rtattr * 85 struct rtattr *tb[RTA_MAX+1]; 86 86 char abuf[256]; 87 87 inet_prefix dst; … … 160 160 161 161 memset(tb, 0, sizeof(tb)); 162 memset(&src, 0, sizeof(src)); 163 memset(&dst, 0, sizeof(dst)); 162 164 parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len); 165 166 if (tb[RTA_SRC]) { 167 src.bitlen = r->rtm_src_len; 168 src.bytelen = (r->rtm_family == AF_INET6 ? 16 : 4); 169 memcpy(src.data, RTA_DATA(tb[RTA_SRC]), src.bytelen); 170 } 171 if (tb[RTA_DST]) { 172 dst.bitlen = r->rtm_dst_len; 173 dst.bytelen = (r->rtm_family == AF_INET6 ? 16 : 4); 174 memcpy(dst.data, RTA_DATA(tb[RTA_DST]), dst.bytelen); 175 } 163 176 164 177 if (G_filter.rdst.family … … 183 196 return 0; 184 197 } 185 if (G_filter.flushb 186 && r->rtm_family == AF_INET6 187 && r->rtm_dst_len == 0 188 && r->rtm_type == RTN_UNREACHABLE 189 && tb[RTA_PRIORITY] 190 && *(int*)RTA_DATA(tb[RTA_PRIORITY]) == -1 191 ) { 192 return 0; 198 if (G_filter.oif != 0) { 199 if (!tb[RTA_OIF]) 200 return 0; 201 if (G_filter.oif != *(int*)RTA_DATA(tb[RTA_OIF])) 202 return 0; 193 203 } 194 204 195 205 if (G_filter.flushb) { 196 206 struct nlmsghdr *fn; 207 208 /* We are creating route flush commands */ 209 210 if (r->rtm_family == AF_INET6 211 && r->rtm_dst_len == 0 212 && r->rtm_type == RTN_UNREACHABLE 213 && tb[RTA_PRIORITY] 214 && *(int*)RTA_DATA(tb[RTA_PRIORITY]) == -1 215 ) { 216 return 0; 217 } 218 197 219 if (NLMSG_ALIGN(G_filter.flushp) + n->nlmsg_len > G_filter.flushe) { 198 220 if (flush_update()) 199 221 bb_error_msg_and_die("flush"); 200 222 } 201 fn = ( struct nlmsghdr*)(G_filter.flushb + NLMSG_ALIGN(G_filter.flushp));223 fn = (void*)(G_filter.flushb + NLMSG_ALIGN(G_filter.flushp)); 202 224 memcpy(fn, n, n->nlmsg_len); 203 225 fn->nlmsg_type = RTM_DELROUTE; … … 208 230 return 0; 209 231 } 232 233 /* We are printing routes */ 210 234 211 235 if (n->nlmsg_type == RTM_DELROUTE) { … … 258 282 abuf, sizeof(abuf))); 259 283 } 260 if (tb[RTA_OIF] && G_filter.oifmask != -1) {284 if (tb[RTA_OIF]) { 261 285 printf("dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF]))); 262 286 } 287 288 /* Todo: parse & show "proto kernel", "scope link" here */ 263 289 264 290 if (tb[RTA_PREFSRC] && /*G_filter.rprefsrc.bitlen - always 0*/ 0 != host_len) { … … 293 319 } 294 320 } 295 if (tb[RTA_IIF] && G_filter.iif mask != -1) {321 if (tb[RTA_IIF] && G_filter.iif == 0) { 296 322 printf(" iif %s", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_IIF]))); 297 323 } … … 414 440 } 415 441 if ((**argv < '0' || **argv > '9') 416 && rtnl_rtntype_a2n(&type, *argv) == 0) { 442 && rtnl_rtntype_a2n(&type, *argv) == 0 443 ) { 417 444 NEXT_ARG(); 418 445 req.r.rtm_type = type; … … 663 690 idx = xll_name_to_index(id); 664 691 G_filter.iif = idx; 665 G_filter.iifmask = -1;666 692 } 667 693 if (od) { 668 694 idx = xll_name_to_index(od); 669 695 G_filter.oif = idx; 670 G_filter.oifmask = -1;671 696 } 672 697 }
Note:
See TracChangeset
for help on using the changeset viewer.