From e75b76be08bcae5b8c06928868d7e5c3ba8989c65174aab1ade72bac1763f6d8 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Thu, 17 Sep 2009 00:31:03 +0000 Subject: [PATCH] Updating link to change in openSUSE:Factory/net-tools revision 21.0 OBS-URL: https://build.opensuse.org/package/show/network:utilities/net-tools?expand=0&rev=2dfb87e6cfa2157786e45e88dd80eb8c --- net-tools-1.60-ifindex.diff | 11 ++ net-tools-1.60-infiniband.diff | 202 ++++++++++++++++++++ net-tools-1.60-ipv6-statistics.diff | 281 ++++++++++++++++++++++++++++ net-tools.changes | 7 + net-tools.spec | 9 +- 5 files changed, 508 insertions(+), 2 deletions(-) create mode 100644 net-tools-1.60-ifindex.diff create mode 100644 net-tools-1.60-infiniband.diff create mode 100644 net-tools-1.60-ipv6-statistics.diff diff --git a/net-tools-1.60-ifindex.diff b/net-tools-1.60-ifindex.diff new file mode 100644 index 0000000..9388008 --- /dev/null +++ b/net-tools-1.60-ifindex.diff @@ -0,0 +1,11 @@ +--- lib/interface.c 2007-06-18 13:51:41.000000000 -0400 ++++ lib/interface.c 2007-06-18 13:52:04.000000000 -0400 +@@ -718,7 +718,7 @@ + /* FIXME: should be integrated into interface.c. */ + + if ((f = fopen(_PATH_PROCNET_IFINET6, "r")) != NULL) { +- while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n", ++ while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %08x %02x %02x %02x %20s\n", + addr6p[0], addr6p[1], addr6p[2], addr6p[3], + addr6p[4], addr6p[5], addr6p[6], addr6p[7], + &if_idx, &plen, &scope, &dad_status, devname) != EOF) { diff --git a/net-tools-1.60-infiniband.diff b/net-tools-1.60-infiniband.diff new file mode 100644 index 0000000..9b39b24 --- /dev/null +++ b/net-tools-1.60-infiniband.diff @@ -0,0 +1,202 @@ +--- config.in 2000-05-21 07:32:12.000000000 -0700 ++++ config.in 2005-02-07 10:45:14.108286619 -0800 +@@ -82,6 +82,7 @@ + bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB n + bool 'IrDA support' HAVE_HWIRDA y + bool 'Econet hardware support' HAVE_HWEC n ++bool 'InfiniBand hardware support' HAVE_HWIB y + * + * + * Other Features. +--- lib/hw.c 2000-05-20 11:27:25.000000000 -0700 ++++ lib/hw.c 2005-02-07 09:56:22.315428035 -0800 +@@ -73,6 +73,8 @@ + + extern struct hwtype ec_hwtype; + ++extern struct hwtype ib_hwtype; ++ + static struct hwtype *hwtypes[] = + { + +@@ -144,6 +146,9 @@ + #if HAVE_HWX25 + &x25_hwtype, + #endif ++#if HAVE_HWIB ++ &ib_hwtype, ++#endif + &unspec_hwtype, + NULL + }; +@@ -217,6 +222,9 @@ + #if HAVE_HWEC + ec_hwtype.title = _("Econet"); + #endif ++#if HAVE_HWIB ++ ib_hwtype.title = _("InfiniBand"); ++#endif + sVhwinit = 1; + } + +--- lib/ib.c 1969-12-31 16:00:00.000000000 -0800 ++++ lib/ib.c 2005-02-07 12:55:04.635559244 -0800 +@@ -0,0 +1,147 @@ ++/* ++ * lib/ib.c This file contains an implementation of the "Infiniband" ++ * support functions. ++ * ++ * Version: $Id: ib.c,v 1.1 2005/02/06 11:00:47 tduffy Exp $ ++ * ++ * Author: Fred N. van Kempen, ++ * Copyright 1993 MicroWalt Corporation ++ * Tom Duffy ++ * ++ * This program is free software; you can redistribute it ++ * and/or modify it under the terms of the GNU General ++ * Public License as published by the Free Software ++ * Foundation; either version 2 of the License, or (at ++ * your option) any later version. ++ */ ++#include "config.h" ++ ++#if HAVE_HWIB ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "net-support.h" ++#include "pathnames.h" ++#include "intl.h" ++#include "util.h" ++ ++extern struct hwtype ib_hwtype; ++ ++ ++/* Display an InfiniBand address in readable format. */ ++static char *pr_ib(unsigned char *ptr) ++{ ++ static char buff[128]; ++ char *pos; ++ unsigned int i; ++ ++ pos = buff; ++ for (i = 0; i < INFINIBAND_ALEN; i++) { ++ pos += sprintf(pos, "%02X:", (*ptr++ & 0377)); ++ } ++ buff[strlen(buff) - 1] = '\0'; ++ ++ /* snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X", ++ (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377), ++ (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377) ++ ); ++ */ ++ return (buff); ++} ++ ++ ++/* Input an Infiniband address and convert to binary. */ ++static int in_ib(char *bufp, struct sockaddr *sap) ++{ ++ unsigned char *ptr; ++ char c, *orig; ++ int i; ++ unsigned val; ++ ++ sap->sa_family = ib_hwtype.type; ++ ptr = sap->sa_data; ++ ++ i = 0; ++ orig = bufp; ++ while ((*bufp != '\0') && (i < INFINIBAND_ALEN)) { ++ val = 0; ++ c = *bufp++; ++ if (isdigit(c)) ++ val = c - '0'; ++ else if (c >= 'a' && c <= 'f') ++ val = c - 'a' + 10; ++ else if (c >= 'A' && c <= 'F') ++ val = c - 'A' + 10; ++ else { ++#ifdef DEBUG ++ fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig); ++#endif ++ errno = EINVAL; ++ return (-1); ++ } ++ val <<= 4; ++ c = *bufp; ++ if (isdigit(c)) ++ val |= c - '0'; ++ else if (c >= 'a' && c <= 'f') ++ val |= c - 'a' + 10; ++ else if (c >= 'A' && c <= 'F') ++ val |= c - 'A' + 10; ++ else if (c == ':' || c == 0) ++ val >>= 4; ++ else { ++#ifdef DEBUG ++ fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig); ++#endif ++ errno = EINVAL; ++ return (-1); ++ } ++ if (c != 0) ++ bufp++; ++ *ptr++ = (unsigned char) (val & 0377); ++ i++; ++ ++ /* We might get a semicolon here - not required. */ ++ if (*bufp == ':') { ++ if (i == INFINIBAND_ALEN) { ++#ifdef DEBUG ++ fprintf(stderr, _("in_ib(%s): trailing : ignored!\n"), ++ orig) ++#endif ++ ; /* nothing */ ++ } ++ bufp++; ++ } ++ } ++ ++ /* That's it. Any trailing junk? */ ++ if ((i == INFINIBAND_ALEN) && (*bufp != '\0')) { ++#ifdef DEBUG ++ fprintf(stderr, _("in_ib(%s): trailing junk!\n"), orig); ++ errno = EINVAL; ++ return (-1); ++#endif ++ } ++#ifdef DEBUG ++ fprintf(stderr, "in_ib(%s): %s\n", orig, pr_ib(sap->sa_data)); ++#endif ++ ++ return (0); ++} ++ ++ ++struct hwtype ib_hwtype = ++{ ++ "infiniband", NULL, ARPHRD_INFINIBAND, INFINIBAND_ALEN, ++ pr_ib, in_ib, NULL ++}; ++ ++ ++#endif /* HAVE_HWETHER */ +--- lib/Makefile 2000-10-28 03:59:42.000000000 -0700 ++++ lib/Makefile 2005-02-07 10:02:14.662640164 -0800 +@@ -16,7 +16,7 @@ + # + + +-HWOBJS = hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o strip.o irda.o ec_hw.o x25.o ++HWOBJS = hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o strip.o irda.o ec_hw.o x25.o ib.o + AFOBJS = unix.o inet.o inet6.o ax25.o ipx.o ddp.o ipx.o netrom.o af.o rose.o econet.o x25.o + AFGROBJS = inet_gr.o inet6_gr.o ipx_gr.o ddp_gr.o netrom_gr.o ax25_gr.o rose_gr.o getroute.o x25_gr.o + AFSROBJS = inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o x25_sr.o diff --git a/net-tools-1.60-ipv6-statistics.diff b/net-tools-1.60-ipv6-statistics.diff new file mode 100644 index 0000000..ae6c967 --- /dev/null +++ b/net-tools-1.60-ipv6-statistics.diff @@ -0,0 +1,281 @@ +--- netstat.c.ms 2009-09-14 10:47:30.000000000 +0200 ++++ netstat.c 2009-09-14 10:47:37.000000000 +0200 +@@ -105,6 +105,8 @@ + /* prototypes for statistics.c */ + void parsesnmp(int, int, int, int); + void inittab(void); ++void parsesnmp6(int, int, int, int); ++void inittab6(void); + + typedef enum { + SS_FREE = 0, /* not allocated */ +@@ -2183,9 +2185,28 @@ + } + + if (flag_sta) { +- inittab(); +- parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp); +- exit(0); ++ char *tmp1, *tmp2; ++ char buf[256]; ++ if (!afname[0]) { ++ inittab(); ++ parsesnmp(flag_raw, flag_tcp, flag_udp, flag_sctp); ++ } else { ++ safe_strncpy(buf, afname, sizeof(buf)); ++ tmp1 = buf; ++ if ((tmp2 = index(tmp1, ','))) { ++ printf("Multiple interface\n"); ++ } else if(!strncmp(buf,"inet6",5)) { ++#if HAVE_AFINET6 ++ inittab6(); ++ parsesnmp6(flag_raw, flag_tcp, flag_udp, flag_sctp); ++#else ++ printf("Address type not supported for stats\n"); ++#endif ++ } else { ++ printf("Address type not supported for stats\n"); ++ } ++ } ++ exit(1); + } + + if (flag_rou) { +--- statistics.c.ms 2009-09-14 10:47:18.000000000 +0200 ++++ statistics.c 2009-09-14 10:49:26.000000000 +0200 +@@ -83,6 +83,32 @@ + {"FragCreates", N_("%lu fragments created"), opt_number} + }; + ++struct entry Ip6tab[] = ++{ ++ {"Ip6InReceives", N_("%u total packets received"), number}, ++ {"Ip6InHdrErrors", N_("%u with invalid headers"), opt_number}, ++ {"Ip6InTooBigErrors", N_("%u with packets too big"), opt_number}, ++ {"Ip6InNoRoutes", N_("%u incoming packets with no route"), opt_number}, ++ {"Ip6InAddrErrors", N_("%u with invalid addresses"), opt_number}, ++ {"Ip6InUnknownProtos", N_("%u with unknown protocol"), opt_number}, ++ {"Ip6InTruncatedPkts", N_("%u with truncated packets"), opt_number}, ++ {"Ip6InDiscards", N_("%u incoming packets discarded"), number}, ++ {"Ip6InDelivers", N_("%u incoming packets delivered"), number}, ++ {"Ip6OutForwDatagrams", N_("%u forwarded"), number}, ++ {"Ip6OutRequests", N_("%u requests sent out"), number}, /*? */ ++ {"Ip6OutDiscards", N_("%u outgoing packets dropped"), opt_number}, ++ {"Ip6OutNoRoutes", N_("%u dropped because of missing route"), opt_number}, ++ {"Ip6ReasmTimeout", N_("%u fragments dropped after timeout"), opt_number}, ++ {"Ip6ReasmReqds", N_("%u reassemblies required"), opt_number}, /* ? */ ++ {"Ip6ReasmOKs", N_("%u packets reassembled ok"), opt_number}, ++ {"Ip6ReasmFails", N_("%u packet reassembles failed"), opt_number}, ++ {"Ip6FragOKs", N_("%u fragments received ok"), opt_number}, ++ {"Ip6FragFails", N_("%u fragments failed"), opt_number}, ++ {"Ip6FragCreates", N_("%u fragments created"), opt_number}, ++ {"Ip6InMcastPkts", N_("%u incoming multicast packets"), opt_number}, ++ {"Ip6OutMcastPkts", N_("%u outgoing multicast packets"), opt_number} ++}; ++ + struct entry Icmptab[] = + { + {"InMsgs", N_("%lu ICMP messages received"), number}, +@@ -113,6 +139,41 @@ + {"OutAddrMaskReps", N_("address mask replies: %lu"), i_outp_icmp | I_TITLE}, + }; + ++struct entry Icmp6tab[] = ++{ ++ {"Icmp6InMsgs", N_("%u ICMP messages received"), number}, ++ {"Icmp6InErrors", N_("%u input ICMP message failed."), number}, ++ {"Icmp6InDestUnreachs", N_("destination unreachable: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InPktTooBigs", N_("packets too big: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InTimeExcds", N_("received ICMPv6 time exceeded: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InParmProblems", N_("parameter problem: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InEchos", N_("echo requests: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InEchoReplies", N_("echo replies: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InGroupMembQueries", N_("group member queries: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InGroupMembResponses", N_("group member responses: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InGroupMembReductions", N_("group member reductions: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InRouterSolicits", N_("router solicits: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InRouterAdvertisements", N_("router advertisement: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InNeighborSolicits", N_("neighbour solicits: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InNeighborAdvertisements", N_("neighbour advertisement: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6InRedirects", N_("redirects: %u"), i_inp_icmp | I_TITLE}, ++ {"Icmp6OutMsgs", N_("%u ICMP messages sent"), number}, ++ {"Icmp6OutDestUnreachs", N_("destination unreachable: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutPktTooBigs", N_("packets too big: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutTimeExcds", N_("sent ICMPv6 time exceeded: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutParmProblems", N_("parameter problem: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutEchos", N_("echo requests: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutEchoReplies", N_("echo replies: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutGroupMembQueries", N_("group member queries: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutGroupMembResponses", N_("group member responses: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutGroupMembReductions", N_("group member reductions: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutRouterSolicits", N_("router solicits: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutRouterAdvertisements ", N_("router advertisement: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutNeighborSolicits", N_("neighbor solicits: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutNeighborAdvertisements", N_("neighbor advertisements: %u"), i_outp_icmp | I_TITLE}, ++ {"Icmp6OutRedirects", N_("redirects: %u"), i_outp_icmp | I_TITLE}, ++}; ++ + struct entry Tcptab[] = + { + {"RtoAlgorithm", N_("RTO algorithm is %s"), i_rto_alg | I_STATIC}, +@@ -139,6 +200,14 @@ + {"OutDatagrams", N_("%lu packets sent"), number}, + }; + ++struct entry Udp6tab[] = ++{ ++ {"Udp6InDatagrams", N_("%u packets received"), number}, ++ {"Udp6NoPorts", N_("%u packets to unknown port received."), number}, ++ {"Udp6InErrors", N_("%u packet receive errors"), number}, ++ {"Udp6OutDatagrams", N_("%u packets sent"), number}, ++}; ++ + struct entry Tcpexttab[] = + { + {"SyncookiesSent", N_("%lu SYN cookies sent"), opt_number}, +@@ -226,6 +295,15 @@ + {NULL} + }; + ++struct tabtab snmp6tabs[] = ++{ ++ {"Ip6", Ip6tab, sizeof(Ip6tab), &f_raw}, ++ {"Icmp6", Icmp6tab, sizeof(Icmp6tab), &f_raw}, ++ {"Udp6", Udp6tab, sizeof(Udp6tab), &f_udp}, ++ {"Tcp6", Tcptab, sizeof(Tcptab), &f_tcp}, ++ {NULL} ++}; ++ + /* XXX IGMP */ + + int cmpentries(const void *a, const void *b) +@@ -311,7 +389,7 @@ + return &dummytab; + } + +-void process_fd(FILE *f) ++void process_fd(FILE *f, int all, char *filter) + { + char buf1[8192], buf2[8192]; + char *sp, *np, *p; +@@ -327,6 +405,12 @@ + goto formaterr; + *sp = '\0'; + ++ if (!all) { ++ if (strncmp(buf1, filter, strlen(filter))) { ++ continue; ++ } ++ } ++ + tab = newtable(snmptabs, buf1); + if (tab == NULL) { + printf("unknown %s\n", buf1); +@@ -387,6 +471,40 @@ + return; + } + ++void cpytitle(char *original, char *new) ++{ ++ char *ptr = original; ++ while(*ptr != '6' && *ptr != '\0') { ++ *new = *ptr; ++ new++; ++ ptr++; ++ } ++ *new = *ptr; ++ new++; ++ *new = '\0'; ++} ++ ++void process6_fd(FILE *f) ++{ ++ char buf1[1024],buf2[50],buf3[1024]; ++ unsigned long val; ++ struct tabtab *tab = NULL; ++ int cpflg = 0; ++ ++ while (fgets(buf1, sizeof buf1, f)) { ++ sscanf(buf1, "%s %lu", buf2, &val); ++ if(!cpflg) { ++ cpytitle(buf2, buf3); ++ tab = newtable(snmp6tabs, buf3); ++ cpflg = 1; ++ } ++ if(!strstr(buf2, buf3)) { ++ cpytitle(buf2, buf3); ++ tab = newtable(snmp6tabs, buf3); ++ } ++ printval(tab, buf2, val); ++ } ++} + + void parsesnmp(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp) + { +@@ -399,7 +517,7 @@ + perror(_("cannot open /proc/net/snmp")); + return; + } +- process_fd(f); ++ process_fd(f, 1, NULL); + + if (ferror(f)) + perror("/proc/net/snmp"); +@@ -409,7 +527,7 @@ + f = fopen("/proc/net/netstat", "r"); + + if (f) { +- process_fd(f); ++ process_fd(f, 1, NULL); + + if (ferror(f)) + perror("/proc/net/netstat"); +@@ -429,7 +547,33 @@ + + return; + } +- ++ ++void parsesnmp6(int flag_raw, int flag_tcp, int flag_udp, int flag_sctp) ++{ ++ FILE *f; ++ ++ f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp, f_sctp = flag_sctp; ++ ++ f = fopen("/proc/net/snmp6", "r"); ++ if (!f) { ++ perror(_("cannot open /proc/net/snmp6")); ++ return; ++ } ++ process6_fd(f); ++ if (ferror(f)) ++ perror("/proc/net/snmp6"); ++ ++ fclose(f); ++ f = fopen("/proc/net/snmp", "r"); ++ if (!f) { ++ perror(_("cannot open /proc/net/snmp")); ++ return; ++ } ++ process_fd(f, 0, "Tcp"); ++ if (ferror(f)) ++ perror("/proc/net/snmp"); ++ fclose(f); ++} + + void inittab(void) + { +@@ -440,3 +584,13 @@ + qsort(t->tab, t->size / sizeof(struct entry), + sizeof(struct entry), cmpentries); + } ++ ++void inittab6(void) ++{ ++ struct tabtab *t; ++ ++ for (t = snmp6tabs; t->title; t++) ++ qsort(t->tab, t->size / sizeof(struct entry), ++ sizeof(struct entry), cmpentries); ++} ++ diff --git a/net-tools.changes b/net-tools.changes index 3363cef..33820c6 100644 --- a/net-tools.changes +++ b/net-tools.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 14 11:04:16 CEST 2009 - ms@suse.de + +- added support for IPV6 statistics (bnc #537904) +- fixed interface address field length (bnc #537904) +- added support for infiniband IPoIB devices (bnc #537904) + ------------------------------------------------------------------- Wed Aug 12 10:38:32 CEST 2009 - ms@suse.de diff --git a/net-tools.spec b/net-tools.spec index 1a2fd82..01bb8ff 100644 --- a/net-tools.spec +++ b/net-tools.spec @@ -24,11 +24,10 @@ License: GPL v2 or later Group: Productivity/Networking/Other Provides: traceroute net_tool Provides: iputils:/usr/sbin/traceroute6 -Provides: iputils:/usr/share/man/man8/traceroute6.1.gz Obsoletes: traceroute net_tool AutoReqProv: on Version: 1.60 -Release: 731 +Release: 732 Summary: Important Programs for Networking BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: net-tools-%{version}.tar.bz2 @@ -73,6 +72,9 @@ Patch37: traceroute-glibc210.diff #Patch38: net-tools-1.60-obsolete.diff Patch39: net-tools-1.60-fclose.diff Patch40: net-tools-1.60-notrim.diff +Patch41: net-tools-1.60-ipv6-statistics.diff +Patch42: net-tools-1.60-ifindex.diff +Patch43: net-tools-1.60-infiniband.diff %description This package contains essential programs for network administration and @@ -131,6 +133,9 @@ cd .. #%patch38 -p1 %patch39 -p1 %patch40 -p1 +%patch41 +%patch42 +%patch43 %build make config