diff options
13 files changed, 171 insertions, 1810 deletions
diff --git a/meta/recipes-extended/net-tools/net-tools/0001-added-ull-prefix-to-unsigned-long-long-constants-to-.patch b/meta/recipes-extended/net-tools/net-tools/0001-added-ull-prefix-to-unsigned-long-long-constants-to-.patch deleted file mode 100644 index 523d434b7c..0000000000 --- a/meta/recipes-extended/net-tools/net-tools/0001-added-ull-prefix-to-unsigned-long-long-constants-to-.patch +++ /dev/null | |||
| @@ -1,381 +0,0 @@ | |||
| 1 | From eb04ef31571f6c707eacaba6846feeebfab518e6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Bernd Eckenfels <net-tools@lina.inka.de> | ||
| 3 | Date: Thu, 29 May 2003 02:09:14 +0000 | ||
| 4 | Subject: [PATCH] added 'ull' prefix to unsigned long long constants to make | ||
| 5 | gcc 3.3 happy | ||
| 6 | |||
| 7 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 8 | Upstream-Status: Backport [https://sourceforge.net/p/net-tools/code/ci/eb04ef31571f6c707eacaba6846feeebfab518e6] | ||
| 9 | --- | ||
| 10 | lib/interface.c | 299 ++++++++++++++++++++++++++---------------------- | ||
| 11 | 1 file changed, 161 insertions(+), 138 deletions(-) | ||
| 12 | |||
| 13 | diff -uNr net-tools-1.60.orig/lib/interface.c net-tools-1.60/lib/interface.c | ||
| 14 | --- net-tools-1.60.orig/lib/interface.c 2020-06-16 10:04:16.308411879 +0000 | ||
| 15 | +++ net-tools-1.60/lib/interface.c 2020-06-16 10:05:15.697264291 +0000 | ||
| 16 | @@ -23,7 +23,6 @@ | ||
| 17 | #include <string.h> | ||
| 18 | #include <unistd.h> | ||
| 19 | #include <ctype.h> | ||
| 20 | -#include <string.h> | ||
| 21 | |||
| 22 | #if HAVE_AFIPX | ||
| 23 | #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) | ||
| 24 | @@ -654,6 +653,8 @@ | ||
| 25 | const char *Rext = "B"; | ||
| 26 | const char *Text = "B"; | ||
| 27 | |||
| 28 | + static char flags[200]; | ||
| 29 | + | ||
| 30 | #if HAVE_AFIPX | ||
| 31 | static struct aftype *ipxtype = NULL; | ||
| 32 | #endif | ||
| 33 | @@ -685,32 +686,68 @@ | ||
| 34 | if (hw == NULL) | ||
| 35 | hw = get_hwntype(-1); | ||
| 36 | |||
| 37 | - printf(_("%-9s Link encap:%s "), ptr->name, hw->title); | ||
| 38 | - /* For some hardware types (eg Ash, ATM) we don't print the | ||
| 39 | - hardware address if it's null. */ | ||
| 40 | - if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) && | ||
| 41 | - hw->suppress_null_addr))) | ||
| 42 | - printf(_("HWaddr %s "), hw->print(ptr->hwaddr)); | ||
| 43 | -#ifdef IFF_PORTSEL | ||
| 44 | - if (ptr->flags & IFF_PORTSEL) { | ||
| 45 | - printf(_("Media:%s"), if_port_text[ptr->map.port][0]); | ||
| 46 | - if (ptr->flags & IFF_AUTOMEDIA) | ||
| 47 | - printf(_("(auto)")); | ||
| 48 | - } | ||
| 49 | + sprintf(flags, "flags=%d<", ptr->flags); | ||
| 50 | + /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */ | ||
| 51 | + if (ptr->flags == 0) | ||
| 52 | + strcat(flags,">"); | ||
| 53 | + if (ptr->flags & IFF_UP) | ||
| 54 | + strcat(flags,_("UP,")); | ||
| 55 | + if (ptr->flags & IFF_BROADCAST) | ||
| 56 | + strcat(flags,_("BROADCAST,")); | ||
| 57 | + if (ptr->flags & IFF_DEBUG) | ||
| 58 | + strcat(flags,_("DEBUG,")); | ||
| 59 | + if (ptr->flags & IFF_LOOPBACK) | ||
| 60 | + strcat(flags,_("LOOPBACK,")); | ||
| 61 | + if (ptr->flags & IFF_POINTOPOINT) | ||
| 62 | + strcat(flags,_("POINTOPOINT,")); | ||
| 63 | + if (ptr->flags & IFF_NOTRAILERS) | ||
| 64 | + strcat(flags,_("NOTRAILERS,")); | ||
| 65 | + if (ptr->flags & IFF_RUNNING) | ||
| 66 | + strcat(flags,_("RUNNING,")); | ||
| 67 | + if (ptr->flags & IFF_NOARP) | ||
| 68 | + strcat(flags,_("NOARP,")); | ||
| 69 | + if (ptr->flags & IFF_PROMISC) | ||
| 70 | + strcat(flags,_("PROMISC,")); | ||
| 71 | + if (ptr->flags & IFF_ALLMULTI) | ||
| 72 | + strcat(flags,_("ALLMULTI,")); | ||
| 73 | + if (ptr->flags & IFF_SLAVE) | ||
| 74 | + strcat(flags,_("SLAVE,")); | ||
| 75 | + if (ptr->flags & IFF_MASTER) | ||
| 76 | + strcat(flags,_("MASTER,")); | ||
| 77 | + if (ptr->flags & IFF_MULTICAST) | ||
| 78 | + strcat(flags,_("MULTICAST,")); | ||
| 79 | +#ifdef HAVE_DYNAMIC | ||
| 80 | + if (ptr->flags & IFF_DYNAMIC) | ||
| 81 | + strcat(flags,_("DYNAMIC,")); | ||
| 82 | +#endif | ||
| 83 | + /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */ | ||
| 84 | + if (flags[strlen(flags)-1] == ',') | ||
| 85 | + flags[strlen(flags)-1] = '>'; | ||
| 86 | + else | ||
| 87 | + flags[strlen(flags)-1] = 0; | ||
| 88 | + | ||
| 89 | + | ||
| 90 | + printf(_("%s: %s mtu %d metric %d"), | ||
| 91 | + ptr->name, flags, ptr->mtu, ptr->metric ? ptr->metric : 1); | ||
| 92 | +#ifdef SIOCSKEEPALIVE | ||
| 93 | + if (ptr->outfill || ptr->keepalive) | ||
| 94 | + printf(_(" outfill %d keepalive %d"), | ||
| 95 | + ptr->outfill, ptr->keepalive); | ||
| 96 | #endif | ||
| 97 | printf("\n"); | ||
| 98 | |||
| 99 | #if HAVE_AFINET | ||
| 100 | if (ptr->has_ip) { | ||
| 101 | - printf(_(" %s addr:%s "), ap->name, | ||
| 102 | + printf(_(" %s %s"), ap->name, | ||
| 103 | ap->sprint(&ptr->addr, 1)); | ||
| 104 | - if (ptr->flags & IFF_POINTOPOINT) { | ||
| 105 | - printf(_(" P-t-P:%s "), ap->sprint(&ptr->dstaddr, 1)); | ||
| 106 | - } | ||
| 107 | + printf(_(" netmask %s"), ap->sprint(&ptr->netmask, 1)); | ||
| 108 | if (ptr->flags & IFF_BROADCAST) { | ||
| 109 | - printf(_(" Bcast:%s "), ap->sprint(&ptr->broadaddr, 1)); | ||
| 110 | + printf(_(" broadcast %s"), ap->sprint(&ptr->broadaddr, 1)); | ||
| 111 | } | ||
| 112 | - printf(_(" Mask:%s\n"), ap->sprint(&ptr->netmask, 1)); | ||
| 113 | + if (ptr->flags & IFF_POINTOPOINT) { | ||
| 114 | + printf(_(" destination %s"), ap->sprint(&ptr->dstaddr, 1)); | ||
| 115 | + } | ||
| 116 | + printf("\n"); | ||
| 117 | } | ||
| 118 | #endif | ||
| 119 | |||
| 120 | @@ -727,29 +764,30 @@ | ||
| 121 | addr6p[0], addr6p[1], addr6p[2], addr6p[3], | ||
| 122 | addr6p[4], addr6p[5], addr6p[6], addr6p[7]); | ||
| 123 | inet6_aftype.input(1, addr6, (struct sockaddr *) &sap); | ||
| 124 | - printf(_(" inet6 addr: %s/%d"), | ||
| 125 | - inet6_aftype.sprint((struct sockaddr *) &sap, 1), plen); | ||
| 126 | - printf(_(" Scope:")); | ||
| 127 | - switch (scope) { | ||
| 128 | - case 0: | ||
| 129 | - printf(_("Global")); | ||
| 130 | - break; | ||
| 131 | - case IPV6_ADDR_LINKLOCAL: | ||
| 132 | - printf(_("Link")); | ||
| 133 | - break; | ||
| 134 | - case IPV6_ADDR_SITELOCAL: | ||
| 135 | - printf(_("Site")); | ||
| 136 | - break; | ||
| 137 | - case IPV6_ADDR_COMPATv4: | ||
| 138 | - printf(_("Compat")); | ||
| 139 | - break; | ||
| 140 | - case IPV6_ADDR_LOOPBACK: | ||
| 141 | - printf(_("Host")); | ||
| 142 | - break; | ||
| 143 | - default: | ||
| 144 | - printf(_("Unknown")); | ||
| 145 | + printf(_(" %s %s prefixlen %d"), | ||
| 146 | + inet6_aftype.name, | ||
| 147 | + inet6_aftype.sprint((struct sockaddr *) &sap, 1), | ||
| 148 | + plen); | ||
| 149 | + printf(_(" scopeid 0x%x"), scope); | ||
| 150 | + | ||
| 151 | + flags[0] = '<'; flags[1] = 0; | ||
| 152 | + if (scope & IPV6_ADDR_COMPATv4) { | ||
| 153 | + strcat(flags, _("compat,")); | ||
| 154 | + scope -= IPV6_ADDR_COMPATv4; | ||
| 155 | } | ||
| 156 | - printf("\n"); | ||
| 157 | + if (scope == 0) | ||
| 158 | + strcat(flags, _("global,")); | ||
| 159 | + if (scope & IPV6_ADDR_LINKLOCAL) | ||
| 160 | + strcat(flags, _("link,")); | ||
| 161 | + if (scope & IPV6_ADDR_SITELOCAL) | ||
| 162 | + strcat(flags, _("site,")); | ||
| 163 | + if (scope & IPV6_ADDR_LOOPBACK) | ||
| 164 | + strcat(flags, _("host,")); | ||
| 165 | + if (flags[strlen(flags)-1] == ',') | ||
| 166 | + flags[strlen(flags)-1] = '>'; | ||
| 167 | + else | ||
| 168 | + flags[strlen(flags)-1] = 0; | ||
| 169 | + printf("%s\n", flags); | ||
| 170 | } | ||
| 171 | } | ||
| 172 | fclose(f); | ||
| 173 | @@ -762,17 +800,17 @@ | ||
| 174 | |||
| 175 | if (ipxtype != NULL) { | ||
| 176 | if (ptr->has_ipx_bb) | ||
| 177 | - printf(_(" IPX/Ethernet II addr:%s\n"), | ||
| 178 | - ipxtype->sprint(&ptr->ipxaddr_bb, 1)); | ||
| 179 | + printf(_(" %s Ethernet-II %s\n"), | ||
| 180 | + ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_bb, 1)); | ||
| 181 | if (ptr->has_ipx_sn) | ||
| 182 | - printf(_(" IPX/Ethernet SNAP addr:%s\n"), | ||
| 183 | - ipxtype->sprint(&ptr->ipxaddr_sn, 1)); | ||
| 184 | + printf(_(" %s Ethernet-SNAP %s\n"), | ||
| 185 | + ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_sn, 1)); | ||
| 186 | if (ptr->has_ipx_e2) | ||
| 187 | - printf(_(" IPX/Ethernet 802.2 addr:%s\n"), | ||
| 188 | - ipxtype->sprint(&ptr->ipxaddr_e2, 1)); | ||
| 189 | + printf(_(" %s Ethernet802.2 %s\n"), | ||
| 190 | + ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e2, 1)); | ||
| 191 | if (ptr->has_ipx_e3) | ||
| 192 | - printf(_(" IPX/Ethernet 802.3 addr:%s\n"), | ||
| 193 | - ipxtype->sprint(&ptr->ipxaddr_e3, 1)); | ||
| 194 | + printf(_(" %s Ethernet802.3 %s\n"), | ||
| 195 | + ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e3, 1)); | ||
| 196 | } | ||
| 197 | #endif | ||
| 198 | |||
| 199 | @@ -781,7 +819,7 @@ | ||
| 200 | ddptype = get_afntype(AF_APPLETALK); | ||
| 201 | if (ddptype != NULL) { | ||
| 202 | if (ptr->has_ddp) | ||
| 203 | - printf(_(" EtherTalk Phase 2 addr:%s\n"), ddptype->sprint(&ptr->ddpaddr, 1)); | ||
| 204 | + printf(_(" %s %s\n"), ddptype->name, ddptype->sprint(&ptr->ddpaddr, 1)); | ||
| 205 | } | ||
| 206 | #endif | ||
| 207 | |||
| 208 | @@ -790,53 +828,30 @@ | ||
| 209 | ectype = get_afntype(AF_ECONET); | ||
| 210 | if (ectype != NULL) { | ||
| 211 | if (ptr->has_econet) | ||
| 212 | - printf(_(" econet addr:%s\n"), ectype->sprint(&ptr->ecaddr, 1)); | ||
| 213 | + printf(_(" %s %s\n"), ectype->name, ectype->sprint(&ptr->ecaddr, 1)); | ||
| 214 | } | ||
| 215 | #endif | ||
| 216 | |||
| 217 | - printf(" "); | ||
| 218 | - /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */ | ||
| 219 | - if (ptr->flags == 0) | ||
| 220 | - printf(_("[NO FLAGS] ")); | ||
| 221 | - if (ptr->flags & IFF_UP) | ||
| 222 | - printf(_("UP ")); | ||
| 223 | - if (ptr->flags & IFF_BROADCAST) | ||
| 224 | - printf(_("BROADCAST ")); | ||
| 225 | - if (ptr->flags & IFF_DEBUG) | ||
| 226 | - printf(_("DEBUG ")); | ||
| 227 | - if (ptr->flags & IFF_LOOPBACK) | ||
| 228 | - printf(_("LOOPBACK ")); | ||
| 229 | - if (ptr->flags & IFF_POINTOPOINT) | ||
| 230 | - printf(_("POINTOPOINT ")); | ||
| 231 | - if (ptr->flags & IFF_NOTRAILERS) | ||
| 232 | - printf(_("NOTRAILERS ")); | ||
| 233 | - if (ptr->flags & IFF_RUNNING) | ||
| 234 | - printf(_("RUNNING ")); | ||
| 235 | - if (ptr->flags & IFF_NOARP) | ||
| 236 | - printf(_("NOARP ")); | ||
| 237 | - if (ptr->flags & IFF_PROMISC) | ||
| 238 | - printf(_("PROMISC ")); | ||
| 239 | - if (ptr->flags & IFF_ALLMULTI) | ||
| 240 | - printf(_("ALLMULTI ")); | ||
| 241 | - if (ptr->flags & IFF_SLAVE) | ||
| 242 | - printf(_("SLAVE ")); | ||
| 243 | - if (ptr->flags & IFF_MASTER) | ||
| 244 | - printf(_("MASTER ")); | ||
| 245 | - if (ptr->flags & IFF_MULTICAST) | ||
| 246 | - printf(_("MULTICAST ")); | ||
| 247 | -#ifdef HAVE_DYNAMIC | ||
| 248 | - if (ptr->flags & IFF_DYNAMIC) | ||
| 249 | - printf(_("DYNAMIC ")); | ||
| 250 | -#endif | ||
| 251 | - /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */ | ||
| 252 | - printf(_(" MTU:%d Metric:%d"), | ||
| 253 | - ptr->mtu, ptr->metric ? ptr->metric : 1); | ||
| 254 | -#ifdef SIOCSKEEPALIVE | ||
| 255 | - if (ptr->outfill || ptr->keepalive) | ||
| 256 | - printf(_(" Outfill:%d Keepalive:%d"), | ||
| 257 | - ptr->outfill, ptr->keepalive); | ||
| 258 | + /* For some hardware types (eg Ash, ATM) we don't print the | ||
| 259 | + hardware address if it's null. */ | ||
| 260 | + if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) && | ||
| 261 | + hw->suppress_null_addr))) | ||
| 262 | + printf(_(" %s %s"), hw->name, hw->print(ptr->hwaddr)); | ||
| 263 | + else | ||
| 264 | + printf(_(" %s"), hw->name); | ||
| 265 | + if (ptr->tx_queue_len != -1) | ||
| 266 | + printf(_(" txqueuelen %d"), ptr->tx_queue_len); | ||
| 267 | + printf(" (%s)\n", hw->title); | ||
| 268 | + | ||
| 269 | +#ifdef IFF_PORTSEL | ||
| 270 | + if (ptr->flags & IFF_PORTSEL) { | ||
| 271 | + printf(_(" media %s"), if_port_text[ptr->map.port][0]); | ||
| 272 | + if (ptr->flags & IFF_AUTOMEDIA) | ||
| 273 | + printf(_("autoselect")); | ||
| 274 | + printf("\n"); | ||
| 275 | + } | ||
| 276 | #endif | ||
| 277 | - printf("\n"); | ||
| 278 | + | ||
| 279 | |||
| 280 | /* If needed, display the interface statistics. */ | ||
| 281 | |||
| 282 | @@ -845,19 +860,9 @@ | ||
| 283 | * not for the aliases, although strictly speaking they're shared | ||
| 284 | * by all addresses. | ||
| 285 | */ | ||
| 286 | - printf(" "); | ||
| 287 | - | ||
| 288 | - printf(_("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"), | ||
| 289 | - ptr->stats.rx_packets, ptr->stats.rx_errors, | ||
| 290 | - ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors, | ||
| 291 | - ptr->stats.rx_frame_errors); | ||
| 292 | - if (can_compress) | ||
| 293 | - printf(_(" compressed:%lu\n"), ptr->stats.rx_compressed); | ||
| 294 | |||
| 295 | rx = ptr->stats.rx_bytes; | ||
| 296 | - tx = ptr->stats.tx_bytes; | ||
| 297 | short_rx = rx * 10; | ||
| 298 | - short_tx = tx * 10; | ||
| 299 | if (rx > 1125899906842624ull) { | ||
| 300 | short_rx /= 1125899906842624ull; | ||
| 301 | Rext = "PiB"; | ||
| 302 | @@ -874,6 +879,8 @@ | ||
| 303 | short_rx /= 1024; | ||
| 304 | Rext = "KiB"; | ||
| 305 | } | ||
| 306 | + tx = ptr->stats.tx_bytes; | ||
| 307 | + short_tx = tx * 10; | ||
| 308 | if (tx > 1125899906842624ull) { | ||
| 309 | short_tx /= 1125899906842624ull; | ||
| 310 | Text = "PiB"; | ||
| 311 | @@ -891,37 +898,50 @@ | ||
| 312 | Text = "KiB"; | ||
| 313 | } | ||
| 314 | |||
| 315 | - printf(" "); | ||
| 316 | - printf(_("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"), | ||
| 317 | - ptr->stats.tx_packets, ptr->stats.tx_errors, | ||
| 318 | - ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors, | ||
| 319 | - ptr->stats.tx_carrier_errors); | ||
| 320 | - printf(_(" collisions:%lu "), ptr->stats.collisions); | ||
| 321 | - if (can_compress) | ||
| 322 | - printf(_("compressed:%lu "), ptr->stats.tx_compressed); | ||
| 323 | - if (ptr->tx_queue_len != -1) | ||
| 324 | - printf(_("txqueuelen:%d "), ptr->tx_queue_len); | ||
| 325 | - printf("\n "); | ||
| 326 | - printf(_("RX bytes:%llu (%lu.%lu %s) TX bytes:%llu (%lu.%lu %s)\n"), | ||
| 327 | + printf(" "); | ||
| 328 | + printf(_("RX packets %llu bytes %llu (%lu.%lu %s)\n"), | ||
| 329 | + ptr->stats.rx_packets, | ||
| 330 | rx, (unsigned long)(short_rx / 10), | ||
| 331 | - (unsigned long)(short_rx % 10), Rext, | ||
| 332 | - tx, (unsigned long)(short_tx / 10), | ||
| 333 | - (unsigned long)(short_tx % 10), Text); | ||
| 334 | + (unsigned long)(short_rx % 10), Rext); | ||
| 335 | + if (can_compress) { | ||
| 336 | + printf(" "); | ||
| 337 | + printf(_("RX compressed:%lu\n"), ptr->stats.rx_compressed); | ||
| 338 | + } | ||
| 339 | + printf(" "); | ||
| 340 | + printf(_("RX errors %lu dropped %lu overruns %lu frame %lu\n"), | ||
| 341 | + ptr->stats.rx_errors, ptr->stats.rx_dropped, | ||
| 342 | + ptr->stats.rx_fifo_errors, ptr->stats.rx_frame_errors); | ||
| 343 | + | ||
| 344 | + | ||
| 345 | + printf(" "); | ||
| 346 | + printf(_("TX packets %llu bytes %llu (%lu.%lu %s)\n"), | ||
| 347 | + ptr->stats.tx_packets, | ||
| 348 | + tx, (unsigned long)(short_tx / 10), | ||
| 349 | + (unsigned long)(short_tx % 10), Text); | ||
| 350 | + if (can_compress) { | ||
| 351 | + printf(" "); | ||
| 352 | + printf(_("TX compressed %lu\n"), ptr->stats.tx_compressed); | ||
| 353 | + } | ||
| 354 | + printf(" "); | ||
| 355 | + printf(_("TX errors %lu dropped %lu overruns %lu carrier %lu collisions %lu\n"), | ||
| 356 | + ptr->stats.tx_errors, | ||
| 357 | + ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors, | ||
| 358 | + ptr->stats.tx_carrier_errors, ptr->stats.collisions); | ||
| 359 | } | ||
| 360 | |||
| 361 | if ((ptr->map.irq || ptr->map.mem_start || ptr->map.dma || | ||
| 362 | ptr->map.base_addr >= 0x100)) { | ||
| 363 | - printf(" "); | ||
| 364 | + printf(" device "); | ||
| 365 | if (ptr->map.irq) | ||
| 366 | - printf(_("Interrupt:%d "), ptr->map.irq); | ||
| 367 | + printf(_("interrupt %d "), ptr->map.irq); | ||
| 368 | if (ptr->map.base_addr >= 0x100) /* Only print devices using it for | ||
| 369 | I/O maps */ | ||
| 370 | - printf(_("Base address:0x%x "), ptr->map.base_addr); | ||
| 371 | + printf(_("base 0x%x "), ptr->map.base_addr); | ||
| 372 | if (ptr->map.mem_start) { | ||
| 373 | - printf(_("Memory:%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end); | ||
| 374 | + printf(_("memory 0x%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end); | ||
| 375 | } | ||
| 376 | if (ptr->map.dma) | ||
| 377 | - printf(_("DMA chan:%x "), ptr->map.dma); | ||
| 378 | + printf(_(" dma 0x%x"), ptr->map.dma); | ||
| 379 | printf("\n"); | ||
| 380 | } | ||
| 381 | printf("\n"); | ||
diff --git a/meta/recipes-extended/net-tools/net-tools/0001-lib-inet6.c-INET6_rresolve-various-fixes.patch b/meta/recipes-extended/net-tools/net-tools/0001-lib-inet6.c-INET6_rresolve-various-fixes.patch deleted file mode 100644 index 8be45ccac9..0000000000 --- a/meta/recipes-extended/net-tools/net-tools/0001-lib-inet6.c-INET6_rresolve-various-fixes.patch +++ /dev/null | |||
| @@ -1,87 +0,0 @@ | |||
| 1 | From 08abfcd923e9f37d1902db26771b1dc6731eb265 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jiri Popelka <jpopelka@redhat.com> | ||
| 3 | Date: Fri, 27 Sep 2013 18:40:06 +0200 | ||
| 4 | Subject: [PATCH 1/1] lib/inet6.c:INET6_rresolve() - various fixes | ||
| 5 | |||
| 6 | 1) Fall-back to numeric address if getnameinfo fails. | ||
| 7 | Reverse lookup is not mandatory, therefore its fail | ||
| 8 | is not an error. Just return numeric address in that case. | ||
| 9 | This makes netstat/route show IPv6 address instead of | ||
| 10 | [UNKNOWN] in case of DNS problems. | ||
| 11 | |||
| 12 | 2) Pass length of 'name' buffer into function. | ||
| 13 | 'name' is a pointer and therefore sizeof(name) | ||
| 14 | returns size of pointer and not size of the buffer. | ||
| 15 | see http://stackoverflow.com/questions/14298710/c-pointers-and-arrays-sizeof-operator | ||
| 16 | The sizeof() usage was added with commit 604785adc, | ||
| 17 | so I checked all the other changes in that commit | ||
| 18 | and they seem to be OK. | ||
| 19 | |||
| 20 | 3) remove unused 's' variable | ||
| 21 | |||
| 22 | Upstream-Status: Pending | ||
| 23 | |||
| 24 | Signed-off-by: Shan Hai <shan.hai@windriver.com> | ||
| 25 | Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com> | ||
| 26 | --- | ||
| 27 | lib/inet6.c | 21 ++++++++++----------- | ||
| 28 | 1 file changed, 10 insertions(+), 11 deletions(-) | ||
| 29 | |||
| 30 | diff --git a/lib/inet6.c b/lib/inet6.c | ||
| 31 | index 9a484a0..2a9c459 100644 | ||
| 32 | --- a/lib/inet6.c | ||
| 33 | +++ b/lib/inet6.c | ||
| 34 | @@ -84,10 +84,9 @@ static int INET6_resolve(char *name, struct sockaddr_in6 *sin6) | ||
| 35 | #endif | ||
| 36 | |||
| 37 | |||
| 38 | -static int INET6_rresolve(char *name, struct sockaddr_in6 *sin6, int numeric) | ||
| 39 | +static int INET6_rresolve(char *name, size_t namelen, | ||
| 40 | + struct sockaddr_in6 *sin6, int numeric) | ||
| 41 | { | ||
| 42 | - int s; | ||
| 43 | - | ||
| 44 | /* Grmpf. -FvK */ | ||
| 45 | if (sin6->sin6_family != AF_INET6) { | ||
| 46 | #ifdef DEBUG | ||
| 47 | @@ -98,21 +97,20 @@ static int INET6_rresolve(char *name, struct sockaddr_in6 *sin6, int numeric) | ||
| 48 | return (-1); | ||
| 49 | } | ||
| 50 | if (numeric & 0x7FFF) { | ||
| 51 | - inet_ntop( AF_INET6, &sin6->sin6_addr, name, 80); | ||
| 52 | + inet_ntop( AF_INET6, &sin6->sin6_addr, name, namelen); | ||
| 53 | return (0); | ||
| 54 | } | ||
| 55 | if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { | ||
| 56 | if (numeric & 0x8000) | ||
| 57 | - strcpy(name, "default"); | ||
| 58 | + safe_strncpy(name, "default", namelen); | ||
| 59 | else | ||
| 60 | - strcpy(name, "[::]"); | ||
| 61 | + safe_strncpy(name, "[::]", namelen); | ||
| 62 | return (0); | ||
| 63 | } | ||
| 64 | |||
| 65 | - if ((s = getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6), | ||
| 66 | - name, 255 /* !! */ , NULL, 0, 0))) { | ||
| 67 | - fputs("getnameinfo failed\n", stderr); | ||
| 68 | - return -1; | ||
| 69 | + if (getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6), | ||
| 70 | + name, namelen , NULL, 0, 0)) { | ||
| 71 | + inet_ntop( AF_INET6, &sin6->sin6_addr, name, namelen); | ||
| 72 | } | ||
| 73 | return (0); | ||
| 74 | } | ||
| 75 | @@ -143,7 +141,8 @@ static char *INET6_sprint(struct sockaddr *sap, int numeric) | ||
| 76 | |||
| 77 | if (sap->sa_family == 0xFFFF || sap->sa_family == 0) | ||
| 78 | return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff)); | ||
| 79 | - if (INET6_rresolve(buff, (struct sockaddr_in6 *) sap, numeric) != 0) | ||
| 80 | + if (INET6_rresolve(buff, sizeof(buff), | ||
| 81 | + (struct sockaddr_in6 *) sap, numeric) != 0) | ||
| 82 | return safe_strncpy(buff, _("[UNKNOWN]"), sizeof(buff)); | ||
| 83 | return (fix_v4_address(buff, &((struct sockaddr_in6 *)sap)->sin6_addr)); | ||
| 84 | } | ||
| 85 | -- | ||
| 86 | 1.8.5.2.233.g932f7e4 | ||
| 87 | |||
diff --git a/meta/recipes-extended/net-tools/net-tools/Add_missing_headers.patch b/meta/recipes-extended/net-tools/net-tools/Add_missing_headers.patch new file mode 100644 index 0000000000..f15d3654c7 --- /dev/null +++ b/meta/recipes-extended/net-tools/net-tools/Add_missing_headers.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | Description: Add missing headers | ||
| 2 | |||
| 3 | Upstream-Status: Pending | ||
| 4 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 5 | |||
| 6 | --- a/netstat.c | ||
| 7 | +++ b/netstat.c | ||
| 8 | @@ -88,6 +88,7 @@ | ||
| 9 | #include <sys/stat.h> | ||
| 10 | #include <net/if.h> | ||
| 11 | #include <dirent.h> | ||
| 12 | +#include <sys/types.h> | ||
| 13 | |||
| 14 | #include "net-support.h" | ||
| 15 | #include "pathnames.h" | ||
diff --git a/meta/recipes-extended/net-tools/net-tools/Bug_443075-ifconfig.c-pointtopoint_spelling.patch b/meta/recipes-extended/net-tools/net-tools/Bug_443075-ifconfig.c-pointtopoint_spelling.patch new file mode 100644 index 0000000000..74d74668ce --- /dev/null +++ b/meta/recipes-extended/net-tools/net-tools/Bug_443075-ifconfig.c-pointtopoint_spelling.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | Description: Accept "pointtopoint" as a synonym for "pointopoint" | ||
| 2 | Bug-Debian: https://bugs.debian.org/443075 | ||
| 3 | Author: Justin Pryzby <pryzbyj@libra> | ||
| 4 | |||
| 5 | Upstream-Status: Pending | ||
| 6 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 7 | |||
| 8 | --- a/ifconfig.c | ||
| 9 | +++ b/ifconfig.c | ||
| 10 | @@ -644,14 +644,14 @@ | ||
| 11 | spp++; | ||
| 12 | continue; | ||
| 13 | } | ||
| 14 | - if (!strcmp(*spp, "-pointopoint")) { | ||
| 15 | + if (!strcmp(*spp, "-pointopoint") || !strcmp(*spp, "-pointtopoint")) { | ||
| 16 | goterr |= clr_flag(ifr.ifr_name, IFF_POINTOPOINT); | ||
| 17 | spp++; | ||
| 18 | if (test_flag(ifr.ifr_name, IFF_POINTOPOINT) > 0) | ||
| 19 | fprintf(stderr, _("Warning: Interface %s still in POINTOPOINT mode.\n"), ifr.ifr_name); | ||
| 20 | continue; | ||
| 21 | } | ||
| 22 | - if (!strcmp(*spp, "pointopoint")) { | ||
| 23 | + if (!strcmp(*spp, "pointopoint") || !strcmp(*spp, "pointtopoint")) { | ||
| 24 | if (*(spp + 1) != NULL) { | ||
| 25 | spp++; | ||
| 26 | safe_strncpy(host, *spp, (sizeof host)); | ||
diff --git a/meta/recipes-extended/net-tools/net-tools/Bug_541172-netstat.c-exit-codes.patch b/meta/recipes-extended/net-tools/net-tools/Bug_541172-netstat.c-exit-codes.patch new file mode 100644 index 0000000000..782b94bc61 --- /dev/null +++ b/meta/recipes-extended/net-tools/net-tools/Bug_541172-netstat.c-exit-codes.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | Description: Bug#541172: netstat.c exit codes | ||
| 2 | |||
| 3 | Upstream-Status: Pending | ||
| 4 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 5 | |||
| 6 | --- a/netstat.c | ||
| 7 | +++ b/netstat.c | ||
| 8 | @@ -2237,12 +2237,14 @@ | ||
| 9 | parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp); | ||
| 10 | #else | ||
| 11 | ENOSUPP("netstat", "AF INET"); | ||
| 12 | + exit(1); | ||
| 13 | #endif | ||
| 14 | } else if(!strcmp(afname, "inet6")) { | ||
| 15 | #if HAVE_AFINET6 | ||
| 16 | parsesnmp6(flag_raw, flag_tcp, flag_udp); | ||
| 17 | #else | ||
| 18 | ENOSUPP("netstat", "AF INET6"); | ||
| 19 | + exit(1); | ||
| 20 | #endif | ||
| 21 | } else { | ||
| 22 | printf(_("netstat: No statistics support for specified address family: %s\n"), afname); | ||
diff --git a/meta/recipes-extended/net-tools/net-tools/ifconfig-interface-0-del-IP-will-remove-the-aliased-.patch b/meta/recipes-extended/net-tools/net-tools/ifconfig-interface-0-del-IP-will-remove-the-aliased-.patch deleted file mode 100644 index 06f81420e9..0000000000 --- a/meta/recipes-extended/net-tools/net-tools/ifconfig-interface-0-del-IP-will-remove-the-aliased-.patch +++ /dev/null | |||
| @@ -1,32 +0,0 @@ | |||
| 1 | From 81814dc2b14843009193efd307d814c26baa61f0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jiri Popelka <jpopelka@redhat.com> | ||
| 3 | Date: Wed, 7 Dec 2011 19:14:09 +0100 | ||
| 4 | Subject: [PATCH] ifconfig interface:0 del <IP> will remove the aliased IP on IA64 | ||
| 5 | |||
| 6 | Upstream-Status: Backport | ||
| 7 | |||
| 8 | commit 81814dc2b14843009193efd307d814c26baa61f0 from | ||
| 9 | git://git.code.sf.net/p/net-tools/code | ||
| 10 | |||
| 11 | --- | ||
| 12 | ifconfig.c | 4 +++- | ||
| 13 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
| 14 | |||
| 15 | diff --git a/ifconfig.c b/ifconfig.c | ||
| 16 | index bc405c6..dae8922 100644 | ||
| 17 | --- a/ifconfig.c | ||
| 18 | +++ b/ifconfig.c | ||
| 19 | @@ -890,7 +890,9 @@ int main(int argc, char **argv) | ||
| 20 | continue; | ||
| 21 | } | ||
| 22 | |||
| 23 | - memcpy(&ip, &sin.sin_addr.s_addr, sizeof(unsigned long)); | ||
| 24 | + /* Clear "ip" in case sizeof(unsigned long) > sizeof(sin.sin_addr.s_addr) */ | ||
| 25 | + ip = 0; | ||
| 26 | + memcpy(&ip, &sin.sin_addr.s_addr, sizeof(sin.sin_addr.s_addr)); | ||
| 27 | |||
| 28 | if (get_nmbc_parent(ifr.ifr_name, &nm, &bc) < 0) { | ||
| 29 | fprintf(stderr, _("Interface %s not initialized\n"), | ||
| 30 | -- | ||
| 31 | 1.7.9.5 | ||
| 32 | |||
diff --git a/meta/recipes-extended/net-tools/net-tools/musl-fixes.patch b/meta/recipes-extended/net-tools/net-tools/musl-fixes.patch deleted file mode 100644 index f694d594bf..0000000000 --- a/meta/recipes-extended/net-tools/net-tools/musl-fixes.patch +++ /dev/null | |||
| @@ -1,100 +0,0 @@ | |||
| 1 | Adjust headers for non-glibc cases | ||
| 2 | especially exposed by musl | ||
| 3 | |||
| 4 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 5 | Upstream-Status: Pending | ||
| 6 | |||
| 7 | Index: net-tools-1.60/lib/inet6_gr.c | ||
| 8 | =================================================================== | ||
| 9 | --- net-tools-1.60.orig/lib/inet6_gr.c | ||
| 10 | +++ net-tools-1.60/lib/inet6_gr.c | ||
| 11 | @@ -23,7 +23,7 @@ | ||
| 12 | #include <string.h> | ||
| 13 | #include <stdio.h> | ||
| 14 | #include <unistd.h> | ||
| 15 | -#ifndef __GLIBC__ | ||
| 16 | +#ifdef HAVE_IPV6_ROUTE_H | ||
| 17 | #include <netinet6/ipv6_route.h> /* glibc doesn't have this */ | ||
| 18 | #endif | ||
| 19 | #include "version.h" | ||
| 20 | Index: net-tools-1.60/lib/inet6_sr.c | ||
| 21 | =================================================================== | ||
| 22 | --- net-tools-1.60.orig/lib/inet6_sr.c | ||
| 23 | +++ net-tools-1.60/lib/inet6_sr.c | ||
| 24 | @@ -23,10 +23,10 @@ | ||
| 25 | #include <string.h> | ||
| 26 | #include <stdio.h> | ||
| 27 | #include <unistd.h> | ||
| 28 | -#ifdef __GLIBC__ | ||
| 29 | -#include <net/route.h> | ||
| 30 | -#else | ||
| 31 | +#ifdef HAVE_IPV6_ROUTE_H | ||
| 32 | #include <netinet6/ipv6_route.h> /* glibc does not have this */ | ||
| 33 | +#else | ||
| 34 | +#include <net/route.h> | ||
| 35 | #endif | ||
| 36 | #include "version.h" | ||
| 37 | #include "net-support.h" | ||
| 38 | Index: net-tools-1.60/lib/inet_sr.c | ||
| 39 | =================================================================== | ||
| 40 | --- net-tools-1.60.orig/lib/inet_sr.c | ||
| 41 | +++ net-tools-1.60/lib/inet_sr.c | ||
| 42 | @@ -26,6 +26,7 @@ | ||
| 43 | #include <string.h> | ||
| 44 | #include <stdio.h> | ||
| 45 | #include <unistd.h> | ||
| 46 | +#include <asm-generic/param.h> | ||
| 47 | #include "version.h" | ||
| 48 | #include "net-support.h" | ||
| 49 | #include "pathnames.h" | ||
| 50 | Index: net-tools-1.60/lib/util-ank.c | ||
| 51 | =================================================================== | ||
| 52 | --- net-tools-1.60.orig/lib/util-ank.c | ||
| 53 | +++ net-tools-1.60/lib/util-ank.c | ||
| 54 | @@ -14,6 +14,7 @@ | ||
| 55 | * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses | ||
| 56 | */ | ||
| 57 | |||
| 58 | +#include <limits.h> | ||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <unistd.h> | ||
| 62 | Index: net-tools-1.60/mii-tool.c | ||
| 63 | =================================================================== | ||
| 64 | --- net-tools-1.60.orig/mii-tool.c | ||
| 65 | +++ net-tools-1.60/mii-tool.c | ||
| 66 | @@ -47,10 +47,6 @@ static char Version[] = "$Id: mii-tool.c | ||
| 67 | #include <net/if.h> | ||
| 68 | #include <linux/sockios.h> | ||
| 69 | |||
| 70 | -#ifndef __GLIBC__ | ||
| 71 | -#include <linux/if_arp.h> | ||
| 72 | -#include <linux/if_ether.h> | ||
| 73 | -#endif | ||
| 74 | #include "mii.h" | ||
| 75 | #include "version.h" | ||
| 76 | |||
| 77 | Index: net-tools-1.60/netstat.c | ||
| 78 | =================================================================== | ||
| 79 | --- net-tools-1.60.orig/netstat.c | ||
| 80 | +++ net-tools-1.60/netstat.c | ||
| 81 | @@ -87,6 +87,7 @@ | ||
| 82 | #include <dirent.h> | ||
| 83 | #include <sys/stat.h> | ||
| 84 | #include <sys/types.h> | ||
| 85 | +#include <asm-generic/param.h> | ||
| 86 | |||
| 87 | #include "net-support.h" | ||
| 88 | #include "pathnames.h" | ||
| 89 | Index: net-tools-1.60/slattach.c | ||
| 90 | =================================================================== | ||
| 91 | --- net-tools-1.60.orig/slattach.c | ||
| 92 | +++ net-tools-1.60/slattach.c | ||
| 93 | @@ -44,6 +44,7 @@ | ||
| 94 | #include <string.h> | ||
| 95 | #include <unistd.h> | ||
| 96 | #include <getopt.h> | ||
| 97 | +#include <termios.h> | ||
| 98 | #include <linux/if_slip.h> | ||
| 99 | |||
| 100 | #if defined(__GLIBC__) | ||
diff --git a/meta/recipes-extended/net-tools/net-tools/net-tools-1.60-sctp1.patch b/meta/recipes-extended/net-tools/net-tools/net-tools-1.60-sctp1.patch deleted file mode 100644 index 78daf6c3ed..0000000000 --- a/meta/recipes-extended/net-tools/net-tools/net-tools-1.60-sctp1.patch +++ /dev/null | |||
| @@ -1,635 +0,0 @@ | |||
| 1 | From 23276afe270009420cfbc52bffafdd25ac0817fe Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Li Zhou <li.zhou@windriver.com> | ||
| 3 | Date: Thu, 14 Jan 2016 17:01:29 +0800 | ||
| 4 | Subject: [PATCH 1/3] net-tools: add SCTP support for netstat | ||
| 5 | |||
| 6 | Upstream-Status: pending | ||
| 7 | |||
| 8 | Signed-off-by: Li Zhou <li.zhou@windriver.com> | ||
| 9 | --- | ||
| 10 | netstat.c | 411 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- | ||
| 11 | statistics.c | 68 +++++++++- | ||
| 12 | 2 files changed, 465 insertions(+), 14 deletions(-) | ||
| 13 | |||
| 14 | Index: net-tools-1.60/netstat.c | ||
| 15 | =================================================================== | ||
| 16 | --- net-tools-1.60.orig/netstat.c | ||
| 17 | +++ net-tools-1.60/netstat.c | ||
| 18 | @@ -58,6 +58,7 @@ | ||
| 19 | * | ||
| 20 | *990420 {1.38} Tuan Hoang removed a useless assignment from igmp_do_one() | ||
| 21 | *20010404 {1.39} Arnaldo Carvalho de Melo - use setlocale | ||
| 22 | + *20050516 {1.40} Ivan Skytte Joergensen:Added SCTP support | ||
| 23 | * | ||
| 24 | * This program is free software; you can redistribute it | ||
| 25 | * and/or modify it under the terms of the GNU General | ||
| 26 | @@ -106,7 +107,7 @@ | ||
| 27 | #endif | ||
| 28 | |||
| 29 | /* prototypes for statistics.c */ | ||
| 30 | -void parsesnmp(int, int, int); | ||
| 31 | +void parsesnmp(int, int, int, int); | ||
| 32 | void inittab(void); | ||
| 33 | void parsesnmp6(int, int, int); | ||
| 34 | void inittab6(void); | ||
| 35 | @@ -119,6 +120,28 @@ typedef enum { | ||
| 36 | SS_DISCONNECTING /* in process of disconnecting */ | ||
| 37 | } socket_state; | ||
| 38 | |||
| 39 | +#define SCTP_NSTATES 9 /* The number of states in array*/ | ||
| 40 | + | ||
| 41 | +static const char *sctp_state[] = { | ||
| 42 | + N_("EMPTY"), | ||
| 43 | + N_("CLOSED"), | ||
| 44 | + N_("COOKIE_WAIT"), | ||
| 45 | + N_("COOKIE_ECHOED"), | ||
| 46 | + N_("ESTABLISHED"), | ||
| 47 | + N_("SHUTDOWN_PENDING"), | ||
| 48 | + N_("SHUTDOWN_SENT"), | ||
| 49 | + N_("SHUTDOWN_RECEIVED"), | ||
| 50 | + N_("SHUTDOWN_ACK_SENT") | ||
| 51 | +}; | ||
| 52 | + | ||
| 53 | +#define SCTP_NTYPES 3 /* The number of types in array */ | ||
| 54 | + | ||
| 55 | +static const char *sctp_type[] = { | ||
| 56 | + N_("udp"), | ||
| 57 | + N_("udp-high-bw"), | ||
| 58 | + N_("tcp") | ||
| 59 | +}; | ||
| 60 | + | ||
| 61 | #define SO_ACCEPTCON (1<<16) /* performed a listen */ | ||
| 62 | #define SO_WAITDATA (1<<17) /* wait data to read */ | ||
| 63 | #define SO_NOSPACE (1<<18) /* no space to write */ | ||
| 64 | @@ -149,6 +172,7 @@ int flag_opt = 0; | ||
| 65 | int flag_raw = 0; | ||
| 66 | int flag_tcp = 0; | ||
| 67 | int flag_udp = 0; | ||
| 68 | +int flag_sctp= 0; | ||
| 69 | int flag_igmp= 0; | ||
| 70 | int flag_rom = 0; | ||
| 71 | int flag_exp = 1; | ||
| 72 | @@ -995,6 +1019,365 @@ static int udp_info(void) | ||
| 73 | udp_do_one); | ||
| 74 | } | ||
| 75 | |||
| 76 | +static const char *sctp_socket_type_str(int type) { | ||
| 77 | + if(type>=0 && type<SCTP_NTYPES) | ||
| 78 | + return sctp_type[type]; | ||
| 79 | + else { | ||
| 80 | + static char type_str_buf[64]; | ||
| 81 | + sprintf(type_str_buf,"UNKNOWN(%d)",type); | ||
| 82 | + return type_str_buf; | ||
| 83 | + } | ||
| 84 | +} | ||
| 85 | + | ||
| 86 | +static const char *sctp_state_str(int state) | ||
| 87 | +{ | ||
| 88 | + if(state>=0 && state<SCTP_NSTATES) | ||
| 89 | + return sctp_state[state]; | ||
| 90 | + else { | ||
| 91 | + static char state_str_buf[64]; | ||
| 92 | + sprintf(state_str_buf,"UNKNOWN(%d)",state); | ||
| 93 | + return state_str_buf; | ||
| 94 | + } | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +static const char *sctp_socket_state_str(int state) | ||
| 98 | +{ | ||
| 99 | + if(state>=0 && state<=10) | ||
| 100 | + return tcp_state[state]; | ||
| 101 | + else { | ||
| 102 | + static char state_str_buf[64]; | ||
| 103 | + sprintf(state_str_buf,"UNKNOWN(%d)",state); | ||
| 104 | + return state_str_buf; | ||
| 105 | + } | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | +static struct aftype *process_sctp_addr_str(const char *addr_str, struct sockaddr *sa) | ||
| 109 | +{ | ||
| 110 | + if (strchr(addr_str,':')) { | ||
| 111 | +#if HAVE_AFINET6 | ||
| 112 | + extern struct aftype inet6_aftype; | ||
| 113 | + /* Demangle what the kernel gives us */ | ||
| 114 | + struct in6_addr in6; | ||
| 115 | + char addr6_str[INET6_ADDRSTRLEN]; | ||
| 116 | + unsigned u0,u1,u2,u3,u4,u5,u6,u7; | ||
| 117 | + sscanf(addr_str, "%04X:%04X:%04X:%04X:%04X:%04X:%04X:%04X", | ||
| 118 | + &u0, &u1, &u2, &u3, &u4, &u5, &u6, &u7); | ||
| 119 | + in6.s6_addr16[0] = htons(u0); | ||
| 120 | + in6.s6_addr16[1] = htons(u1); | ||
| 121 | + in6.s6_addr16[2] = htons(u2); | ||
| 122 | + in6.s6_addr16[3] = htons(u3); | ||
| 123 | + in6.s6_addr16[4] = htons(u4); | ||
| 124 | + in6.s6_addr16[5] = htons(u5); | ||
| 125 | + in6.s6_addr16[6] = htons(u6); | ||
| 126 | + in6.s6_addr16[7] = htons(u7); | ||
| 127 | + | ||
| 128 | + inet_ntop(AF_INET6, &in6, addr6_str, sizeof(addr6_str)); | ||
| 129 | + inet6_aftype.input(1, addr6_str, sa); | ||
| 130 | + sa->sa_family = AF_INET6; | ||
| 131 | +#endif | ||
| 132 | + } else { | ||
| 133 | + ((struct sockaddr_in*)sa)->sin_addr.s_addr = inet_addr(addr_str); | ||
| 134 | + sa->sa_family = AF_INET; | ||
| 135 | + } | ||
| 136 | + return get_afntype(sa->sa_family); | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | +static void sctp_eps_do_one(int lnr, char *line) | ||
| 140 | +{ | ||
| 141 | + char buffer[1024]; | ||
| 142 | + int type, state, port; | ||
| 143 | + int uid; | ||
| 144 | + unsigned long inode; | ||
| 145 | + | ||
| 146 | + struct aftype *ap; | ||
| 147 | +#if HAVE_AFINET6 | ||
| 148 | + struct sockaddr_in6 localaddr; | ||
| 149 | +#else | ||
| 150 | + struct sockaddr_in localaddr; | ||
| 151 | +#endif | ||
| 152 | + const char *sty_str; | ||
| 153 | + const char *sst_str; | ||
| 154 | + const char *lport_str; | ||
| 155 | + const char *uid_str; | ||
| 156 | + const char *inode_str; | ||
| 157 | + const char *pladdr_str; | ||
| 158 | + char *laddrs_str; | ||
| 159 | + | ||
| 160 | + if(lnr == 0) { | ||
| 161 | + /* ENDPT SOCK STY SST HBKT LPORT uid inode pladdr LADDRS*/ | ||
| 162 | + return; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + strtok(line," \t\n"); /*skip ptr*/ | ||
| 166 | + strtok(0," \t\n"); /*skip ptr*/ | ||
| 167 | + sty_str = strtok(0," \t\n"); | ||
| 168 | + sst_str = strtok(0," \t\n"); | ||
| 169 | + strtok(0," \t\n"); /*skip hash bucket*/ | ||
| 170 | + lport_str=strtok(0," \t\n"); | ||
| 171 | + uid_str = strtok(0," \t\n"); | ||
| 172 | + inode_str = strtok(0," \t\n"); | ||
| 173 | + pladdr_str = strtok(0," \t\n"); | ||
| 174 | + laddrs_str=strtok(0,"\t\n"); | ||
| 175 | + | ||
| 176 | + type = atoi(sty_str); | ||
| 177 | + state = atoi(sst_str); | ||
| 178 | + port = atoi(lport_str); | ||
| 179 | + uid = atoi(uid_str); | ||
| 180 | + inode = strtoul(inode_str,0,0); | ||
| 181 | + | ||
| 182 | + if(flag_sctp<=1) { | ||
| 183 | + /* only print the primary address */ | ||
| 184 | + char local_addr[64]; | ||
| 185 | + char local_port[16]; | ||
| 186 | + | ||
| 187 | + ap = process_sctp_addr_str(pladdr_str, (struct sockaddr*)&localaddr); | ||
| 188 | + if(ap) | ||
| 189 | + safe_strncpy(local_addr, | ||
| 190 | + ap->sprint((struct sockaddr *) &localaddr, flag_not), | ||
| 191 | + sizeof(local_addr)); | ||
| 192 | + else | ||
| 193 | + sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); | ||
| 194 | + | ||
| 195 | + snprintf(local_port, sizeof(local_port), "%s", | ||
| 196 | + get_sname(htons(port), "sctp", | ||
| 197 | + flag_not & FLAG_NUM_PORT)); | ||
| 198 | + | ||
| 199 | + printf("sctp "); | ||
| 200 | + sprintf(buffer,"%s:%s", local_addr, local_port); | ||
| 201 | + printf("%-47s", buffer); | ||
| 202 | + printf(" %-12s", sctp_socket_state_str(state)); | ||
| 203 | + } else { | ||
| 204 | + /*print all addresses*/ | ||
| 205 | + const char *this_local_addr; | ||
| 206 | + int first=1; | ||
| 207 | + char local_port[16]; | ||
| 208 | + snprintf(local_port, sizeof(local_port), "%s", | ||
| 209 | + get_sname(htons(port), "sctp", | ||
| 210 | + flag_not & FLAG_NUM_PORT)); | ||
| 211 | + for(this_local_addr=strtok(laddrs_str," \t\n"); | ||
| 212 | + this_local_addr; | ||
| 213 | + this_local_addr=strtok(0," \t\n")) | ||
| 214 | + { | ||
| 215 | + char local_addr[64]; | ||
| 216 | + ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); | ||
| 217 | + if(ap) | ||
| 218 | + safe_strncpy(local_addr, | ||
| 219 | + ap->sprint((struct sockaddr *) &localaddr, flag_not), | ||
| 220 | + sizeof(local_addr)); | ||
| 221 | + else | ||
| 222 | + sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); | ||
| 223 | + | ||
| 224 | + if(!first) printf("\n"); | ||
| 225 | + if(first) | ||
| 226 | + printf("sctp "); | ||
| 227 | + else | ||
| 228 | + printf(" "); | ||
| 229 | + sprintf(buffer,"%s:%s", local_addr, local_port); | ||
| 230 | + printf("%-47s", buffer); | ||
| 231 | + printf(" %-12s", first?sctp_socket_state_str(state):""); | ||
| 232 | + first = 0; | ||
| 233 | + } | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + finish_this_one(uid,inode,""); | ||
| 237 | +} | ||
| 238 | + | ||
| 239 | +static void sctp_assoc_do_one(int lnr, char *line) | ||
| 240 | +{ | ||
| 241 | + char buffer[1024]; | ||
| 242 | + int type, state, state2, lport,rport; | ||
| 243 | + int uid; | ||
| 244 | + unsigned rxqueue,txqueue; | ||
| 245 | + unsigned long inode; | ||
| 246 | + | ||
| 247 | + struct aftype *ap; | ||
| 248 | +#if HAVE_AFINET6 | ||
| 249 | + struct sockaddr_in6 localaddr,remoteaddr; | ||
| 250 | +#else | ||
| 251 | + struct sockaddr_in localaddr,remoteaddr; | ||
| 252 | +#endif | ||
| 253 | + const char *sty_str; | ||
| 254 | + const char *sst_str; | ||
| 255 | + const char *st_str; | ||
| 256 | + const char *txqueue_str; | ||
| 257 | + const char *rxqueue_str; | ||
| 258 | + const char *lport_str,*rport_str; | ||
| 259 | + const char *uid_str; | ||
| 260 | + const char *inode_str; | ||
| 261 | + const char *pladdr_str; | ||
| 262 | + char *laddrs_str; | ||
| 263 | + const char *praddr_str; | ||
| 264 | + char *raddrs_str; | ||
| 265 | + | ||
| 266 | + if(lnr == 0) { | ||
| 267 | + /* ASSOC SOCK STY SST ST HBKT tx_queue rx_queue uid inode LPORT RPORT pladdr praddr LADDRS <-> RADDRS*/ | ||
| 268 | + return; | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + strtok(line," \t\n"); /*skip ptr*/ | ||
| 272 | + strtok(0," \t\n"); /*skip ptr*/ | ||
| 273 | + sty_str = strtok(0," \t\n"); | ||
| 274 | + sst_str = strtok(0," \t\n"); | ||
| 275 | + st_str = strtok(0," \t\n"); | ||
| 276 | + strtok(0," \t\n"); /*skip hash bucket*/ | ||
| 277 | + txqueue_str = strtok(0," \t\n"); | ||
| 278 | + rxqueue_str = strtok(0," \t\n"); | ||
| 279 | + uid_str = strtok(0," \t\n"); | ||
| 280 | + inode_str = strtok(0," \t\n"); | ||
| 281 | + lport_str=strtok(0," \t\n"); | ||
| 282 | + rport_str=strtok(0," \t\n"); | ||
| 283 | + pladdr_str = strtok(0," \t\n"); | ||
| 284 | + praddr_str = strtok(0," \t\n"); | ||
| 285 | + laddrs_str=strtok(0,"<->\t\n"); | ||
| 286 | + raddrs_str=strtok(0,"<->\t\n"); | ||
| 287 | + | ||
| 288 | + type = atoi(sty_str); | ||
| 289 | + state = atoi(sst_str); | ||
| 290 | + state2 = atoi(st_str); | ||
| 291 | + txqueue = atoi(txqueue_str); | ||
| 292 | + rxqueue = atoi(rxqueue_str); | ||
| 293 | + uid = atoi(uid_str); | ||
| 294 | + inode = strtoul(inode_str,0,0); | ||
| 295 | + lport = atoi(lport_str); | ||
| 296 | + rport = atoi(rport_str); | ||
| 297 | + | ||
| 298 | + if(flag_sctp<=1) { | ||
| 299 | + /* only print the primary addresses */ | ||
| 300 | + char local_addr[64]; | ||
| 301 | + char local_port[16]; | ||
| 302 | + char remote_addr[64]; | ||
| 303 | + char remote_port[16]; | ||
| 304 | + | ||
| 305 | + ap = process_sctp_addr_str(pladdr_str, (struct sockaddr*)&localaddr); | ||
| 306 | + if(ap) | ||
| 307 | + safe_strncpy(local_addr, | ||
| 308 | + ap->sprint((struct sockaddr *) &localaddr, flag_not), | ||
| 309 | + sizeof(local_addr)); | ||
| 310 | + else | ||
| 311 | + sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); | ||
| 312 | + | ||
| 313 | + snprintf(local_port, sizeof(local_port), "%s", | ||
| 314 | + get_sname(htons(lport), "sctp", | ||
| 315 | + flag_not & FLAG_NUM_PORT)); | ||
| 316 | + | ||
| 317 | + ap = process_sctp_addr_str(praddr_str, (struct sockaddr*)&remoteaddr); | ||
| 318 | + if(ap) | ||
| 319 | + safe_strncpy(remote_addr, | ||
| 320 | + ap->sprint((struct sockaddr *) &remoteaddr, flag_not), | ||
| 321 | + sizeof(remote_addr)); | ||
| 322 | + else | ||
| 323 | + sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family); | ||
| 324 | + | ||
| 325 | + snprintf(remote_port, sizeof(remote_port), "%s", | ||
| 326 | + get_sname(htons(rport), "sctp", | ||
| 327 | + flag_not & FLAG_NUM_PORT)); | ||
| 328 | + | ||
| 329 | + printf("sctp"); | ||
| 330 | + printf(" %6u %6u ", rxqueue, txqueue); | ||
| 331 | + sprintf(buffer,"%s:%s", local_addr, local_port); | ||
| 332 | + printf("%-23s", buffer); | ||
| 333 | + printf(" "); | ||
| 334 | + sprintf(buffer,"%s:%s", remote_addr, remote_port); | ||
| 335 | + printf("%-23s", buffer); | ||
| 336 | + printf(" %-12s", sctp_socket_state_str(state)); | ||
| 337 | + } else { | ||
| 338 | + /*print all addresses*/ | ||
| 339 | + const char *this_local_addr; | ||
| 340 | + const char *this_remote_addr; | ||
| 341 | + char *ss1,*ss2; | ||
| 342 | + int first=1; | ||
| 343 | + char local_port[16]; | ||
| 344 | + char remote_port[16]; | ||
| 345 | + snprintf(local_port, sizeof(local_port), "%s", | ||
| 346 | + get_sname(htons(lport), "sctp", | ||
| 347 | + flag_not & FLAG_NUM_PORT)); | ||
| 348 | + snprintf(remote_port, sizeof(remote_port), "%s", | ||
| 349 | + get_sname(htons(rport), "sctp", | ||
| 350 | + flag_not & FLAG_NUM_PORT)); | ||
| 351 | + | ||
| 352 | + this_local_addr=strtok_r(laddrs_str," \t\n",&ss1); | ||
| 353 | + this_remote_addr=strtok_r(raddrs_str," \t\n",&ss2); | ||
| 354 | + while(this_local_addr || this_remote_addr) { | ||
| 355 | + char local_addr[64]; | ||
| 356 | + char remote_addr[64]; | ||
| 357 | + if(this_local_addr) { | ||
| 358 | + ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); | ||
| 359 | + if(ap) | ||
| 360 | + safe_strncpy(local_addr, | ||
| 361 | + ap->sprint((struct sockaddr *) &localaddr, flag_not), | ||
| 362 | + sizeof(local_addr)); | ||
| 363 | + else | ||
| 364 | + sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); | ||
| 365 | + } | ||
| 366 | + if(this_remote_addr) { | ||
| 367 | + ap = process_sctp_addr_str(this_remote_addr, (struct sockaddr*)&remoteaddr); | ||
| 368 | + if(ap) | ||
| 369 | + safe_strncpy(remote_addr, | ||
| 370 | + ap->sprint((struct sockaddr *) &remoteaddr, flag_not), | ||
| 371 | + sizeof(remote_addr)); | ||
| 372 | + else | ||
| 373 | + sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family); | ||
| 374 | + } | ||
| 375 | + | ||
| 376 | + if(!first) printf("\n"); | ||
| 377 | + if(first) | ||
| 378 | + printf("sctp %6u %6u ", rxqueue, txqueue); | ||
| 379 | + else | ||
| 380 | + printf(" "); | ||
| 381 | + if(this_local_addr) { | ||
| 382 | + if(first) | ||
| 383 | + sprintf(buffer,"%s:%s", local_addr, local_port); | ||
| 384 | + else | ||
| 385 | + sprintf(buffer,"%s", local_addr); | ||
| 386 | + printf("%-23s", buffer); | ||
| 387 | + } else | ||
| 388 | + printf("%-23s", ""); | ||
| 389 | + printf(" "); | ||
| 390 | + if(this_remote_addr) { | ||
| 391 | + if(first) | ||
| 392 | + sprintf(buffer,"%s:%s", remote_addr, remote_port); | ||
| 393 | + else | ||
| 394 | + sprintf(buffer,"%s", remote_addr); | ||
| 395 | + printf("%-23s", buffer); | ||
| 396 | + } else | ||
| 397 | + printf("%-23s", ""); | ||
| 398 | + | ||
| 399 | + printf(" %-12s", first?sctp_socket_state_str(state):""); | ||
| 400 | + | ||
| 401 | + first = 0; | ||
| 402 | + this_local_addr=strtok_r(0," \t\n",&ss1); | ||
| 403 | + this_remote_addr=strtok_r(0," \t\n",&ss2); | ||
| 404 | + } | ||
| 405 | + } | ||
| 406 | + | ||
| 407 | + finish_this_one(uid,inode,""); | ||
| 408 | +} | ||
| 409 | + | ||
| 410 | +static int sctp_info_eps(void) | ||
| 411 | +{ | ||
| 412 | +#if !defined(_PATH_PROCNET_SCTP_EPS) | ||
| 413 | +#define _PATH_PROCNET_SCTP_EPS "/proc/net/sctp/eps" | ||
| 414 | +#endif | ||
| 415 | + INFO_GUTS(_PATH_PROCNET_SCTP_EPS, "AF INET (sctp)", | ||
| 416 | + sctp_eps_do_one); | ||
| 417 | +} | ||
| 418 | + | ||
| 419 | +static int sctp_info_assocs(void) | ||
| 420 | +{ | ||
| 421 | +#if !defined(_PATH_PROCNET_SCTP_ASSOCS) | ||
| 422 | +#define _PATH_PROCNET_SCTP_ASSOCS "/proc/net/sctp/assocs" | ||
| 423 | +#endif | ||
| 424 | + INFO_GUTS(_PATH_PROCNET_SCTP_ASSOCS, "AF INET (sctp)", | ||
| 425 | + sctp_assoc_do_one); | ||
| 426 | +} | ||
| 427 | + | ||
| 428 | +static int sctp_info(void) | ||
| 429 | +{ | ||
| 430 | + if(flag_all) | ||
| 431 | + sctp_info_eps(); | ||
| 432 | + return sctp_info_assocs(); | ||
| 433 | +} | ||
| 434 | + | ||
| 435 | static void raw_do_one(int lnr, const char *line) | ||
| 436 | { | ||
| 437 | char buffer[8192], local_addr[64], rem_addr[64]; | ||
| 438 | @@ -1558,7 +1941,7 @@ static void usage(void) | ||
| 439 | fprintf(stderr, _(" -F, --fib display Forwarding Information Base (default)\n")); | ||
| 440 | fprintf(stderr, _(" -C, --cache display routing cache instead of FIB\n\n")); | ||
| 441 | |||
| 442 | - fprintf(stderr, _(" <Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom\n")); | ||
| 443 | + fprintf(stderr, _(" <Socket>={-t|--tcp} {-u|--udp} {-S|--sctp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom\n")); | ||
| 444 | fprintf(stderr, _(" <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; default: %s\n"), DFLT_AF); | ||
| 445 | fprintf(stderr, _(" List of possible address families (which support routing):\n")); | ||
| 446 | print_aflist(1); /* 1 = routeable */ | ||
| 447 | @@ -1583,6 +1966,7 @@ int main | ||
| 448 | {"protocol", 1, 0, 'A'}, | ||
| 449 | {"tcp", 0, 0, 't'}, | ||
| 450 | {"udp", 0, 0, 'u'}, | ||
| 451 | + {"sctp", 0, 0, 'S' }, | ||
| 452 | {"raw", 0, 0, 'w'}, | ||
| 453 | {"unix", 0, 0, 'x'}, | ||
| 454 | {"listening", 0, 0, 'l'}, | ||
| 455 | @@ -1613,7 +1997,7 @@ int main | ||
| 456 | getroute_init(); /* Set up AF routing support */ | ||
| 457 | |||
| 458 | afname[0] = '\0'; | ||
| 459 | - while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuWVv?wxl64", longopts, &lop)) != EOF) | ||
| 460 | + while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuSWVv?wxl64", longopts, &lop)) != EOF) | ||
| 461 | switch (i) { | ||
| 462 | case -1: | ||
| 463 | break; | ||
| 464 | @@ -1705,10 +2089,12 @@ int main | ||
| 465 | case 't': | ||
| 466 | flag_tcp++; | ||
| 467 | break; | ||
| 468 | - | ||
| 469 | case 'u': | ||
| 470 | flag_udp++; | ||
| 471 | break; | ||
| 472 | + case 'S': | ||
| 473 | + flag_sctp++; | ||
| 474 | + break; | ||
| 475 | case 'w': | ||
| 476 | flag_raw++; | ||
| 477 | break; | ||
| 478 | @@ -1726,13 +2112,13 @@ int main | ||
| 479 | if (flag_int + flag_rou + flag_mas + flag_sta > 1) | ||
| 480 | usage(); | ||
| 481 | |||
| 482 | - if ((flag_inet || flag_inet6 || flag_sta) && !(flag_tcp || flag_udp || flag_raw)) | ||
| 483 | - flag_tcp = flag_udp = flag_raw = 1; | ||
| 484 | + if ((flag_inet || flag_inet6 || flag_sta) && !(flag_tcp || flag_udp || flag_sctp || flag_raw)) | ||
| 485 | + flag_tcp = flag_udp = flag_sctp = flag_raw = 1; | ||
| 486 | |||
| 487 | - if ((flag_tcp || flag_udp || flag_raw || flag_igmp) && !(flag_inet || flag_inet6)) | ||
| 488 | + if ((flag_tcp || flag_udp || flag_sctp || flag_raw || flag_igmp) && !(flag_inet || flag_inet6)) | ||
| 489 | flag_inet = flag_inet6 = 1; | ||
| 490 | |||
| 491 | - flag_arg = flag_tcp + flag_udp + flag_raw + flag_unx + flag_ipx | ||
| 492 | + flag_arg = flag_tcp + flag_udp + flag_sctp + flag_raw + flag_unx + flag_ipx | ||
| 493 | + flag_ax25 + flag_netrom + flag_igmp + flag_x25; | ||
| 494 | |||
| 495 | if (flag_mas) { | ||
| 496 | @@ -1760,7 +2146,7 @@ int main | ||
| 497 | char buf[256]; | ||
| 498 | if (!afname[0]) { | ||
| 499 | inittab(); | ||
| 500 | - parsesnmp(flag_raw, flag_tcp, flag_udp); | ||
| 501 | + parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp); | ||
| 502 | } else { | ||
| 503 | safe_strncpy(buf, afname, sizeof(buf)); | ||
| 504 | tmp1 = buf; | ||
| 505 | @@ -1815,7 +2201,7 @@ int main | ||
| 506 | return (i); | ||
| 507 | } | ||
| 508 | for (;;) { | ||
| 509 | - if (!flag_arg || flag_tcp || flag_udp || flag_raw) { | ||
| 510 | + if (!flag_arg || flag_tcp || flag_udp || flag_sctp || flag_raw) { | ||
| 511 | #if HAVE_AFINET | ||
| 512 | prg_cache_load(); | ||
| 513 | printf(_("Active Internet connections ")); /* xxx */ | ||
| 514 | @@ -1854,6 +2240,11 @@ int main | ||
| 515 | if (i) | ||
| 516 | return (i); | ||
| 517 | } | ||
| 518 | + if (!flag_arg || flag_sctp) { | ||
| 519 | + i = sctp_info(); | ||
| 520 | + if (i) | ||
| 521 | + return (i); | ||
| 522 | + } | ||
| 523 | if (!flag_arg || flag_raw) { | ||
| 524 | i = raw_info(); | ||
| 525 | if (i) | ||
| 526 | Index: net-tools-1.60/statistics.c | ||
| 527 | =================================================================== | ||
| 528 | --- net-tools-1.60.orig/statistics.c | ||
| 529 | +++ net-tools-1.60/statistics.c | ||
| 530 | @@ -21,7 +21,7 @@ | ||
| 531 | #define UFWARN(x) | ||
| 532 | #endif | ||
| 533 | |||
| 534 | -int print_static,f_raw,f_tcp,f_udp,f_unknown = 1; | ||
| 535 | +int print_static,f_raw,f_tcp,f_udp,f_sctp,f_unknown = 1; | ||
| 536 | |||
| 537 | enum State { | ||
| 538 | number = 0, opt_number, i_forward, i_inp_icmp, i_outp_icmp, i_rto_alg, | ||
| 539 | @@ -297,6 +297,27 @@ struct entry Tcpexttab[] = | ||
| 540 | { "TCPRenoRecoveryFail", N_("%llu classic Reno fast retransmits failed"), opt_number }, | ||
| 541 | }; | ||
| 542 | |||
| 543 | +struct entry Sctptab[] = | ||
| 544 | +{ | ||
| 545 | + {"SctpCurrEstab", N_("%u Current Associations"), number}, | ||
| 546 | + {"SctpActiveEstabs", N_("%u Active Associations"), number}, | ||
| 547 | + {"SctpPassiveEstabs", N_("%u Passive Associations"), number}, | ||
| 548 | + {"SctpAborteds", N_("%u Number of Aborteds "), number}, | ||
| 549 | + {"SctpShutdowns", N_("%u Number of Graceful Terminations"), number}, | ||
| 550 | + {"SctpOutOfBlues", N_("%u Number of Out of Blue packets"), number}, | ||
| 551 | + {"SctpChecksumErrors", N_("%u Number of Packets with invalid Checksum"), number}, | ||
| 552 | + {"SctpOutCtrlChunks", N_("%u Number of control chunks sent"), number}, | ||
| 553 | + {"SctpOutOrderChunks", N_("%u Number of ordered chunks sent"), number}, | ||
| 554 | + {"SctpOutUnorderChunks", N_("%u Number of Unordered chunks sent"), number}, | ||
| 555 | + {"SctpInCtrlChunks", N_("%u Number of control chunks received"), number}, | ||
| 556 | + {"SctpInOrderChunks", N_("%u Number of ordered chunks received"), number}, | ||
| 557 | + {"SctpInUnorderChunks", N_("%u Number of Unordered chunks received"), number}, | ||
| 558 | + {"SctpFragUsrMsgs", N_("%u Number of messages fragmented"), number}, | ||
| 559 | + {"SctpReasmUsrMsgs", N_("%u Number of messages reassembled "), number}, | ||
| 560 | + {"SctpOutSCTPPacks", N_("%u Number of SCTP packets sent"), number}, | ||
| 561 | + {"SctpInSCTPPacks", N_("%u Number of SCTP packets received"), number}, | ||
| 562 | +}; | ||
| 563 | + | ||
| 564 | struct tabtab { | ||
| 565 | char *title; | ||
| 566 | struct entry *tab; | ||
| 567 | @@ -310,6 +331,7 @@ struct tabtab snmptabs[] = | ||
| 568 | {"Icmp", Icmptab, sizeof(Icmptab), &f_raw}, | ||
| 569 | {"Tcp", Tcptab, sizeof(Tcptab), &f_tcp}, | ||
| 570 | {"Udp", Udptab, sizeof(Udptab), &f_udp}, | ||
| 571 | + {"Sctp", Sctptab, sizeof(Sctptab), &f_sctp}, | ||
| 572 | {"TcpExt", Tcpexttab, sizeof(Tcpexttab), &f_tcp}, | ||
| 573 | {NULL} | ||
| 574 | }; | ||
| 575 | @@ -499,12 +521,40 @@ void process6_fd(FILE *f) | ||
| 576 | |||
| 577 | } | ||
| 578 | |||
| 579 | -void parsesnmp(int flag_raw, int flag_tcp, int flag_udp) | ||
| 580 | +/* Process a file with name-value lines (like /proc/net/sctp/snmp) */ | ||
| 581 | +void process_fd2(FILE *f, const char *filename) | ||
| 582 | +{ | ||
| 583 | + char buf1[1024]; | ||
| 584 | + char *sp; | ||
| 585 | + struct tabtab *tab; | ||
| 586 | + | ||
| 587 | + tab = newtable(snmptabs, "Sctp"); | ||
| 588 | + | ||
| 589 | + while (fgets(buf1, sizeof buf1, f)) { | ||
| 590 | + sp = buf1 + strcspn(buf1, " \t\n"); | ||
| 591 | + if (!sp) | ||
| 592 | + goto formaterr; | ||
| 593 | + *sp = '\0'; | ||
| 594 | + sp++; | ||
| 595 | + | ||
| 596 | + sp += strspn(sp, " \t\n"); | ||
| 597 | + | ||
| 598 | + if (*sp != '\0' && *(tab->flag)) | ||
| 599 | + printval(tab, buf1, strtoul(sp, 0, 10)); | ||
| 600 | + } | ||
| 601 | + return; | ||
| 602 | + | ||
| 603 | +formaterr: | ||
| 604 | + fprintf(stderr,_("error parsing %s\n"), filename); | ||
| 605 | + return; | ||
| 606 | +} | ||
| 607 | + | ||
| 608 | +void parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp) | ||
| 609 | { | ||
| 610 | FILE *f; | ||
| 611 | |||
| 612 | - f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp; | ||
| 613 | - | ||
| 614 | + f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp; f_sctp = flag_sctp; | ||
| 615 | + | ||
| 616 | f = proc_fopen("/proc/net/snmp"); | ||
| 617 | if (!f) { | ||
| 618 | perror(_("cannot open /proc/net/snmp")); | ||
| 619 | @@ -530,6 +580,16 @@ void parsesnmp(int flag_raw, int flag_tc | ||
| 620 | |||
| 621 | fclose(f); | ||
| 622 | } | ||
| 623 | + | ||
| 624 | + f = fopen("/proc/net/sctp/snmp", "r"); | ||
| 625 | + if (f) { | ||
| 626 | + process_fd2(f,"/proc/net/sctp/snmp"); | ||
| 627 | + if (ferror(f)) | ||
| 628 | + perror("/proc/net/sctp/snmp"); | ||
| 629 | + | ||
| 630 | + fclose(f); | ||
| 631 | + } | ||
| 632 | + | ||
| 633 | return; | ||
| 634 | } | ||
| 635 | |||
diff --git a/meta/recipes-extended/net-tools/net-tools/net-tools-1.60-sctp2-quiet.patch b/meta/recipes-extended/net-tools/net-tools/net-tools-1.60-sctp2-quiet.patch deleted file mode 100644 index d34e651327..0000000000 --- a/meta/recipes-extended/net-tools/net-tools/net-tools-1.60-sctp2-quiet.patch +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | From 14287b594e1f02b811f889fb515c1a51b72c08d4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Li Zhou <li.zhou@windriver.com> | ||
| 3 | Date: Thu, 14 Jan 2016 17:07:48 +0800 | ||
| 4 | Subject: [PATCH 2/3] net-tools: add SCTP support for netstat | ||
| 5 | |||
| 6 | Upstream-Status: pending | ||
| 7 | |||
| 8 | Signed-off-by: Li Zhou <li.zhou@windriver.com> | ||
| 9 | --- | ||
| 10 | netstat.c | 2 +- | ||
| 11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 12 | |||
| 13 | diff --git a/netstat.c b/netstat.c | ||
| 14 | index 5d1a4a1..56a15c2 100644 | ||
| 15 | --- a/netstat.c | ||
| 16 | +++ b/netstat.c | ||
| 17 | @@ -2104,7 +2104,7 @@ int main | ||
| 18 | usage(); | ||
| 19 | |||
| 20 | if ((flag_inet || flag_inet6 || flag_sta) && !(flag_tcp || flag_udp || flag_sctp || flag_raw)) | ||
| 21 | - flag_tcp = flag_udp = flag_sctp = flag_raw = 1; | ||
| 22 | + flag_tcp = flag_udp = flag_raw = 1; | ||
| 23 | |||
| 24 | if ((flag_tcp || flag_udp || flag_sctp || flag_raw || flag_igmp) && !(flag_inet || flag_inet6)) | ||
| 25 | flag_inet = flag_inet6 = 1; | ||
| 26 | -- | ||
| 27 | 1.8.5.2.233.g932f7e4 | ||
| 28 | |||
diff --git a/meta/recipes-extended/net-tools/net-tools/net-tools-1.60-sctp3-addrs.patch b/meta/recipes-extended/net-tools/net-tools/net-tools-1.60-sctp3-addrs.patch deleted file mode 100644 index 8b2ecab707..0000000000 --- a/meta/recipes-extended/net-tools/net-tools/net-tools-1.60-sctp3-addrs.patch +++ /dev/null | |||
| @@ -1,363 +0,0 @@ | |||
| 1 | From 1d386279a449a1a6b96b88a71f35bf13b14b2c2c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Li Zhou <li.zhou@windriver.com> | ||
| 3 | Date: Thu, 14 Jan 2016 17:11:24 +0800 | ||
| 4 | Subject: [PATCH 3/3] net-tools: add SCTP support for netstat | ||
| 5 | |||
| 6 | Upstream-Status: pending | ||
| 7 | |||
| 8 | Signed-off-by: Li Zhou <li.zhou@windriver.com> | ||
| 9 | --- | ||
| 10 | netstat.c | 282 ++++++++++++++++++++++++-------------------------------------- | ||
| 11 | 1 file changed, 108 insertions(+), 174 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/netstat.c b/netstat.c | ||
| 14 | index 56a15c2..86adadb 100644 | ||
| 15 | --- a/netstat.c | ||
| 16 | +++ b/netstat.c | ||
| 17 | @@ -1095,23 +1095,21 @@ static void sctp_eps_do_one(int lnr, char *line) | ||
| 18 | const char *lport_str; | ||
| 19 | const char *uid_str; | ||
| 20 | const char *inode_str; | ||
| 21 | - const char *pladdr_str; | ||
| 22 | char *laddrs_str; | ||
| 23 | |||
| 24 | if(lnr == 0) { | ||
| 25 | - /* ENDPT SOCK STY SST HBKT LPORT uid inode pladdr LADDRS*/ | ||
| 26 | + /* ENDPT SOCK STY SST HBKT LPORT UID INODE LADDRS */ | ||
| 27 | return; | ||
| 28 | } | ||
| 29 | |||
| 30 | - strtok(line," \t\n"); /*skip ptr*/ | ||
| 31 | - strtok(0," \t\n"); /*skip ptr*/ | ||
| 32 | + strtok(line," \t\n"); /*skip endpt*/ | ||
| 33 | + strtok(0," \t\n"); /*skip sock*/ | ||
| 34 | sty_str = strtok(0," \t\n"); | ||
| 35 | sst_str = strtok(0," \t\n"); | ||
| 36 | strtok(0," \t\n"); /*skip hash bucket*/ | ||
| 37 | lport_str=strtok(0," \t\n"); | ||
| 38 | uid_str = strtok(0," \t\n"); | ||
| 39 | inode_str = strtok(0," \t\n"); | ||
| 40 | - pladdr_str = strtok(0," \t\n"); | ||
| 41 | laddrs_str=strtok(0,"\t\n"); | ||
| 42 | |||
| 43 | type = atoi(sty_str); | ||
| 44 | @@ -1119,61 +1117,35 @@ static void sctp_eps_do_one(int lnr, char *line) | ||
| 45 | port = atoi(lport_str); | ||
| 46 | uid = atoi(uid_str); | ||
| 47 | inode = strtoul(inode_str,0,0); | ||
| 48 | - | ||
| 49 | - if(flag_sctp<=1) { | ||
| 50 | - /* only print the primary address */ | ||
| 51 | - char local_addr[64]; | ||
| 52 | - char local_port[16]; | ||
| 53 | - | ||
| 54 | - ap = process_sctp_addr_str(pladdr_str, (struct sockaddr*)&localaddr); | ||
| 55 | - if(ap) | ||
| 56 | - safe_strncpy(local_addr, | ||
| 57 | - ap->sprint((struct sockaddr *) &localaddr, flag_not), | ||
| 58 | - sizeof(local_addr)); | ||
| 59 | - else | ||
| 60 | - sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); | ||
| 61 | - | ||
| 62 | - snprintf(local_port, sizeof(local_port), "%s", | ||
| 63 | - get_sname(htons(port), "sctp", | ||
| 64 | - flag_not & FLAG_NUM_PORT)); | ||
| 65 | - | ||
| 66 | - printf("sctp "); | ||
| 67 | - sprintf(buffer,"%s:%s", local_addr, local_port); | ||
| 68 | - printf("%-47s", buffer); | ||
| 69 | - printf(" %-12s", sctp_socket_state_str(state)); | ||
| 70 | - } else { | ||
| 71 | - /*print all addresses*/ | ||
| 72 | - const char *this_local_addr; | ||
| 73 | - int first=1; | ||
| 74 | - char local_port[16]; | ||
| 75 | - snprintf(local_port, sizeof(local_port), "%s", | ||
| 76 | - get_sname(htons(port), "sctp", | ||
| 77 | - flag_not & FLAG_NUM_PORT)); | ||
| 78 | - for(this_local_addr=strtok(laddrs_str," \t\n"); | ||
| 79 | - this_local_addr; | ||
| 80 | - this_local_addr=strtok(0," \t\n")) | ||
| 81 | - { | ||
| 82 | - char local_addr[64]; | ||
| 83 | - ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); | ||
| 84 | - if(ap) | ||
| 85 | - safe_strncpy(local_addr, | ||
| 86 | - ap->sprint((struct sockaddr *) &localaddr, flag_not), | ||
| 87 | - sizeof(local_addr)); | ||
| 88 | - else | ||
| 89 | - sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); | ||
| 90 | |||
| 91 | - if(!first) printf("\n"); | ||
| 92 | - if(first) | ||
| 93 | - printf("sctp "); | ||
| 94 | - else | ||
| 95 | - printf(" "); | ||
| 96 | - sprintf(buffer,"%s:%s", local_addr, local_port); | ||
| 97 | - printf("%-47s", buffer); | ||
| 98 | - printf(" %-12s", first?sctp_socket_state_str(state):""); | ||
| 99 | - first = 0; | ||
| 100 | - } | ||
| 101 | + const char *this_local_addr; | ||
| 102 | + int first=1; | ||
| 103 | + char local_port[16]; | ||
| 104 | + snprintf(local_port, sizeof(local_port), "%s", | ||
| 105 | + get_sname(htons(port), "sctp", flag_not & FLAG_NUM_PORT)); | ||
| 106 | + for(this_local_addr=strtok(laddrs_str," \t\n"); | ||
| 107 | + this_local_addr; | ||
| 108 | + this_local_addr=strtok(0," \t\n")) | ||
| 109 | + { | ||
| 110 | + char local_addr[64]; | ||
| 111 | + ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); | ||
| 112 | + if(ap) | ||
| 113 | + safe_strncpy(local_addr, | ||
| 114 | + ap->sprint((struct sockaddr *) &localaddr, flag_not), | ||
| 115 | + sizeof(local_addr)); | ||
| 116 | + else | ||
| 117 | + sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); | ||
| 118 | + | ||
| 119 | + if(!first) printf("\n"); | ||
| 120 | + if(first) | ||
| 121 | + printf("sctp "); | ||
| 122 | + else | ||
| 123 | + printf(" "); | ||
| 124 | + sprintf(buffer,"%s:%s", local_addr, local_port); | ||
| 125 | + printf("%-55s", buffer); | ||
| 126 | + printf(" %-12s", first?sctp_socket_state_str(state):""); | ||
| 127 | + first = 0; | ||
| 128 | } | ||
| 129 | - | ||
| 130 | finish_this_one(uid,inode,""); | ||
| 131 | } | ||
| 132 | |||
| 133 | @@ -1199,32 +1171,29 @@ static void sctp_assoc_do_one(int lnr, char *line) | ||
| 134 | const char *lport_str,*rport_str; | ||
| 135 | const char *uid_str; | ||
| 136 | const char *inode_str; | ||
| 137 | - const char *pladdr_str; | ||
| 138 | char *laddrs_str; | ||
| 139 | - const char *praddr_str; | ||
| 140 | char *raddrs_str; | ||
| 141 | - | ||
| 142 | + | ||
| 143 | if(lnr == 0) { | ||
| 144 | - /* ASSOC SOCK STY SST ST HBKT tx_queue rx_queue uid inode LPORT RPORT pladdr praddr LADDRS <-> RADDRS*/ | ||
| 145 | + /* ASSOC SOCK STY SST ST HBKT ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT RPORT LADDRS <-> RADDRS */ | ||
| 146 | return; | ||
| 147 | } | ||
| 148 | - | ||
| 149 | - strtok(line," \t\n"); /*skip ptr*/ | ||
| 150 | - strtok(0," \t\n"); /*skip ptr*/ | ||
| 151 | + | ||
| 152 | + strtok(line," \t\n"); /*skip assoc*/ | ||
| 153 | + strtok(0," \t\n"); /*skip sock*/ | ||
| 154 | sty_str = strtok(0," \t\n"); | ||
| 155 | sst_str = strtok(0," \t\n"); | ||
| 156 | st_str = strtok(0," \t\n"); | ||
| 157 | strtok(0," \t\n"); /*skip hash bucket*/ | ||
| 158 | + strtok(0," \t\n"); /*skip hash assoc-id*/ | ||
| 159 | txqueue_str = strtok(0," \t\n"); | ||
| 160 | rxqueue_str = strtok(0," \t\n"); | ||
| 161 | uid_str = strtok(0," \t\n"); | ||
| 162 | inode_str = strtok(0," \t\n"); | ||
| 163 | lport_str=strtok(0," \t\n"); | ||
| 164 | rport_str=strtok(0," \t\n"); | ||
| 165 | - pladdr_str = strtok(0," \t\n"); | ||
| 166 | - praddr_str = strtok(0," \t\n"); | ||
| 167 | - laddrs_str=strtok(0,"<->\t\n"); | ||
| 168 | - raddrs_str=strtok(0,"<->\t\n"); | ||
| 169 | + laddrs_str = strtok(0,"<->\t\n"); | ||
| 170 | + raddrs_str = strtok(0,"<->\t\n"); | ||
| 171 | |||
| 172 | type = atoi(sty_str); | ||
| 173 | state = atoi(sst_str); | ||
| 174 | @@ -1235,116 +1204,81 @@ static void sctp_assoc_do_one(int lnr, char *line) | ||
| 175 | inode = strtoul(inode_str,0,0); | ||
| 176 | lport = atoi(lport_str); | ||
| 177 | rport = atoi(rport_str); | ||
| 178 | - | ||
| 179 | - if(flag_sctp<=1) { | ||
| 180 | - /* only print the primary addresses */ | ||
| 181 | - char local_addr[64]; | ||
| 182 | - char local_port[16]; | ||
| 183 | - char remote_addr[64]; | ||
| 184 | - char remote_port[16]; | ||
| 185 | - | ||
| 186 | - ap = process_sctp_addr_str(pladdr_str, (struct sockaddr*)&localaddr); | ||
| 187 | - if(ap) | ||
| 188 | - safe_strncpy(local_addr, | ||
| 189 | - ap->sprint((struct sockaddr *) &localaddr, flag_not), | ||
| 190 | - sizeof(local_addr)); | ||
| 191 | - else | ||
| 192 | - sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); | ||
| 193 | - | ||
| 194 | - snprintf(local_port, sizeof(local_port), "%s", | ||
| 195 | - get_sname(htons(lport), "sctp", | ||
| 196 | - flag_not & FLAG_NUM_PORT)); | ||
| 197 | - | ||
| 198 | - ap = process_sctp_addr_str(praddr_str, (struct sockaddr*)&remoteaddr); | ||
| 199 | - if(ap) | ||
| 200 | - safe_strncpy(remote_addr, | ||
| 201 | - ap->sprint((struct sockaddr *) &remoteaddr, flag_not), | ||
| 202 | - sizeof(remote_addr)); | ||
| 203 | - else | ||
| 204 | - sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family); | ||
| 205 | - | ||
| 206 | - snprintf(remote_port, sizeof(remote_port), "%s", | ||
| 207 | - get_sname(htons(rport), "sctp", | ||
| 208 | - flag_not & FLAG_NUM_PORT)); | ||
| 209 | - | ||
| 210 | - printf("sctp"); | ||
| 211 | - printf(" %6u %6u ", rxqueue, txqueue); | ||
| 212 | - sprintf(buffer,"%s:%s", local_addr, local_port); | ||
| 213 | - printf("%-23s", buffer); | ||
| 214 | - printf(" "); | ||
| 215 | - sprintf(buffer,"%s:%s", remote_addr, remote_port); | ||
| 216 | - printf("%-23s", buffer); | ||
| 217 | - printf(" %-12s", sctp_socket_state_str(state)); | ||
| 218 | - } else { | ||
| 219 | - /*print all addresses*/ | ||
| 220 | - const char *this_local_addr; | ||
| 221 | - const char *this_remote_addr; | ||
| 222 | - char *ss1,*ss2; | ||
| 223 | - int first=1; | ||
| 224 | - char local_port[16]; | ||
| 225 | - char remote_port[16]; | ||
| 226 | - snprintf(local_port, sizeof(local_port), "%s", | ||
| 227 | - get_sname(htons(lport), "sctp", | ||
| 228 | - flag_not & FLAG_NUM_PORT)); | ||
| 229 | - snprintf(remote_port, sizeof(remote_port), "%s", | ||
| 230 | - get_sname(htons(rport), "sctp", | ||
| 231 | - flag_not & FLAG_NUM_PORT)); | ||
| 232 | - | ||
| 233 | - this_local_addr=strtok_r(laddrs_str," \t\n",&ss1); | ||
| 234 | - this_remote_addr=strtok_r(raddrs_str," \t\n",&ss2); | ||
| 235 | - while(this_local_addr || this_remote_addr) { | ||
| 236 | - char local_addr[64]; | ||
| 237 | - char remote_addr[64]; | ||
| 238 | - if(this_local_addr) { | ||
| 239 | - ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); | ||
| 240 | - if(ap) | ||
| 241 | - safe_strncpy(local_addr, | ||
| 242 | - ap->sprint((struct sockaddr *) &localaddr, flag_not), | ||
| 243 | - sizeof(local_addr)); | ||
| 244 | - else | ||
| 245 | - sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); | ||
| 246 | - } | ||
| 247 | - if(this_remote_addr) { | ||
| 248 | - ap = process_sctp_addr_str(this_remote_addr, (struct sockaddr*)&remoteaddr); | ||
| 249 | - if(ap) | ||
| 250 | - safe_strncpy(remote_addr, | ||
| 251 | - ap->sprint((struct sockaddr *) &remoteaddr, flag_not), | ||
| 252 | - sizeof(remote_addr)); | ||
| 253 | - else | ||
| 254 | - sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family); | ||
| 255 | - } | ||
| 256 | |||
| 257 | - if(!first) printf("\n"); | ||
| 258 | - if(first) | ||
| 259 | - printf("sctp %6u %6u ", rxqueue, txqueue); | ||
| 260 | - else | ||
| 261 | - printf(" "); | ||
| 262 | - if(this_local_addr) { | ||
| 263 | - if(first) | ||
| 264 | - sprintf(buffer,"%s:%s", local_addr, local_port); | ||
| 265 | + /*print all addresses*/ | ||
| 266 | + const char *this_local_addr; | ||
| 267 | + const char *this_remote_addr; | ||
| 268 | + char *ss1,*ss2; | ||
| 269 | + int first=1; | ||
| 270 | + char local_port[16]; | ||
| 271 | + char remote_port[16]; | ||
| 272 | + snprintf(local_port, sizeof(local_port), "%s", | ||
| 273 | + get_sname(htons(lport), "sctp", | ||
| 274 | + flag_not & FLAG_NUM_PORT)); | ||
| 275 | + snprintf(remote_port, sizeof(remote_port), "%s", | ||
| 276 | + get_sname(htons(rport), "sctp", | ||
| 277 | + flag_not & FLAG_NUM_PORT)); | ||
| 278 | + | ||
| 279 | + this_local_addr=strtok_r(laddrs_str," \t\n",&ss1); | ||
| 280 | + this_remote_addr=strtok_r(raddrs_str," \t\n",&ss2); | ||
| 281 | + while(this_local_addr || this_remote_addr) { | ||
| 282 | + char local_addr[64]; | ||
| 283 | + char remote_addr[64]; | ||
| 284 | + | ||
| 285 | + if(this_local_addr) { | ||
| 286 | + if (this_local_addr[0] == '*') { | ||
| 287 | + /* skip * */ | ||
| 288 | + this_local_addr++; | ||
| 289 | + } | ||
| 290 | + ap = process_sctp_addr_str(this_local_addr, (struct sockaddr*)&localaddr); | ||
| 291 | + if(ap) | ||
| 292 | + safe_strncpy(local_addr, | ||
| 293 | + ap->sprint((struct sockaddr *) &localaddr, flag_not), sizeof(local_addr)); | ||
| 294 | else | ||
| 295 | - sprintf(buffer,"%s", local_addr); | ||
| 296 | - printf("%-23s", buffer); | ||
| 297 | - } else | ||
| 298 | - printf("%-23s", ""); | ||
| 299 | - printf(" "); | ||
| 300 | - if(this_remote_addr) { | ||
| 301 | - if(first) | ||
| 302 | - sprintf(buffer,"%s:%s", remote_addr, remote_port); | ||
| 303 | + sprintf(local_addr,_("unsupported address family %d"), ((struct sockaddr*)&localaddr)->sa_family); | ||
| 304 | + } | ||
| 305 | + if(this_remote_addr) { | ||
| 306 | + if (this_remote_addr[0] == '*') { | ||
| 307 | + /* skip * */ | ||
| 308 | + this_remote_addr++; | ||
| 309 | + } | ||
| 310 | + ap = process_sctp_addr_str(this_remote_addr, (struct sockaddr*)&remoteaddr); | ||
| 311 | + if(ap) | ||
| 312 | + safe_strncpy(remote_addr, | ||
| 313 | + ap->sprint((struct sockaddr *) &remoteaddr, flag_not), sizeof(remote_addr)); | ||
| 314 | else | ||
| 315 | - sprintf(buffer,"%s", remote_addr); | ||
| 316 | - printf("%-23s", buffer); | ||
| 317 | - } else | ||
| 318 | - printf("%-23s", ""); | ||
| 319 | - | ||
| 320 | - printf(" %-12s", first?sctp_socket_state_str(state):""); | ||
| 321 | + sprintf(remote_addr,_("unsupported address family %d"), ((struct sockaddr*)&remoteaddr)->sa_family); | ||
| 322 | + } | ||
| 323 | |||
| 324 | - first = 0; | ||
| 325 | - this_local_addr=strtok_r(0," \t\n",&ss1); | ||
| 326 | - this_remote_addr=strtok_r(0," \t\n",&ss2); | ||
| 327 | - } | ||
| 328 | + if(!first) printf("\n"); | ||
| 329 | + if(first) | ||
| 330 | + printf("sctp %6u %6u ", rxqueue, txqueue); | ||
| 331 | + else | ||
| 332 | + printf(" "); | ||
| 333 | + if(this_local_addr) { | ||
| 334 | + if(first) | ||
| 335 | + sprintf(buffer,"%s:%s", local_addr, local_port); | ||
| 336 | + else | ||
| 337 | + sprintf(buffer,"%s", local_addr); | ||
| 338 | + printf("%-27s", buffer); | ||
| 339 | + } else | ||
| 340 | + printf("%-27s", ""); | ||
| 341 | + printf(" "); | ||
| 342 | + if(this_remote_addr) { | ||
| 343 | + if(first) | ||
| 344 | + sprintf(buffer,"%s:%s", remote_addr, remote_port); | ||
| 345 | + else | ||
| 346 | + sprintf(buffer,"%s", remote_addr); | ||
| 347 | + printf("%-27s", buffer); | ||
| 348 | + } else | ||
| 349 | + printf("%-27s", ""); | ||
| 350 | + | ||
| 351 | + printf(" %-12s", first?sctp_socket_state_str(state):""); | ||
| 352 | + | ||
| 353 | + first = 0; | ||
| 354 | + this_local_addr=strtok_r(0," \t\n",&ss1); | ||
| 355 | + this_remote_addr=strtok_r(0," \t\n",&ss2); | ||
| 356 | } | ||
| 357 | - | ||
| 358 | finish_this_one(uid,inode,""); | ||
| 359 | } | ||
| 360 | |||
| 361 | -- | ||
| 362 | 1.8.5.2.233.g932f7e4 | ||
| 363 | |||
diff --git a/meta/recipes-extended/net-tools/net-tools/net-tools-fix-building-with-linux-4.8.patch b/meta/recipes-extended/net-tools/net-tools/net-tools-fix-building-with-linux-4.8.patch deleted file mode 100644 index 505eeb048a..0000000000 --- a/meta/recipes-extended/net-tools/net-tools/net-tools-fix-building-with-linux-4.8.patch +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | From 4d56645ea144a34f7cdd3e3ede6452d81fbae251 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Randy MacLeod <Randy.MacLeod@windriver.com> | ||
| 3 | Date: Sat, 8 Oct 2016 14:42:54 +0800 | ||
| 4 | Subject: [PATCH] iptunnel.c: include linux/ip.h to fix building with linux-4.8 | ||
| 5 | |||
| 6 | Fix a build error when using the linux-4.8 headers that results in: | ||
| 7 | |||
| 8 | In file included from | ||
| 9 | .../sysroots/qemuarm64/usr/include/linux/if_tunnel.h:6:0, | ||
| 10 | from iptunnel.c:39: | ||
| 11 | .../qemuarm64/usr/include/linux/ip.h:85:8: error: redefinition of | ||
| 12 | 'struct iphdr' | ||
| 13 | struct iphdr { | ||
| 14 | ^~~~~ | ||
| 15 | In file included from iptunnel.c:29:0: | ||
| 16 | .../qemuarm64/usr/include/netinet/ip.h:44:8: note: originally defined here | ||
| 17 | struct iphdr | ||
| 18 | ^~~~~ | ||
| 19 | |||
| 20 | Upstream-Status: Submitted [1] | ||
| 21 | |||
| 22 | [1] https://sourceforge.net/p/net-tools/mailman/message/35413022/ | ||
| 23 | |||
| 24 | Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com> | ||
| 25 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
| 26 | --- | ||
| 27 | iptunnel.c | 2 +- | ||
| 28 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 29 | |||
| 30 | diff --git a/iptunnel.c b/iptunnel.c | ||
| 31 | index 4943d83..acfcbc7 100644 | ||
| 32 | --- a/iptunnel.c | ||
| 33 | +++ b/iptunnel.c | ||
| 34 | @@ -26,7 +26,6 @@ | ||
| 35 | #include <sys/socket.h> | ||
| 36 | #include <sys/ioctl.h> | ||
| 37 | #include <netinet/in.h> | ||
| 38 | -#include <netinet/ip.h> | ||
| 39 | #include <arpa/inet.h> | ||
| 40 | #if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)) | ||
| 41 | #include <net/if.h> | ||
| 42 | @@ -36,6 +35,7 @@ | ||
| 43 | #include <linux/if_arp.h> | ||
| 44 | #endif | ||
| 45 | #include <linux/types.h> | ||
| 46 | +#include <linux/ip.h> | ||
| 47 | #include <linux/if_tunnel.h> | ||
| 48 | |||
| 49 | #include "config.h" | ||
| 50 | -- | ||
| 51 | 2.8.3 | ||
| 52 | |||
diff --git a/meta/recipes-extended/net-tools/net-tools_1.60-20181103.bb b/meta/recipes-extended/net-tools/net-tools_1.60-20181103.bb new file mode 100644 index 0000000000..dcc2218e48 --- /dev/null +++ b/meta/recipes-extended/net-tools/net-tools_1.60-20181103.bb | |||
| @@ -0,0 +1,108 @@ | |||
| 1 | SUMMARY = "Basic networking tools" | ||
| 2 | DESCRIPTION = "A collection of programs that form the base set of the NET-3 networking distribution for the Linux operating system" | ||
| 3 | HOMEPAGE = "http://net-tools.berlios.de/" | ||
| 4 | BUGTRACKER = "http://bugs.debian.org/net-tools" | ||
| 5 | LICENSE = "GPLv2+" | ||
| 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ | ||
| 7 | file://ifconfig.c;beginline=11;endline=15;md5=d1ca372080ad5401e23ca0afc35cf9ba" | ||
| 8 | |||
| 9 | PV = "1.60-20181103+git${SRCPV}" | ||
| 10 | SRCREV = "0eebece8c964e3cfa8a018f42b2e7e751a7009a0" | ||
| 11 | SRC_URI = "git://git.code.sf.net/p/net-tools/code;protocol=https \ | ||
| 12 | file://net-tools-config.h \ | ||
| 13 | file://net-tools-config.make \ | ||
| 14 | file://Add_missing_headers.patch \ | ||
| 15 | file://Bug_443075-ifconfig.c-pointtopoint_spelling.patch \ | ||
| 16 | file://Bug_541172-netstat.c-exit-codes.patch \ | ||
| 17 | " | ||
| 18 | |||
| 19 | S = "${WORKDIR}/git" | ||
| 20 | |||
| 21 | inherit gettext | ||
| 22 | |||
| 23 | # The Makefile is lame, no parallel build | ||
| 24 | PARALLEL_MAKE = "" | ||
| 25 | |||
| 26 | PACKAGECONFIG ??= "hostname arp serial plip" | ||
| 27 | PACKAGECONFIG[hostname] = "" | ||
| 28 | PACKAGECONFIG[arp] = "" | ||
| 29 | PACKAGECONFIG[serial] = "" | ||
| 30 | PACKAGECONFIG[plip] = "" | ||
| 31 | |||
| 32 | do_configure() { | ||
| 33 | # net-tools has its own config mechanism requiring "make config" | ||
| 34 | # we pre-generate desired options and copy to source directory instead | ||
| 35 | cp ${WORKDIR}/net-tools-config.h ${S}/config.h | ||
| 36 | cp ${WORKDIR}/net-tools-config.make ${S}/config.make | ||
| 37 | |||
| 38 | if [ "${USE_NLS}" = "no" ]; then | ||
| 39 | sed -i -e 's/^I18N=1/# I18N=1/' ${S}/config.make | ||
| 40 | fi | ||
| 41 | |||
| 42 | if ${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'true', 'false', d)} ; then | ||
| 43 | echo "#define HAVE_HOSTNAME_TOOLS 1" >> ${S}/config.h | ||
| 44 | echo "#define HAVE_HOSTNAME_SYMLINKS 1" >> ${S}/config.h | ||
| 45 | echo "HAVE_HOSTNAME_TOOLS=1" >> ${S}/config.make | ||
| 46 | echo "HAVE_HOSTNAME_SYMLINKS=1" >> ${S}/config.make | ||
| 47 | fi | ||
| 48 | if ${@bb.utils.contains('PACKAGECONFIG', 'arp', 'true', 'false', d)} ; then | ||
| 49 | echo "#define HAVE_ARP_TOOLS 1" >> ${S}/config.h | ||
| 50 | echo "HAVE_ARP_TOOLS=1" >> ${S}/config.make | ||
| 51 | fi | ||
| 52 | if ${@bb.utils.contains('PACKAGECONFIG', 'serial', 'true', 'false', d)} ; then | ||
| 53 | echo "#define HAVE_SERIAL_TOOLS 1" >> ${S}/config.h | ||
| 54 | echo "HAVE_SERIAL_TOOLS=1" >> ${S}/config.make | ||
| 55 | fi | ||
| 56 | if ${@bb.utils.contains('PACKAGECONFIG', 'plip', 'true', 'false', d)} ; then | ||
| 57 | echo "#define HAVE_PLIP_TOOLS 1" >> ${S}/config.h | ||
| 58 | echo "HAVE_PLIP_TOOLS=1" >> ${S}/config.make | ||
| 59 | fi | ||
| 60 | } | ||
| 61 | |||
| 62 | do_compile() { | ||
| 63 | # net-tools use COPTS/LOPTS to allow adding custom options | ||
| 64 | oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS" | ||
| 65 | } | ||
| 66 | |||
| 67 | do_install() { | ||
| 68 | # We don't need COPTS or LOPTS, but let's be consistent. | ||
| 69 | oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS" BASEDIR=${D} INSTALLNLSDIR=${D}${datadir}/locale mandir=${mandir} install | ||
| 70 | |||
| 71 | if [ "${base_bindir}" != "/bin" ]; then | ||
| 72 | mkdir -p ${D}/${base_bindir} | ||
| 73 | mv ${D}/bin/* ${D}/${base_bindir}/ | ||
| 74 | rmdir ${D}/bin | ||
| 75 | fi | ||
| 76 | if [ "${base_sbindir}" != "/sbin" ]; then | ||
| 77 | mkdir ${D}/${base_sbindir} | ||
| 78 | mv ${D}/sbin/* ${D}/${base_sbindir}/ | ||
| 79 | rmdir ${D}/sbin | ||
| 80 | fi | ||
| 81 | } | ||
| 82 | |||
| 83 | inherit update-alternatives | ||
| 84 | |||
| 85 | base_sbindir_progs = "ipmaddr iptunnel mii-tool nameif \ | ||
| 86 | ${@bb.utils.contains('PACKAGECONFIG', 'arp', 'arp rarp', '', d)} \ | ||
| 87 | ${@bb.utils.contains('PACKAGECONFIG', 'plip', 'plipconfig', '', d)} \ | ||
| 88 | ${@bb.utils.contains('PACKAGECONFIG', 'serial', 'slattach', '', d)} \ | ||
| 89 | " | ||
| 90 | base_bindir_progs = "ifconfig netstat route \ | ||
| 91 | ${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'dnsdomainname domainname hostname nisdomainname ypdomainname', '', d)} \ | ||
| 92 | " | ||
| 93 | |||
| 94 | ALTERNATIVE_${PN} = "${base_sbindir_progs} ${base_bindir_progs}" | ||
| 95 | ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'hostname', 'hostname.1 dnsdomainname.1', '', d)}" | ||
| 96 | ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1" | ||
| 97 | ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1" | ||
| 98 | ALTERNATIVE_PRIORITY[hostname.1] = "10" | ||
| 99 | |||
| 100 | python __anonymous() { | ||
| 101 | for prog in d.getVar('base_sbindir_progs').split(): | ||
| 102 | d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir'), prog)) | ||
| 103 | for prog in d.getVar('base_bindir_progs').split(): | ||
| 104 | d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog)) | ||
| 105 | } | ||
| 106 | ALTERNATIVE_PRIORITY = "100" | ||
| 107 | |||
| 108 | BBCLASSEXTEND = "native nativesdk" | ||
diff --git a/meta/recipes-extended/net-tools/net-tools_1.60-26.bb b/meta/recipes-extended/net-tools/net-tools_1.60-26.bb deleted file mode 100644 index 8bd30fc6d9..0000000000 --- a/meta/recipes-extended/net-tools/net-tools_1.60-26.bb +++ /dev/null | |||
| @@ -1,132 +0,0 @@ | |||
| 1 | SUMMARY = "Basic networking tools" | ||
| 2 | DESCRIPTION = "A collection of programs that form the base set of the NET-3 networking distribution for the Linux operating system" | ||
| 3 | HOMEPAGE = "http://net-tools.berlios.de/" | ||
| 4 | BUGTRACKER = "http://bugs.debian.org/net-tools" | ||
| 5 | LICENSE = "GPLv2+" | ||
| 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \ | ||
| 7 | file://ifconfig.c;beginline=11;endline=15;md5=d1ca372080ad5401e23ca0afc35cf9ba" | ||
| 8 | |||
| 9 | SRC_URI = "http://snapshot.debian.org/archive/debian/20050312T000000Z/pool/main/n/${BPN}/${BPN}_1.60.orig.tar.gz;name=tarball \ | ||
| 10 | http://snapshot.debian.org/archive/debian//20150831T093342Z/pool/main/n/${BPN}/${BPN}_${PV}.diff.gz;apply=no;name=patch \ | ||
| 11 | file://net-tools-config.h \ | ||
| 12 | file://net-tools-config.make \ | ||
| 13 | file://ifconfig-interface-0-del-IP-will-remove-the-aliased-.patch \ | ||
| 14 | file://musl-fixes.patch \ | ||
| 15 | file://net-tools-1.60-sctp1.patch \ | ||
| 16 | file://net-tools-1.60-sctp2-quiet.patch \ | ||
| 17 | file://net-tools-1.60-sctp3-addrs.patch \ | ||
| 18 | file://0001-lib-inet6.c-INET6_rresolve-various-fixes.patch \ | ||
| 19 | file://net-tools-fix-building-with-linux-4.8.patch \ | ||
| 20 | file://0001-added-ull-prefix-to-unsigned-long-long-constants-to-.patch \ | ||
| 21 | " | ||
| 22 | |||
| 23 | # for this package we're mostly interested in tracking debian patches, | ||
| 24 | # and not in the upstream version where all development has effectively stopped | ||
| 25 | UPSTREAM_CHECK_REGEX = "(?P<pver>((\d+\.*)+)-((\d+\.*)+))\.(diff|debian\.tar)\.(gz|xz)" | ||
| 26 | |||
| 27 | S = "${WORKDIR}/net-tools-1.60" | ||
| 28 | |||
| 29 | SRC_URI[tarball.md5sum] = "ecaf37acb5b5daff4bdda77785fd916d" | ||
| 30 | SRC_URI[tarball.sha256sum] = "ec67967cf7b1a3a3828a84762fbc013ac50ee5dc9aa3095d5c591f302c2de0f5" | ||
| 31 | |||
| 32 | SRC_URI[patch.md5sum] = "ea3592f49ac8380962bc4d9b66c7e7e9" | ||
| 33 | SRC_URI[patch.sha256sum] = "aeeeafaff68866a446f01bb639d4e0146a60af34dcd20e31a3e46585022fc76c" | ||
| 34 | |||
| 35 | # the package is taken from snapshots.debian.org; that source is static and goes stale | ||
| 36 | # so we check the latest upstream from a directory that does get updated | ||
| 37 | UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/n/net-tools/" | ||
| 38 | |||
| 39 | inherit gettext | ||
| 40 | |||
| 41 | do_patch[depends] += "quilt-native:do_populate_sysroot" | ||
| 42 | |||
| 43 | # The Makefile is lame, no parallel build | ||
| 44 | PARALLEL_MAKE = "" | ||
| 45 | |||
| 46 | # Unlike other Debian packages, net-tools *.diff.gz contains another series of | ||
| 47 | # patches maintained by quilt. So manually apply them before applying other local | ||
| 48 | # patches. Also remove all temp files before leaving, because do_patch() will pop | ||
| 49 | # up all previously applied patches in the start | ||
| 50 | nettools_do_patch() { | ||
| 51 | cd ${S} | ||
| 52 | # it's important that we only pop the existing patches when they've | ||
| 53 | # been applied, otherwise quilt will climb the directory tree | ||
| 54 | # and reverse out some completely different set of patches | ||
| 55 | if [ -d ${S}/patches ]; then | ||
| 56 | # whilst this is the default directory, doing it like this | ||
| 57 | # defeats the directory climbing that quilt will otherwise | ||
| 58 | # do; note the directory must exist to defeat this, hence | ||
| 59 | # the test inside which we operate | ||
| 60 | QUILT_PATCHES=${S}/patches quilt pop -a | ||
| 61 | fi | ||
| 62 | if [ -d ${S}/.pc-nettools ]; then | ||
| 63 | rm -rf ${S}/.pc | ||
| 64 | mv ${S}/.pc-nettools ${S}/.pc | ||
| 65 | QUILT_PATCHES=${S}/debian/patches quilt pop -a | ||
| 66 | rm -rf ${S}/.pc ${S}/debian | ||
| 67 | fi | ||
| 68 | patch -p1 < ${WORKDIR}/${BPN}_${PV}.diff | ||
| 69 | QUILT_PATCHES=${S}/debian/patches quilt push -a | ||
| 70 | mv ${S}/.pc ${S}/.pc-nettools | ||
| 71 | } | ||
| 72 | |||
| 73 | do_unpack[cleandirs] += "${S}" | ||
| 74 | |||
| 75 | # We invoke base do_patch at end, to incorporate any local patch | ||
| 76 | python do_patch() { | ||
| 77 | bb.build.exec_func('nettools_do_patch', d) | ||
| 78 | bb.build.exec_func('patch_do_patch', d) | ||
| 79 | } | ||
| 80 | |||
| 81 | do_configure() { | ||
| 82 | # net-tools has its own config mechanism requiring "make config" | ||
| 83 | # we pre-generate desired options and copy to source directory instead | ||
| 84 | cp ${WORKDIR}/net-tools-config.h ${S}/config.h | ||
| 85 | cp ${WORKDIR}/net-tools-config.make ${S}/config.make | ||
| 86 | |||
| 87 | if [ "${USE_NLS}" = "no" ]; then | ||
| 88 | sed -i -e 's/^I18N=1/# I18N=1/' ${S}/config.make | ||
| 89 | fi | ||
| 90 | } | ||
| 91 | |||
| 92 | do_compile() { | ||
| 93 | # net-tools use COPTS/LOPTS to allow adding custom options | ||
| 94 | oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS" | ||
| 95 | } | ||
| 96 | |||
| 97 | do_install() { | ||
| 98 | # We don't need COPTS or LOPTS, but let's be consistent. | ||
| 99 | oe_runmake COPTS="$CFLAGS" LOPTS="$LDFLAGS" BASEDIR=${D} INSTALLNLSDIR=${D}${datadir}/locale mandir=${mandir} install | ||
| 100 | |||
| 101 | if [ "${base_bindir}" != "/bin" ]; then | ||
| 102 | mkdir -p ${D}/${base_bindir} | ||
| 103 | mv ${D}/bin/* ${D}/${base_bindir}/ | ||
| 104 | rmdir ${D}/bin | ||
| 105 | fi | ||
| 106 | if [ "${base_sbindir}" != "/sbin" ]; then | ||
| 107 | mkdir ${D}/${base_sbindir} | ||
| 108 | mv ${D}/sbin/* ${D}/${base_sbindir}/ | ||
| 109 | rmdir ${D}/sbin | ||
| 110 | fi | ||
| 111 | } | ||
| 112 | |||
| 113 | inherit update-alternatives | ||
| 114 | |||
| 115 | base_sbindir_progs = "arp ifconfig ipmaddr iptunnel mii-tool nameif plipconfig rarp route slattach" | ||
| 116 | base_bindir_progs = "dnsdomainname domainname hostname netstat nisdomainname ypdomainname" | ||
| 117 | |||
| 118 | ALTERNATIVE_${PN} = "${base_sbindir_progs} ${base_bindir_progs}" | ||
| 119 | ALTERNATIVE_${PN}-doc += "hostname.1 dnsdomainname.1" | ||
| 120 | ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1" | ||
| 121 | ALTERNATIVE_LINK_NAME[dnsdomainname.1] = "${mandir}/man1/dnsdomainname.1" | ||
| 122 | ALTERNATIVE_PRIORITY[hostname.1] = "10" | ||
| 123 | |||
| 124 | python __anonymous() { | ||
| 125 | for prog in d.getVar('base_sbindir_progs').split(): | ||
| 126 | d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_sbindir'), prog)) | ||
| 127 | for prog in d.getVar('base_bindir_progs').split(): | ||
| 128 | d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog)) | ||
| 129 | } | ||
| 130 | ALTERNATIVE_PRIORITY = "100" | ||
| 131 | |||
| 132 | BBCLASSEXTEND = "native nativesdk" | ||
