diff --git a/net-tools-1.60-bcast.patch b/net-tools-1.60-bcast.patch new file mode 100644 index 0000000..9489e26 --- /dev/null +++ b/net-tools-1.60-bcast.patch @@ -0,0 +1,99 @@ +--- net-tools-1.60/ifconfig.c.broadcast 2004-11-03 12:05:30.000000000 +0100 ++++ net-tools-1.60/ifconfig.c 2004-11-04 15:39:32.817077232 +0100 +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -138,6 +139,7 @@ + perror("SIOCSIFFLAGS"); + return -1; + } ++ + return (0); + } + +@@ -212,17 +214,41 @@ + exit(0); + } + +-static int set_netmask(int skfd, struct ifreq *ifr, struct sockaddr *sa) ++static int set_netmask(int skfd, struct ifreq *ifr, struct sockaddr *sa, int new_bcast) + { + int err = 0; +- +- memcpy((char *) &ifr->ifr_netmask, (char *) sa, +- sizeof(struct sockaddr)); ++ struct sockaddr_in * ip_addr, * netmask, *bcast; ++ struct ifreq ifraddr; ++ struct ifreq ifrbcast; ++ ++ memcpy((char *) &ifr->ifr_netmask, (char *) sa, ++ sizeof(struct sockaddr)); + if (ioctl(skfd, SIOCSIFNETMASK, ifr) < 0) { + fprintf(stderr, "SIOCSIFNETMASK: %s\n", + strerror(errno)); + err = 1; + } ++ ++ if (new_bcast) { ++ memcpy(&ifraddr,ifr,sizeof(struct ifreq)); ++ memcpy(&ifrbcast,ifr,sizeof(struct ifreq)); ++ ++ if (ioctl(skfd, SIOCGIFADDR, &ifraddr) < 0) { ++ fprintf(stderr, "SIOCGIFADDR: %s\n", strerror(errno)); ++ err = 1; ++ } ++ ++ ip_addr = (struct sockaddr_in *)&ifraddr.ifr_addr; ++ netmask = (struct sockaddr_in *)&ifr->ifr_netmask; ++ bcast = (struct sockaddr_in *)&ifrbcast.ifr_broadaddr; ++ /* calculate new broadcast adress */ ++ bcast->sin_addr.s_addr = ip_addr->sin_addr.s_addr | ~netmask->sin_addr.s_addr; ++ /* set new broadcast adress */ ++ if (ioctl(skfd, SIOCSIFBRDADDR, &ifrbcast) < 0) { ++ fprintf(stderr, "SIOCSIFBROADCAST: %s\n", strerror(errno)); ++ err = 1; ++ } ++ } + return 0; + } + +@@ -234,7 +260,7 @@ + struct aftype *ap; + struct hwtype *hw; + struct ifreq ifr; +- int goterr = 0, didnetmask = 0, donetmask = 0; ++ int goterr = 0, didnetmask = 0, donetmask = 0, dobcast = 1; + char **spp; + int fd; + #if HAVE_AFINET6 +@@ -506,6 +532,7 @@ + strerror(errno)); + goterr = 1; + } ++ dobcast = 0; + spp++; + } + goterr |= set_flag(ifr.ifr_name, IFF_BROADCAST); +@@ -542,7 +569,7 @@ + continue; + } + didnetmask++; +- goterr = set_netmask(ap->fd, &ifr, &sa); ++ goterr = set_netmask(ap->fd, &ifr, &sa, dobcast); + spp++; + continue; + } +@@ -964,7 +991,7 @@ + /* set CIDR netmask */ + if (donetmask) { + donetmask = 0; +- goterr = set_netmask(skfd, &ifr, &sa_netmask); ++ goterr = set_netmask(skfd, &ifr, &sa_netmask, dobcast); + didnetmask++; + } + diff --git a/net-tools-1.60-ulong.patch b/net-tools-1.60-ulong.patch new file mode 100644 index 0000000..bc7df29 --- /dev/null +++ b/net-tools-1.60-ulong.patch @@ -0,0 +1,215 @@ +diff -urN net-tools-1.60/statistics.c net-tools-1.60-patch/statistics.c +--- net-tools-1.60/statistics.c 2001-02-02 10:01:23.000000000 -0800 ++++ net-tools-1.60-patch/statistics.c 2004-06-15 11:09:44.000000000 -0700 +@@ -63,54 +63,54 @@ + struct entry Iptab[] = + { + {"Forwarding", N_("Forwarding is %s"), i_forward | I_STATIC}, +- {"DefaultTTL", N_("Default TTL is %u"), number | I_STATIC}, +- {"InReceives", N_("%u total packets received"), number}, +- {"InHdrErrors", N_("%u with invalid headers"), opt_number}, +- {"InAddrErrors", N_("%u with invalid addresses"), opt_number}, +- {"ForwDatagrams", N_("%u forwarded"), number}, +- {"InUnknownProtos", N_("%u with unknown protocol"), opt_number}, +- {"InDiscards", N_("%u incoming packets discarded"), number}, +- {"InDelivers", N_("%u incoming packets delivered"), number}, +- {"OutRequests", N_("%u requests sent out"), number}, /*? */ +- {"OutDiscards", N_("%u outgoing packets dropped"), opt_number}, +- {"OutNoRoutes", N_("%u dropped because of missing route"), opt_number}, +- {"ReasmTimeout", N_("%u fragments dropped after timeout"), opt_number}, +- {"ReasmReqds", N_("%u reassemblies required"), opt_number}, /* ? */ +- {"ReasmOKs", N_("%u packets reassembled ok"), opt_number}, +- {"ReasmFails", N_("%u packet reassembles failed"), opt_number}, +- {"FragOKs", N_("%u fragments received ok"), opt_number}, +- {"FragFails", N_("%u fragments failed"), opt_number}, +- {"FragCreates", N_("%u fragments created"), opt_number} ++ {"DefaultTTL", N_("Default TTL is %lu"), number | I_STATIC}, ++ {"InReceives", N_("%lu total packets received"), number}, ++ {"InHdrErrors", N_("%lu with invalid headers"), opt_number}, ++ {"InAddrErrors", N_("%lu with invalid addresses"), opt_number}, ++ {"ForwDatagrams", N_("%lu forwarded"), number}, ++ {"InUnknownProtos", N_("%lu with unknown protocol"), opt_number}, ++ {"InDiscards", N_("%lu incoming packets discarded"), number}, ++ {"InDelivers", N_("%lu incoming packets delivered"), number}, ++ {"OutRequests", N_("%lu requests sent out"), number}, /*? */ ++ {"OutDiscards", N_("%lu outgoing packets dropped"), opt_number}, ++ {"OutNoRoutes", N_("%lu dropped because of missing route"), opt_number}, ++ {"ReasmTimeout", N_("%lu fragments dropped after timeout"), opt_number}, ++ {"ReasmReqds", N_("%lu reassemblies required"), opt_number}, /* ? */ ++ {"ReasmOKs", N_("%lu packets reassembled ok"), opt_number}, ++ {"ReasmFails", N_("%lu packet reassembles failed"), opt_number}, ++ {"FragOKs", N_("%lu fragments received ok"), opt_number}, ++ {"FragFails", N_("%lu fragments failed"), opt_number}, ++ {"FragCreates", N_("%lu fragments created"), opt_number} + }; + + struct entry Icmptab[] = + { +- {"InMsgs", N_("%u ICMP messages received"), number}, +- {"InErrors", N_("%u input ICMP message failed."), number}, +- {"InDestUnreachs", N_("destination unreachable: %u"), i_inp_icmp | I_TITLE}, +- {"InTimeExcds", N_("timeout in transit: %u"), i_inp_icmp | I_TITLE}, +- {"InParmProbs", N_("wrong parameters: %u"), i_inp_icmp | I_TITLE}, /*? */ +- {"InSrcQuenchs", N_("source quenches: %u"), i_inp_icmp | I_TITLE}, +- {"InRedirects", N_("redirects: %u"), i_inp_icmp | I_TITLE}, +- {"InEchos", N_("echo requests: %u"), i_inp_icmp | I_TITLE}, +- {"InEchoReps", N_("echo replies: %u"), i_inp_icmp | I_TITLE}, +- {"InTimestamps", N_("timestamp request: %u"), i_inp_icmp | I_TITLE}, +- {"InTimestampReps", N_("timestamp reply: %u"), i_inp_icmp | I_TITLE}, +- {"InAddrMasks", N_("address mask request: %u"), i_inp_icmp | I_TITLE}, /*? */ +- {"InAddrMaskReps", N_("address mask replies: %u"), i_inp_icmp | I_TITLE}, /*? */ +- {"OutMsgs", N_("%u ICMP messages sent"), number}, +- {"OutErrors", N_("%u ICMP messages failed"), number}, +- {"OutDestUnreachs", N_("destination unreachable: %u"), i_outp_icmp | I_TITLE}, +- {"OutTimeExcds", N_("time exceeded: %u"), i_outp_icmp | I_TITLE}, +- {"OutParmProbs", N_("wrong parameters: %u"), i_outp_icmp | I_TITLE}, /*? */ +- {"OutSrcQuenchs", N_("source quench: %u"), i_outp_icmp | I_TITLE}, +- {"OutRedirects", N_("redirect: %u"), i_outp_icmp | I_TITLE}, +- {"OutEchos", N_("echo request: %u"), i_outp_icmp | I_TITLE}, +- {"OutEchoReps", N_("echo replies: %u"), i_outp_icmp | I_TITLE}, +- {"OutTimestamps", N_("timestamp requests: %u"), i_outp_icmp | I_TITLE}, +- {"OutTimestampReps", N_("timestamp replies: %u"), i_outp_icmp | I_TITLE}, +- {"OutAddrMasks", N_("address mask requests: %u"), i_outp_icmp | I_TITLE}, +- {"OutAddrMaskReps", N_("address mask replies: %u"), i_outp_icmp | I_TITLE}, ++ {"InMsgs", N_("%lu ICMP messages received"), number}, ++ {"InErrors", N_("%lu input ICMP message failed."), number}, ++ {"InDestUnreachs", N_("destination unreachable: %lu"), i_inp_icmp | I_TITLE}, ++ {"InTimeExcds", N_("timeout in transit: %lu"), i_inp_icmp | I_TITLE}, ++ {"InParmProbs", N_("wrong parameters: %lu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"InSrcQuenchs", N_("source quenches: %lu"), i_inp_icmp | I_TITLE}, ++ {"InRedirects", N_("redirects: %lu"), i_inp_icmp | I_TITLE}, ++ {"InEchos", N_("echo requests: %lu"), i_inp_icmp | I_TITLE}, ++ {"InEchoReps", N_("echo replies: %lu"), i_inp_icmp | I_TITLE}, ++ {"InTimestamps", N_("timestamp request: %lu"), i_inp_icmp | I_TITLE}, ++ {"InTimestampReps", N_("timestamp reply: %lu"), i_inp_icmp | I_TITLE}, ++ {"InAddrMasks", N_("address mask request: %lu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"InAddrMaskReps", N_("address mask replies: %lu"), i_inp_icmp | I_TITLE}, /*? */ ++ {"OutMsgs", N_("%lu ICMP messages sent"), number}, ++ {"OutErrors", N_("%lu ICMP messages failed"), number}, ++ {"OutDestUnreachs", N_("destination unreachable: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutTimeExcds", N_("time exceeded: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutParmProbs", N_("wrong parameters: %lu"), i_outp_icmp | I_TITLE}, /*? */ ++ {"OutSrcQuenchs", N_("source quench: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutRedirects", N_("redirect: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutEchos", N_("echo request: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutEchoReps", N_("echo replies: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutTimestamps", N_("timestamp requests: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutTimestampReps", N_("timestamp replies: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutAddrMasks", N_("address mask requests: %lu"), i_outp_icmp | I_TITLE}, ++ {"OutAddrMaskReps", N_("address mask replies: %lu"), i_outp_icmp | I_TITLE}, + }; + + struct entry Tcptab[] = +@@ -119,71 +119,71 @@ + {"RtoMin", "", number}, + {"RtoMax", "", number}, + {"MaxConn", "", number}, +- {"ActiveOpens", N_("%u active connections openings"), number}, +- {"PassiveOpens", N_("%u passive connection openings"), number}, +- {"AttemptFails", N_("%u failed connection attempts"), number}, +- {"EstabResets", N_("%u connection resets received"), number}, +- {"CurrEstab", N_("%u connections established"), number}, +- {"InSegs", N_("%u segments received"), number}, +- {"OutSegs", N_("%u segments send out"), number}, +- {"RetransSegs", N_("%u segments retransmited"), number}, +- {"InErrs", N_("%u bad segments received."), number}, +- {"OutRsts", N_("%u resets sent"), number}, ++ {"ActiveOpens", N_("%lu active connections openings"), number}, ++ {"PassiveOpens", N_("%lu passive connection openings"), number}, ++ {"AttemptFails", N_("%lu failed connection attempts"), number}, ++ {"EstabResets", N_("%lu connection resets received"), number}, ++ {"CurrEstab", N_("%lu connections established"), number}, ++ {"InSegs", N_("%lu segments received"), number}, ++ {"OutSegs", N_("%lu segments send out"), number}, ++ {"RetransSegs", N_("%lu segments retransmited"), number}, ++ {"InErrs", N_("%lu bad segments received."), number}, ++ {"OutRsts", N_("%lu resets sent"), number}, + }; + + struct entry Udptab[] = + { +- {"InDatagrams", N_("%u packets received"), number}, +- {"NoPorts", N_("%u packets to unknown port received."), number}, +- {"InErrors", N_("%u packet receive errors"), number}, +- {"OutDatagrams", N_("%u packets sent"), number}, ++ {"InDatagrams", N_("%lu packets received"), number}, ++ {"NoPorts", N_("%lu packets to unknown port received."), number}, ++ {"InErrors", N_("%lu packet receive errors"), number}, ++ {"OutDatagrams", N_("%lu packets sent"), number}, + }; + + struct entry Tcpexttab[] = + { +- {"SyncookiesSent", N_("%u SYN cookies sent"), opt_number}, +- {"SyncookiesRecv", N_("%u SYN cookies received"), opt_number}, +- {"SyncookiesFailed", N_("%u invalid SYN cookies received"), opt_number}, ++ {"SyncookiesSent", N_("%lu SYN cookies sent"), opt_number}, ++ {"SyncookiesRecv", N_("%lu SYN cookies received"), opt_number}, ++ {"SyncookiesFailed", N_("%lu invalid SYN cookies received"), opt_number}, + +- { "EmbryonicRsts", N_("%u resets received for embryonic SYN_RECV sockets"), ++ { "EmbryonicRsts", N_("%lu resets received for embryonic SYN_RECV sockets"), + opt_number }, +- { "PruneCalled", N_("%u packets pruned from receive queue because of socket" ++ { "PruneCalled", N_("%lu packets pruned from receive queue because of socket" + " buffer overrun"), opt_number }, + /* obsolete: 2.2.0 doesn't do that anymore */ +- { "RcvPruned", N_("%u packets pruned from receive queue"), opt_number }, +- { "OfoPruned", N_("%u packets dropped from out-of-order queue because of" ++ { "RcvPruned", N_("%lu packets pruned from receive queue"), opt_number }, ++ { "OfoPruned", N_("%lu packets dropped from out-of-order queue because of" + " socket buffer overrun"), opt_number }, +- { "OutOfWindowIcmps", N_("%u ICMP packets dropped because they were " ++ { "OutOfWindowIcmps", N_("%lu ICMP packets dropped because they were " + "out-of-window"), opt_number }, +- { "LockDroppedIcmps", N_("%u ICMP packets dropped because" ++ { "LockDroppedIcmps", N_("%lu ICMP packets dropped because" + " socket was locked"), opt_number }, +- { "TW", N_("%u TCP sockets finished time wait in fast timer"), opt_number }, +- { "TWRecycled", N_("%u time wait sockets recycled by time stamp"), opt_number }, +- { "TWKilled", N_("%u TCP sockets finished time wait in slow timer"), opt_number }, +- { "PAWSPassive", N_("%u passive connections rejected because of" ++ { "TW", N_("%lu TCP sockets finished time wait in fast timer"), opt_number }, ++ { "TWRecycled", N_("%lu time wait sockets recycled by time stamp"), opt_number }, ++ { "TWKilled", N_("%lu TCP sockets finished time wait in slow timer"), opt_number }, ++ { "PAWSPassive", N_("%lu passive connections rejected because of" + " time stamp"), opt_number }, +- { "PAWSActive", N_("%u active connections rejected because of " ++ { "PAWSActive", N_("%lu active connections rejected because of " + "time stamp"), opt_number }, +- { "PAWSEstab", N_("%u packets rejects in established connections because of" ++ { "PAWSEstab", N_("%lu packets rejects in established connections because of" + " timestamp"), opt_number }, +- { "DelayedACKs", N_("%u delayed acks sent"), opt_number }, +- { "DelayedACKLocked", N_("%u delayed acks further delayed because of" ++ { "DelayedACKs", N_("%lu delayed acks sent"), opt_number }, ++ { "DelayedACKLocked", N_("%lu delayed acks further delayed because of" + " locked socket"), opt_number }, +- { "DelayedACKLost", N_("Quick ack mode was activated %u times"), opt_number }, +- { "ListenOverflows", N_("%u times the listen queue of a socket overflowed"), ++ { "DelayedACKLost", N_("Quick ack mode was activated %lu times"), opt_number }, ++ { "ListenOverflows", N_("%lu times the listen queue of a socket overflowed"), + opt_number }, +- { "ListenDrops", N_("%u SYNs to LISTEN sockets ignored"), opt_number }, +- { "TCPPrequeued", N_("%u packets directly queued to recvmsg prequeue."), ++ { "ListenDrops", N_("%lu SYNs to LISTEN sockets ignored"), opt_number }, ++ { "TCPPrequeued", N_("%lu packets directly queued to recvmsg prequeue."), + opt_number }, +- { "TCPDirectCopyFromBacklog", N_("%u packets directly received" ++ { "TCPDirectCopyFromBacklog", N_("%lu packets directly received" + " from backlog"), opt_number }, +- { "TCPDirectCopyFromPrequeue", N_("%u packets directly received" ++ { "TCPDirectCopyFromPrequeue", N_("%lu packets directly received" + " from prequeue"), opt_number }, +- { "TCPPrequeueDropped", N_("%u packets dropped from prequeue"), opt_number }, +- { "TCPHPHits", N_("%u packets header predicted"), number }, +- { "TCPHPHitsToUser", N_("%u packets header predicted and " ++ { "TCPPrequeueDropped", N_("%lu packets dropped from prequeue"), opt_number }, ++ { "TCPHPHits", N_("%lu packets header predicted"), number }, ++ { "TCPHPHitsToUser", N_("%lu packets header predicted and " + "directly queued to user"), opt_number }, +- { "SockMallocOOM", N_("Ran %u times out of system memory during " ++ { "SockMallocOOM", N_("Ran %lu times out of system memory during " + "packet sending"), opt_number }, + }; + diff --git a/net-tools.spec b/net-tools.spec index 4cd4f9f..b17ae8e 100644 --- a/net-tools.spec +++ b/net-tools.spec @@ -3,7 +3,7 @@ Summary: Basic networking tools. Name: net-tools Version: 1.60 -Release: 38 +Release: 39 License: GPL Group: System Environment/Base Source0: http://www.tazenda.demon.co.uk/phil/net-tools/net-tools-%{version}.tar.bz2 @@ -34,6 +34,8 @@ Patch20: net-tools-1.60-trunc.patch Patch21: net-tools-1.60-return.patch Patch22: net-tools-1.60-parse.patch Patch23: net-tools-1.60-netmask.patch +Patch24: net-tools-1.60-ulong.patch +Patch25: net-tools-1.60-bcast.patch BuildRoot: %{_tmppath}/%{name}-root Requires(post,preun): chkconfig BuildRequires: gettext @@ -67,6 +69,8 @@ ifconfig, netstat, route, and others. %patch21 -p1 -b .return %patch22 -p1 -b .parse %patch23 -p1 -b .netmask +%patch24 -p1 -b .ulong +%patch25 -p1 -b .bcast cp %SOURCE2 ./config.h cp %SOURCE3 ./config.make @@ -158,6 +162,10 @@ exit 0 %{_sysconfdir}/rc.d/init.d/netplugd %changelog +* Thu Nov 04 2004 Radek Vokal 1.60-39 +- IBM patch for netstat -s returning negative values on 64bit arch (#144064) +- broadcast calulated if only netmask provided (#60509) + * Tue Nov 02 2004 Radek Vokal 1.60-38 - fixed fail to assign the specified netmask before adress is assigned - patch by Malita, Florin