This commit is contained in:
commit
909de157bd
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.osc
|
12
iputils-ADDLIB.diff
Normal file
12
iputils-ADDLIB.diff
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
--- Makefile
|
||||||
|
+++ Makefile
|
||||||
|
@@ -5,8 +5,8 @@
|
||||||
|
DEFINES=
|
||||||
|
|
||||||
|
#options if you have a bind>=4.9.4 libresolv (or, maybe, glibc)
|
||||||
|
-LDLIBS=-lresolv
|
||||||
|
ADDLIB=
|
||||||
|
+LDLIBS=-lresolv $(ADDLIB)
|
||||||
|
|
||||||
|
ifeq ($(LIBC_INCLUDE)/socketbits.h,$(wildcard $(LIBC_INCLUDE)/socketbits.h))
|
||||||
|
ifeq ($(LIBC_INCLUDE)/net/if_packet.h,$(wildcard $(LIBC_INCLUDE)/net/if_packet.h))
|
11
iputils-HZ.patch
Normal file
11
iputils-HZ.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- ping_common.c
|
||||||
|
+++ ping_common.c
|
||||||
|
@@ -548,7 +548,7 @@
|
||||||
|
|
||||||
|
/* If we are here, recvmsg() is unable to wait for
|
||||||
|
* required timeout. */
|
||||||
|
- if (1000*next <= 1000000/(int)HZ) {
|
||||||
|
+ if (1000*next <= 1000000/(int)sysconf(_SC_CLK_TCK)) {
|
||||||
|
/* Very short timeout... So, if we wait for
|
||||||
|
* something, we sleep for MININTERVAL.
|
||||||
|
* Otherwise, spin! */
|
51
iputils-headers.patch
Normal file
51
iputils-headers.patch
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
--- arping.c
|
||||||
|
+++ arping.c
|
||||||
|
@@ -17,8 +17,10 @@
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/signal.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
-#include <linux/if.h>
|
||||||
|
-#include <linux/if_arp.h>
|
||||||
|
+#include <net/if.h>
|
||||||
|
+#include <net/if_arp.h>
|
||||||
|
+#include <netpacket/packet.h>
|
||||||
|
+#include <linux/if_ether.h>
|
||||||
|
#include <sys/uio.h>
|
||||||
|
|
||||||
|
#include <netdb.h>
|
||||||
|
--- ifenslave.c
|
||||||
|
+++ ifenslave.c
|
||||||
|
@@ -140,7 +140,6 @@
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
-#include <linux/if.h>
|
||||||
|
#include <net/if_arp.h>
|
||||||
|
#include <linux/if_ether.h>
|
||||||
|
#include <linux/if_bonding.h>
|
||||||
|
--- rarpd.c
|
||||||
|
+++ rarpd.c
|
||||||
|
@@ -24,10 +24,11 @@
|
||||||
|
#include <sys/fcntl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/signal.h>
|
||||||
|
-#include <linux/if.h>
|
||||||
|
-#include <linux/if_arp.h>
|
||||||
|
+#include <net/if.h>
|
||||||
|
+#include <net/if_arp.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
-#include <linux/if_packet.h>
|
||||||
|
+#include <netpacket/packet.h>
|
||||||
|
+#include <linux/if_ether.h>
|
||||||
|
#include <linux/filter.h>
|
||||||
|
|
||||||
|
int do_reload = 1;
|
||||||
|
@@ -45,6 +46,8 @@
|
||||||
|
extern int ether_ntohost(char *name, unsigned char *ea);
|
||||||
|
void usage(void) __attribute__((noreturn));
|
||||||
|
|
||||||
|
+#define ifaddr if_addr
|
||||||
|
+
|
||||||
|
struct iflink
|
||||||
|
{
|
||||||
|
struct iflink *next;
|
13
iputils-ifenslave.patch
Normal file
13
iputils-ifenslave.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
--- ifenslave.c
|
||||||
|
+++ ifenslave.c
|
||||||
|
@@ -644,8 +644,8 @@
|
||||||
|
if (ioctl(skfd, SIOCGIFADDR, &ifr) < 0)
|
||||||
|
return -1;
|
||||||
|
printf("The result of SIOCGIFADDR is %2.2x.%2.2x.%2.2x.%2.2x.\n",
|
||||||
|
- ifr.ifr_addr.sa_data[0], ifr.ifr_addr.sa_data[1],
|
||||||
|
- ifr.ifr_addr.sa_data[2], ifr.ifr_addr.sa_data[3]);
|
||||||
|
+ ifr.ifr_addr.sa_data[2], ifr.ifr_addr.sa_data[3],
|
||||||
|
+ ifr.ifr_addr.sa_data[4], ifr.ifr_addr.sa_data[5]);
|
||||||
|
|
||||||
|
strcpy(ifr.ifr_name, ifname);
|
||||||
|
if (ioctl(skfd, SIOCGIFHWADDR, &ifr) < 0)
|
50
iputils-ss021109-locallinksyntax.diff
Normal file
50
iputils-ss021109-locallinksyntax.diff
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
|
||||||
|
This patch for iputils allows to use the standard
|
||||||
|
|
||||||
|
ping6 link-local-addr%interface
|
||||||
|
|
||||||
|
syntax instead of ping6 -I interface link-local-addr. This matches
|
||||||
|
BSD ping.
|
||||||
|
|
||||||
|
Please apply.
|
||||||
|
|
||||||
|
-Andi
|
||||||
|
|
||||||
|
|
||||||
|
diff -u iputils/ping6.c-o iputils/ping6.c
|
||||||
|
--- iputils/ping6.c-o 2005-07-08 02:21:34.000000000 +0200
|
||||||
|
+++ iputils/ping6.c 2005-07-08 02:51:47.000000000 +0200
|
||||||
|
@@ -268,6 +268,14 @@
|
||||||
|
|
||||||
|
target = *argv;
|
||||||
|
|
||||||
|
+ if (!device) {
|
||||||
|
+ char *s = strchr(target, '%');
|
||||||
|
+ if (s) {
|
||||||
|
+ device = s+1;
|
||||||
|
+ *s = 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (inet_pton(AF_INET6, target, &addr) <= 0) {
|
||||||
|
struct hostent *hp;
|
||||||
|
|
||||||
|
@@ -296,6 +304,14 @@
|
||||||
|
memset(&whereto, 0, sizeof(struct sockaddr_in6));
|
||||||
|
whereto.sin6_family = AF_INET6;
|
||||||
|
whereto.sin6_port = htons(IPPROTO_ICMPV6);
|
||||||
|
+
|
||||||
|
+ if (!device) {
|
||||||
|
+ char *s = strchr(target, '%');
|
||||||
|
+ if (s) {
|
||||||
|
+ device = s+1;
|
||||||
|
+ *s = 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (inet_pton(AF_INET6, target, &whereto.sin6_addr) <= 0) {
|
||||||
|
struct hostent *hp;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--
|
22
iputils-ss021109-ping-R-option-doc.diff
Normal file
22
iputils-ss021109-ping-R-option-doc.diff
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
--- iputils/doc/ping.8
|
||||||
|
+++ iputils/doc/ping.8
|
||||||
|
@@ -118,7 +118,7 @@
|
||||||
|
when finished.
|
||||||
|
.TP
|
||||||
|
\fB-R\fR
|
||||||
|
-Record route.
|
||||||
|
+Record route. (IPv4 only)
|
||||||
|
Includes the RECORD_ROUTE option in the ECHO_REQUEST
|
||||||
|
packet and displays the route buffer on returned packets.
|
||||||
|
Note that the IP header is only large enough for nine such routes.
|
||||||
|
--- iputils/doc/ping.sgml
|
||||||
|
+++ iputils/doc/ping.sgml
|
||||||
|
@@ -200,7 +200,7 @@
|
||||||
|
<varlistentry>
|
||||||
|
<term><option/-R/</term>
|
||||||
|
<listitem><para>
|
||||||
|
-Record route.
|
||||||
|
+Record route. (IPv4 only)
|
||||||
|
Includes the RECORD_ROUTE option in the ECHO_REQUEST
|
||||||
|
packet and displays the route buffer on returned packets.
|
||||||
|
Note that the IP header is only large enough for nine such routes.
|
76
iputils-ss021109-ping6_getaddrinfo.patch
Normal file
76
iputils-ss021109-ping6_getaddrinfo.patch
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
--- ping6.c 2006-11-15 17:05:29.000000000 +0900
|
||||||
|
+++ ping6.c 2006-11-22 18:50:58.000000000 +0900
|
||||||
|
@@ -196,6 +196,7 @@ int main(int argc, char *argv[])
|
||||||
|
int socket_errno;
|
||||||
|
struct icmp6_filter filter;
|
||||||
|
int err, csum_offset, sz_opt;
|
||||||
|
+ struct addrinfo hints, *res0;
|
||||||
|
|
||||||
|
icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
|
||||||
|
socket_errno = errno;
|
||||||
|
@@ -211,6 +212,11 @@ int main(int argc, char *argv[])
|
||||||
|
memset(&firsthop, 0, sizeof(firsthop));
|
||||||
|
firsthop.sin6_family = AF_INET6;
|
||||||
|
|
||||||
|
+ memset(&hints, 0, sizeof(hints));
|
||||||
|
+ hints.ai_family = AF_INET6;
|
||||||
|
+ hints.ai_socktype = SOCK_RAW;
|
||||||
|
+ hints.ai_protocol = IPPROTO_ICMPV6;
|
||||||
|
+
|
||||||
|
preload = 1;
|
||||||
|
while ((ch = getopt(argc, argv, COMMON_OPTSTR "F:")) != EOF) {
|
||||||
|
switch(ch) {
|
||||||
|
@@ -291,16 +297,20 @@ int main(int argc, char *argv[])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inet_pton(AF_INET6, target, &addr) <= 0) {
|
||||||
|
- struct hostent *hp;
|
||||||
|
-
|
||||||
|
- hp = gethostbyname2(target, AF_INET6);
|
||||||
|
-
|
||||||
|
- if (hp == NULL) {
|
||||||
|
+ err = getaddrinfo(target, NULL, &hints, &res0);
|
||||||
|
+ if (err) {
|
||||||
|
fprintf(stderr, "unknown host %s\n", target);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
+ if (res0->ai_addrlen > sizeof(struct sockaddr_in6)) {
|
||||||
|
+ fprintf(stderr, "address length is too long\n");
|
||||||
|
+ exit(2);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- memcpy(&addr, hp->h_addr_list[0], 16);
|
||||||
|
+ addr=((struct sockaddr_in6 *)res0->ai_addr)->sin6_addr;
|
||||||
|
+ if (ipv6_addr_any(&firsthop.sin6_addr))
|
||||||
|
+ memcpy(&firsthop, res0->ai_addr, res0->ai_addrlen);
|
||||||
|
+ freeaddrinfo(res0);
|
||||||
|
}
|
||||||
|
|
||||||
|
inet6_srcrt_add(srcrt, &addr);
|
||||||
|
@@ -328,16 +338,20 @@ int main(int argc, char *argv[])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inet_pton(AF_INET6, target, &whereto.sin6_addr) <= 0) {
|
||||||
|
- struct hostent *hp;
|
||||||
|
-
|
||||||
|
- hp = gethostbyname2(target, AF_INET6);
|
||||||
|
-
|
||||||
|
- if (hp == NULL) {
|
||||||
|
+ err = getaddrinfo(target, NULL, &hints, &res0);
|
||||||
|
+ if (err) {
|
||||||
|
fprintf(stderr, "unknown host\n");
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
+ if (res0->ai_addrlen > sizeof(struct sockaddr_in6)) {
|
||||||
|
+ fprintf(stderr, "address length is too long\n");
|
||||||
|
+ exit(2);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- memcpy(&whereto.sin6_addr, hp->h_addr_list[0], 16);
|
||||||
|
+ memcpy(&whereto, res0->ai_addr, res0->ai_addrlen);
|
||||||
|
+ if (ipv6_addr_any(&firsthop.sin6_addr))
|
||||||
|
+ memcpy(&firsthop, res0->ai_addr, res0->ai_addrlen);
|
||||||
|
+ freeaddrinfo(res0);
|
||||||
|
} else {
|
||||||
|
options |= F_NUMERIC;
|
||||||
|
}
|
47
iputils-ss021109-ping6kernel261x.diff
Normal file
47
iputils-ss021109-ping6kernel261x.diff
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
diff -Nru iputils-orig/ping6.c iputils/ping6.c
|
||||||
|
--- iputils-orig/ping6.c 2005-12-05 18:06:39.000000000 +0100
|
||||||
|
+++ iputils/ping6.c 2005-12-05 18:06:49.000000000 +0100
|
||||||
|
@@ -101,6 +101,20 @@
|
||||||
|
#define HAVE_SIN6_SCOPEID 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+/* Begin hack KERNEL >= 2.6.1x.x */
|
||||||
|
+#define IPV6_ADDRFORM 1
|
||||||
|
+#define IPV6_PKTINFO 2
|
||||||
|
+#define IPV6_HOPOPTS 3
|
||||||
|
+#define IPV6_DSTOPTS 4
|
||||||
|
+#define IPV6_RTHDR 5
|
||||||
|
+#define IPV6_PKTOPTIONS 6
|
||||||
|
+#define IPV6_CHECKSUM 7
|
||||||
|
+#define IPV6_HOPLIMIT 8
|
||||||
|
+#define IPV6_NEXTHOP 9
|
||||||
|
+#define IPV6_FLOWINFO 11
|
||||||
|
+/* End hack */
|
||||||
|
+
|
||||||
|
+
|
||||||
|
|
||||||
|
__u32 flowlabel;
|
||||||
|
__u32 tclass;
|
||||||
|
diff -Nru iputils-orig/tracepath6.c iputils/tracepath6.c
|
||||||
|
--- iputils-orig/tracepath6.c 2005-12-05 18:06:39.000000000 +0100
|
||||||
|
+++ iputils/tracepath6.c 2005-12-05 18:06:55.000000000 +0100
|
||||||
|
@@ -25,6 +25,19 @@
|
||||||
|
#include <sys/uio.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
+/* Begin hack KERNEL >= 2.6.1x.x */
|
||||||
|
+#define IPV6_ADDRFORM 1
|
||||||
|
+#define IPV6_PKTINFO 2
|
||||||
|
+#define IPV6_HOPOPTS 3
|
||||||
|
+#define IPV6_DSTOPTS 4
|
||||||
|
+#define IPV6_RTHDR 5
|
||||||
|
+#define IPV6_PKTOPTIONS 6
|
||||||
|
+#define IPV6_CHECKSUM 7
|
||||||
|
+#define IPV6_HOPLIMIT 8
|
||||||
|
+#define IPV6_NEXTHOP 9
|
||||||
|
+#define IPV6_FLOWINFO 11
|
||||||
|
+/* End hack */
|
||||||
|
+
|
||||||
|
int overhead = 48;
|
||||||
|
int mtu = 128000;
|
||||||
|
int hops_to = -1;
|
16
iputils-ss021109-ping_common.dif
Normal file
16
iputils-ss021109-ping_common.dif
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
--- ping_common.c 2006-12-01 12:58:33.000000000 +0100
|
||||||
|
+++ ping_common.c 2006-12-01 12:59:59.000000000 +0100
|
||||||
|
@@ -187,6 +187,13 @@
|
||||||
|
fprintf(stderr, "ping: illegal negative packet size %d.\n", datalen);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
+ if (datalen > 0xFFFF - 8 ) {
|
||||||
|
+ if (uid || datalen > 0xFFFF ) {
|
||||||
|
+ fprintf(stderr, "Error: packet size %d is too large. Maximim is %d\n", datalen, 0xFFFF - 8);
|
||||||
|
+ exit(2);
|
||||||
|
+ }
|
||||||
|
+ fprintf(stderr, "WARNING: packet size %d is too large. Maximim is %d\n", datalen, 0xFFFF - 8 );
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
options |= F_VERBOSE;
|
61
iputils-ss021109-pingnamelookuponce.diff
Normal file
61
iputils-ss021109-pingnamelookuponce.diff
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
diff -ur iputils/ping.c iputils.new/ping.c
|
||||||
|
--- iputils/ping.c 2004-03-17 12:36:43.000000000 +0100
|
||||||
|
+++ iputils.new/ping.c 2004-03-17 12:35:49.000000000 +0100
|
||||||
|
@@ -1141,15 +1141,24 @@
|
||||||
|
char *
|
||||||
|
pr_addr(__u32 addr)
|
||||||
|
{
|
||||||
|
- struct hostent *hp;
|
||||||
|
+ struct hostent *hp = NULL;
|
||||||
|
+ static __u32 last_addr;
|
||||||
|
static char buf[4096];
|
||||||
|
|
||||||
|
- if ((options & F_NUMERIC) ||
|
||||||
|
- !(hp = gethostbyaddr((char *)&addr, 4, AF_INET)))
|
||||||
|
- sprintf(buf, "%s", inet_ntoa(*(struct in_addr *)&addr));
|
||||||
|
- else
|
||||||
|
+ if (!(options & F_NUMERIC)) {
|
||||||
|
+ if (buf[0] && addr == last_addr)
|
||||||
|
+ return buf;
|
||||||
|
+ hp = gethostbyaddr((char *)&addr, 4, AF_INET);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (hp) {
|
||||||
|
snprintf(buf, sizeof(buf), "%s (%s)", hp->h_name,
|
||||||
|
inet_ntoa(*(struct in_addr *)&addr));
|
||||||
|
+ } else {
|
||||||
|
+ sprintf(buf, "%s", inet_ntoa(*(struct in_addr *)&addr));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ last_addr = addr;
|
||||||
|
return(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -ur iputils/ping6.c iputils.new/ping6.c
|
||||||
|
--- iputils/ping6.c 2004-03-17 12:36:43.000000000 +0100
|
||||||
|
+++ iputils.new/ping6.c 2004-03-17 12:36:29.000000000 +0100
|
||||||
|
@@ -898,11 +898,22 @@
|
||||||
|
char * pr_addr(struct in6_addr *addr)
|
||||||
|
{
|
||||||
|
struct hostent *hp = NULL;
|
||||||
|
+ static struct in6_addr last_addr;
|
||||||
|
+ static char buf[1024];
|
||||||
|
|
||||||
|
- if (!(options&F_NUMERIC))
|
||||||
|
+ if (!(options&F_NUMERIC)) {
|
||||||
|
+ if (buf[0] && !memcmp(&last_addr, addr, sizeof(*addr)))
|
||||||
|
+ return buf;
|
||||||
|
hp = gethostbyaddr((__u8*)addr, sizeof(struct in6_addr), AF_INET6);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- return hp ? hp->h_name : pr_addr_n(addr);
|
||||||
|
+ if (hp && strlen(hp->h_name) < sizeof(buf)) {
|
||||||
|
+ strcpy(buf, hp->h_name);
|
||||||
|
+ } else {
|
||||||
|
+ inet_ntop(AF_INET6, addr, buf, sizeof(buf));
|
||||||
|
+ }
|
||||||
|
+ last_addr = *addr;
|
||||||
|
+ return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
char * pr_addr_n(struct in6_addr *addr)
|
44
iputils-ss021109-rdisc-server.patch
Normal file
44
iputils-ss021109-rdisc-server.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
--- iputils/rdisc.c
|
||||||
|
+++ iputils/rdisc.c
|
||||||
|
@@ -63,6 +63,8 @@
|
||||||
|
|
||||||
|
#include "SNAPSHOT.h"
|
||||||
|
|
||||||
|
+#define RDISC_SERVER
|
||||||
|
+
|
||||||
|
struct interface
|
||||||
|
{
|
||||||
|
struct in_addr address; /* Used to identify the interface */
|
||||||
|
@@ -163,11 +165,8 @@
|
||||||
|
int debugfile;
|
||||||
|
|
||||||
|
char usage[] =
|
||||||
|
-"Usage: rdisc [-b] [-d] [-s] [-v] [-f] [-a] [-V] [send_address] [receive_address]\n"
|
||||||
|
-#ifdef RDISC_SERVER
|
||||||
|
-" rdisc -r [-b] [-d] [-s] [-v] [-f] [-a] [-V] [-p <preference>] [-T <secs>] \n"
|
||||||
|
-" [send_address] [receive_address]\n"
|
||||||
|
-#endif
|
||||||
|
+"Usage: rdisc -r [-b] [-d] [-s] [-v] [-f] [-a] [-V] [-p <preference>] [-T <secs>] \n"
|
||||||
|
+" [send_address] [receive_address]\n"
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -875,7 +874,9 @@
|
||||||
|
((max_adv_int - min_adv_int)
|
||||||
|
* (random() % 1000)/1000);
|
||||||
|
} else {
|
||||||
|
- if (!is_directly_connected(ip->saddr)) {
|
||||||
|
+ struct in_addr tmp;
|
||||||
|
+ tmp.s_addr = ip->saddr;
|
||||||
|
+ if (!is_directly_connected(tmp)) {
|
||||||
|
if (verbose)
|
||||||
|
logtrace("ICMP %s from %s: source not directly connected\n",
|
||||||
|
pr_type((int)icp->type),
|
||||||
|
@@ -945,7 +946,6 @@
|
||||||
|
{
|
||||||
|
#ifdef RDISC_SERVER
|
||||||
|
if (responder) {
|
||||||
|
- int i;
|
||||||
|
|
||||||
|
/* Send out a packet with a preference so that all
|
||||||
|
* hosts will know that we are dead.
|
15
iputils-ss021109-sec-ping-setuid-retvalcheck.diff
Normal file
15
iputils-ss021109-sec-ping-setuid-retvalcheck.diff
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
--- iputils/ping.c
|
||||||
|
+++ iputils/ping.c
|
||||||
|
@@ -125,7 +125,11 @@
|
||||||
|
socket_errno = errno;
|
||||||
|
|
||||||
|
uid = getuid();
|
||||||
|
- setuid(uid);
|
||||||
|
+ if(setuid(uid) != 0)
|
||||||
|
+ {
|
||||||
|
+ perror("ping: setuid()");
|
||||||
|
+ exit(-1);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
source.sin_family = AF_INET;
|
||||||
|
|
15
iputils-ss021109-sec-ping6-setuid-retvalcheck.diff
Normal file
15
iputils-ss021109-sec-ping6-setuid-retvalcheck.diff
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
--- iputils/ping6.c
|
||||||
|
+++ iputils/ping6.c
|
||||||
|
@@ -187,7 +187,11 @@
|
||||||
|
socket_errno = errno;
|
||||||
|
|
||||||
|
uid = getuid();
|
||||||
|
- setuid(uid);
|
||||||
|
+ if(setuid(uid) != 0)
|
||||||
|
+ {
|
||||||
|
+ perror("ping: setuid()");
|
||||||
|
+ exit(-1);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
source.sin6_family = AF_INET6;
|
||||||
|
memset(&firsthop, 0, sizeof(firsthop));
|
16
iputils-ss021109-sec-traceroute6-setuid-retvalcheck.diff
Normal file
16
iputils-ss021109-sec-traceroute6-setuid-retvalcheck.diff
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
--- iputils/traceroute6.c
|
||||||
|
+++ iputils/traceroute6.c
|
||||||
|
@@ -337,8 +337,11 @@
|
||||||
|
icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
|
||||||
|
socket_errno = errno;
|
||||||
|
|
||||||
|
- setuid(getuid());
|
||||||
|
-
|
||||||
|
+ if(setuid(getuid()) != 0)
|
||||||
|
+ {
|
||||||
|
+ Fprintf(stderr, "traceroute: setuid()\n");
|
||||||
|
+ exit(-1);
|
||||||
|
+ }
|
||||||
|
on = 1;
|
||||||
|
seq = tos = 0;
|
||||||
|
to = (struct sockaddr_in6 *)&whereto;
|
10
iputils-ss021109-traceroute6-stdint.diff
Normal file
10
iputils-ss021109-traceroute6-stdint.diff
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
--- traceroute6.c
|
||||||
|
+++ traceroute6.c 2004/09/03 09:38:22
|
||||||
|
@@ -230,6 +230,7 @@
|
||||||
|
* Tue Dec 20 03:50:13 PST 1988
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#include <stdint.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/socket.h>
|
3
iputils-ss021109-try.tar.bz2
Normal file
3
iputils-ss021109-try.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:06ea9c83b5ff1ed02f526ed798a59e949793da1c232457077e75fcc8a10cdcb4
|
||||||
|
size 428335
|
959
iputils-ss021109.diff
Normal file
959
iputils-ss021109.diff
Normal file
@ -0,0 +1,959 @@
|
|||||||
|
---
|
||||||
|
ifenslave.c | 770 +++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
include-glibc/netinet/ip.h | 4
|
||||||
|
ping.c | 13
|
||||||
|
ping_common.c | 21 -
|
||||||
|
ping_common.h | 10
|
||||||
|
tracepath.c | 8
|
||||||
|
tracepath6.c | 2
|
||||||
|
7 files changed, 795 insertions(+), 33 deletions(-)
|
||||||
|
|
||||||
|
Index: iputils/include-glibc/netinet/ip.h
|
||||||
|
===================================================================
|
||||||
|
--- iputils.orig/include-glibc/netinet/ip.h
|
||||||
|
+++ iputils/include-glibc/netinet/ip.h
|
||||||
|
@@ -6,6 +6,10 @@
|
||||||
|
|
||||||
|
#include <linux/ip.h>
|
||||||
|
|
||||||
|
+/* From glibc, most of the time it is a bad idea to copy not complete
|
||||||
|
+ header files */
|
||||||
|
+#define IP_MAXPACKET 65535 /* maximum packet size */
|
||||||
|
+
|
||||||
|
#ifdef __USE_BSD
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1982, 1986, 1993
|
||||||
|
Index: iputils/ping.c
|
||||||
|
===================================================================
|
||||||
|
--- iputils.orig/ping.c
|
||||||
|
+++ iputils/ping.c
|
||||||
|
@@ -389,8 +389,7 @@ main(int argc, char **argv)
|
||||||
|
}
|
||||||
|
|
||||||
|
hold = 1;
|
||||||
|
- if (setsockopt(icmp_sock, SOL_IP, IP_RECVERR, (char *)&hold, sizeof(hold)))
|
||||||
|
- fprintf(stderr, "WARNING: your kernel is veeery old. No problems.\n");
|
||||||
|
+ setsockopt(icmp_sock, SOL_IP, IP_RECVERR, (char *)&hold, sizeof(hold));
|
||||||
|
|
||||||
|
/* record route option */
|
||||||
|
if (options & F_RROUTE) {
|
||||||
|
@@ -750,16 +749,6 @@ parse_reply(struct msghdr *msg, int cc,
|
||||||
|
acknowledge(ntohs(icp1->un.echo.sequence));
|
||||||
|
if (working_recverr) {
|
||||||
|
return 0;
|
||||||
|
- } else {
|
||||||
|
- static int once;
|
||||||
|
- /* Sigh, IP_RECVERR for raw socket
|
||||||
|
- * was broken until 2.4.9. So, we ignore
|
||||||
|
- * the first error and warn on the second.
|
||||||
|
- */
|
||||||
|
- if (once++ == 1)
|
||||||
|
- fprintf(stderr, "\rWARNING: kernel is not very fresh, upgrade is recommended.\n");
|
||||||
|
- if (once == 1)
|
||||||
|
- return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nerrors+=error_pkt;
|
||||||
|
Index: iputils/ping_common.c
|
||||||
|
===================================================================
|
||||||
|
--- iputils.orig/ping_common.c
|
||||||
|
+++ iputils/ping_common.c
|
||||||
|
@@ -39,16 +39,16 @@ int confirm_flag = MSG_CONFIRM;
|
||||||
|
int working_recverr;
|
||||||
|
|
||||||
|
/* timing */
|
||||||
|
-int timing; /* flag to do timing */
|
||||||
|
-long tmin = LONG_MAX; /* minimum round trip time */
|
||||||
|
-long tmax; /* maximum round trip time */
|
||||||
|
+unsigned long long timing; /* flag to do timing */
|
||||||
|
+unsigned long long tmin = LONG_MAX; /* minimum round trip time */
|
||||||
|
+unsigned long long tmax; /* maximum round trip time */
|
||||||
|
/* Message for rpm maintainers: have _shame_. If you want
|
||||||
|
* to fix something send the patch to me for sanity checking.
|
||||||
|
* "sparcfix" patch is a complete non-sense, apparenly the person
|
||||||
|
* prepared it was stoned.
|
||||||
|
*/
|
||||||
|
-long long tsum; /* sum of all times, for doing average */
|
||||||
|
-long long tsum2;
|
||||||
|
+unsigned long long tsum; /* sum of all times, for doing average */
|
||||||
|
+unsigned long long tsum2;
|
||||||
|
int pipesize = -1;
|
||||||
|
|
||||||
|
int datalen = DEFDATALEN;
|
||||||
|
@@ -662,7 +662,6 @@ restamp:
|
||||||
|
tvsub(tv, &tmp_tv);
|
||||||
|
triptime = tv->tv_sec * 1000000 + tv->tv_usec;
|
||||||
|
if (triptime < 0) {
|
||||||
|
- fprintf(stderr, "Warning: time of day goes back (%ldus), taking countermeasures.\n", triptime);
|
||||||
|
triptime = 0;
|
||||||
|
if (!(options & F_LATENCY)) {
|
||||||
|
gettimeofday(tv, NULL);
|
||||||
|
@@ -809,10 +808,10 @@ void finish(void)
|
||||||
|
tmdev = llsqrt(tsum2 - tsum * tsum);
|
||||||
|
|
||||||
|
printf("rtt min/avg/max/mdev = %ld.%03ld/%lu.%03ld/%ld.%03ld/%ld.%03ld ms",
|
||||||
|
- tmin/1000, tmin%1000,
|
||||||
|
+ (long)tmin/1000, (long)tmin%1000,
|
||||||
|
(unsigned long)(tsum/1000), (long)(tsum%1000),
|
||||||
|
- tmax/1000, tmax%1000,
|
||||||
|
- tmdev/1000, tmdev%1000
|
||||||
|
+ (long)tmax/1000, (long)tmax%1000,
|
||||||
|
+ (long)tmdev/1000, (long)tmdev%1000
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (pipesize > 1)
|
||||||
|
@@ -843,10 +842,10 @@ void status(void)
|
||||||
|
tavg = tsum / (nreceived + nrepeats);
|
||||||
|
|
||||||
|
fprintf(stderr, ", min/avg/ewma/max = %ld.%03ld/%lu.%03ld/%d.%03d/%ld.%03ld ms",
|
||||||
|
- tmin/1000, tmin%1000,
|
||||||
|
+ (long)tmin/1000, (long)tmin%1000,
|
||||||
|
tavg/1000, tavg%1000,
|
||||||
|
rtt/8000, (rtt/8)%1000,
|
||||||
|
- tmax/1000, tmax%1000
|
||||||
|
+ (long)tmax/1000, (long)tmax%1000
|
||||||
|
);
|
||||||
|
}
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
Index: iputils/ping_common.h
|
||||||
|
===================================================================
|
||||||
|
--- iputils.orig/ping_common.h
|
||||||
|
+++ iputils/ping_common.h
|
||||||
|
@@ -103,11 +103,11 @@ extern int working_recverr;
|
||||||
|
|
||||||
|
|
||||||
|
/* timing */
|
||||||
|
-extern int timing; /* flag to do timing */
|
||||||
|
-extern long tmin; /* minimum round trip time */
|
||||||
|
-extern long tmax; /* maximum round trip time */
|
||||||
|
-extern long long tsum; /* sum of all times, for doing average */
|
||||||
|
-extern long long tsum2;
|
||||||
|
+extern unsigned long long timing; /* flag to do timing */
|
||||||
|
+extern unsigned long long tmin; /* minimum round trip time */
|
||||||
|
+extern unsigned long long tmax; /* maximum round trip time */
|
||||||
|
+extern unsigned long long tsum; /* sum of all times, for doing average */
|
||||||
|
+extern unsigned long long tsum2;
|
||||||
|
extern int rtt;
|
||||||
|
extern __u16 acked;
|
||||||
|
extern int pipesize;
|
||||||
|
Index: iputils/tracepath.c
|
||||||
|
===================================================================
|
||||||
|
--- iputils.orig/tracepath.c
|
||||||
|
+++ iputils/tracepath.c
|
||||||
|
@@ -75,7 +75,7 @@ int recverr(int fd, int ttl)
|
||||||
|
int sndhops;
|
||||||
|
int progress = -1;
|
||||||
|
int broken_router;
|
||||||
|
-
|
||||||
|
+
|
||||||
|
restart:
|
||||||
|
memset(&rcvbuf, -1, sizeof(rcvbuf));
|
||||||
|
iov.iov_base = &rcvbuf;
|
||||||
|
@@ -124,8 +124,8 @@ restart:
|
||||||
|
e = (struct sock_extended_err *) CMSG_DATA(cmsg);
|
||||||
|
} else if (cmsg->cmsg_type == IP_TTL) {
|
||||||
|
rethops = *(int*)CMSG_DATA(cmsg);
|
||||||
|
- } else {
|
||||||
|
- printf("cmsg:%d\n ", cmsg->cmsg_type);
|
||||||
|
+ } else {
|
||||||
|
+ printf("cmsg:%d\n ", cmsg->cmsg_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -330,7 +330,7 @@ main(int argc, char **argv)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ttl=1; ttl<32; ttl++) {
|
||||||
|
- int res;
|
||||||
|
+ int res = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
on = ttl;
|
||||||
|
Index: iputils/tracepath6.c
|
||||||
|
===================================================================
|
||||||
|
--- iputils.orig/tracepath6.c
|
||||||
|
+++ iputils/tracepath6.c
|
||||||
|
@@ -364,7 +364,7 @@ int main(int argc, char **argv)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ttl=1; ttl<32; ttl++) {
|
||||||
|
- int res;
|
||||||
|
+ int res = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
on = ttl;
|
||||||
|
Index: iputils/ifenslave.c
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null
|
||||||
|
+++ iputils/ifenslave.c
|
||||||
|
@@ -0,0 +1,770 @@
|
||||||
|
+/* Mode: C;
|
||||||
|
+ * ifenslave.c: Configure network interfaces for parallel routing.
|
||||||
|
+ *
|
||||||
|
+ * This program controls the Linux implementation of running multiple
|
||||||
|
+ * network interfaces in parallel.
|
||||||
|
+ *
|
||||||
|
+ * Usage: ifenslave [-v] master-interface < slave-interface [metric <N>] > ...
|
||||||
|
+ *
|
||||||
|
+ * Author: Donald Becker <becker@cesdis.gsfc.nasa.gov>
|
||||||
|
+ * Copyright 1994-1996 Donald Becker
|
||||||
|
+ *
|
||||||
|
+ * 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.
|
||||||
|
+ *
|
||||||
|
+ * The author may be reached as becker@CESDIS.gsfc.nasa.gov, or C/O
|
||||||
|
+ * Center of Excellence in Space Data and Information Sciences
|
||||||
|
+ * Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
|
||||||
|
+ *
|
||||||
|
+ * Changes :
|
||||||
|
+ * - 2000/10/02 Willy Tarreau <willy at meta-x.org> :
|
||||||
|
+ * - few fixes. Master's MAC address is now correctly taken from
|
||||||
|
+ * the first device when not previously set ;
|
||||||
|
+ * - detach support : call BOND_RELEASE to detach an enslaved interface.
|
||||||
|
+ * - give a mini-howto from command-line help : # ifenslave -h
|
||||||
|
+ *
|
||||||
|
+ * - 2001/02/16 Chad N. Tindel <ctindel at ieee dot org> :
|
||||||
|
+ * - Master is now brought down before setting the MAC address. In
|
||||||
|
+ * the 2.4 kernel you can't change the MAC address while the device is
|
||||||
|
+ * up because you get EBUSY.
|
||||||
|
+ *
|
||||||
|
+ * - 2001/09/13 Takao Indoh <indou dot takao at jp dot fujitsu dot com>
|
||||||
|
+ * - Added the ability to change the active interface on a mode 1 bond
|
||||||
|
+ * at runtime.
|
||||||
|
+ *
|
||||||
|
+ * - 2001/10/23 Chad N. Tindel <ctindel at ieee dot org> :
|
||||||
|
+ * - No longer set the MAC address of the master. The bond device will
|
||||||
|
+ * take care of this itself
|
||||||
|
+ * - Try the SIOC*** versions of the bonding ioctls before using the
|
||||||
|
+ * old versions
|
||||||
|
+ * - 2002/02/18 Erik Habbinga <erik_habbinga @ hp dot com> :
|
||||||
|
+ * - ifr2.ifr_flags was not initialized in the hwaddr_notset case,
|
||||||
|
+ * SIOCGIFFLAGS now called before hwaddr_notset test
|
||||||
|
+ *
|
||||||
|
+ * - 2002/10/31 Tony Cureington <tony.cureington * hp_com> :
|
||||||
|
+ * - If the master does not have a hardware address when the first slave
|
||||||
|
+ * is enslaved, the master is assigned the hardware address of that
|
||||||
|
+ * slave - there is a comment in bonding.c stating "ifenslave takes
|
||||||
|
+ * care of this now." This corrects the problem of slaves having
|
||||||
|
+ * different hardware addresses in active-backup mode when
|
||||||
|
+ * multiple interfaces are specified on a single ifenslave command
|
||||||
|
+ * (ifenslave bond0 eth0 eth1).
|
||||||
|
+ *
|
||||||
|
+ * - 2003/03/18 - Tsippy Mendelson <tsippy.mendelson at intel dot com> and
|
||||||
|
+ * Shmulik Hen <shmulik.hen at intel dot com>
|
||||||
|
+ * - Moved setting the slave's mac address and openning it, from
|
||||||
|
+ * the application to the driver. This enables support of modes
|
||||||
|
+ * that need to use the unique mac address of each slave.
|
||||||
|
+ * The driver also takes care of closing the slave and restoring its
|
||||||
|
+ * original mac address upon release.
|
||||||
|
+ * In addition, block possibility of enslaving before the master is up.
|
||||||
|
+ * This prevents putting the system in an undefined state.
|
||||||
|
+ *
|
||||||
|
+ * - 2003/05/01 - Amir Noam <amir.noam at intel dot com>
|
||||||
|
+ * - Added ABI version control to restore compatibility between
|
||||||
|
+ * new/old ifenslave and new/old bonding.
|
||||||
|
+ * - Prevent adding an adapter that is already a slave.
|
||||||
|
+ * Fixes the problem of stalling the transmission and leaving
|
||||||
|
+ * the slave in a down state.
|
||||||
|
+ *
|
||||||
|
+ * - 2003/05/01 - Shmulik Hen <shmulik.hen at intel dot com>
|
||||||
|
+ * - Prevent enslaving if the bond device is down.
|
||||||
|
+ * Fixes the problem of leaving the system in unstable state and
|
||||||
|
+ * halting when trying to remove the module.
|
||||||
|
+ * - Close socket on all abnormal exists.
|
||||||
|
+ * - Add versioning scheme that follows that of the bonding driver.
|
||||||
|
+ * current version is 1.0.0 as a base line.
|
||||||
|
+ *
|
||||||
|
+ * - 2003/05/22 - Jay Vosburgh <fubar at us dot ibm dot com>
|
||||||
|
+ * - ifenslave -c was broken; it's now fixed
|
||||||
|
+ * - Fixed problem with routes vanishing from master during enslave
|
||||||
|
+ * processing.
|
||||||
|
+ *
|
||||||
|
+ * - 2003/05/27 - Amir Noam <amir.noam at intel dot com>
|
||||||
|
+ * - Fix backward compatibility issues:
|
||||||
|
+ * For drivers not using ABI versions, slave was set down while
|
||||||
|
+ * it should be left up before enslaving.
|
||||||
|
+ * Also, master was not set down and the default set_mac_address()
|
||||||
|
+ * would fail and generate an error message in the system log.
|
||||||
|
+ * - For opt_c: slave should not be set to the master's setting
|
||||||
|
+ * while it is running. It was already set during enslave. To
|
||||||
|
+ * simplify things, it is now handeled separately.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#define APP_VERSION "1.0.12"
|
||||||
|
+#define APP_RELDATE "June 30, 2003"
|
||||||
|
+#define APP_NAME "ifenslave"
|
||||||
|
+
|
||||||
|
+static char *version =
|
||||||
|
+APP_NAME ".c:v" APP_VERSION " (" APP_RELDATE ") " "\nDonald Becker (becker@cesdis.gsfc.nasa.gov).\n"
|
||||||
|
+"detach support added on 2000/10/02 by Willy Tarreau (willy at meta-x.org).\n"
|
||||||
|
+"2.4 kernel support added on 2001/02/16 by Chad N. Tindel (ctindel at ieee dot org.\n";
|
||||||
|
+
|
||||||
|
+static const char *usage_msg =
|
||||||
|
+"Usage: ifenslave [-adfrvVh] <master-interface> < <slave-if> [metric <N>] > ...\n"
|
||||||
|
+" ifenslave -c master-interface slave-if\n";
|
||||||
|
+
|
||||||
|
+static const char *howto_msg =
|
||||||
|
+"Usage: ifenslave [-adfrvVh] <master-interface> < <slave-if> [metric <N>] > ...\n"
|
||||||
|
+" ifenslave -c master-interface slave-if\n"
|
||||||
|
+"\n"
|
||||||
|
+" To create a bond device, simply follow these three steps :\n"
|
||||||
|
+" - ensure that the required drivers are properly loaded :\n"
|
||||||
|
+" # modprobe bonding ; modprobe <3c59x|eepro100|pcnet32|tulip|...>\n"
|
||||||
|
+" - assign an IP address to the bond device :\n"
|
||||||
|
+" # ifconfig bond0 <addr> netmask <mask> broadcast <bcast>\n"
|
||||||
|
+" - attach all the interfaces you need to the bond device :\n"
|
||||||
|
+" # ifenslave bond0 eth0 eth1 eth2\n"
|
||||||
|
+" If bond0 didn't have a MAC address, it will take eth0's. Then, all\n"
|
||||||
|
+" interfaces attached AFTER this assignment will get the same MAC addr.\n"
|
||||||
|
+"\n"
|
||||||
|
+" To detach a dead interface without setting the bond device down :\n"
|
||||||
|
+" # ifenslave -d bond0 eth1\n"
|
||||||
|
+"\n"
|
||||||
|
+" To set the bond device down and automatically release all the slaves :\n"
|
||||||
|
+" # ifconfig bond0 down\n"
|
||||||
|
+"\n"
|
||||||
|
+" To change active slave :\n"
|
||||||
|
+" # ifenslave -c bond0 eth0\n"
|
||||||
|
+"\n";
|
||||||
|
+
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <ctype.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
+#include <fcntl.h>
|
||||||
|
+#include <getopt.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <sys/socket.h>
|
||||||
|
+#include <sys/ioctl.h>
|
||||||
|
+#include <linux/if.h>
|
||||||
|
+#include <net/if_arp.h>
|
||||||
|
+#include <linux/if_ether.h>
|
||||||
|
+#include <linux/if_bonding.h>
|
||||||
|
+#include <linux/sockios.h>
|
||||||
|
+
|
||||||
|
+typedef unsigned long long u64; /* hack, so we may include kernel's ethtool.h */
|
||||||
|
+typedef __uint32_t u32; /* ditto */
|
||||||
|
+typedef __uint16_t u16; /* ditto */
|
||||||
|
+typedef __uint8_t u8; /* ditto */
|
||||||
|
+#include <linux/ethtool.h>
|
||||||
|
+
|
||||||
|
+struct option longopts[] = {
|
||||||
|
+ /* { name has_arg *flag val } */
|
||||||
|
+ {"all-interfaces", 0, 0, 'a'}, /* Show all interfaces. */
|
||||||
|
+ {"force", 0, 0, 'f'}, /* Force the operation. */
|
||||||
|
+ {"help", 0, 0, '?'}, /* Give help */
|
||||||
|
+ {"howto", 0, 0, 'h'}, /* Give some more help */
|
||||||
|
+ {"receive-slave", 0, 0, 'r'}, /* Make a receive-only slave. */
|
||||||
|
+ {"verbose", 0, 0, 'v'}, /* Report each action taken. */
|
||||||
|
+ {"version", 0, 0, 'V'}, /* Emit version information. */
|
||||||
|
+ {"detach", 0, 0, 'd'}, /* Detach a slave interface. */
|
||||||
|
+ {"change-active", 0, 0, 'c'}, /* Change the active slave. */
|
||||||
|
+ { 0, 0, 0, 0 }
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/* Command-line flags. */
|
||||||
|
+unsigned int
|
||||||
|
+opt_a = 0, /* Show-all-interfaces flag. */
|
||||||
|
+opt_f = 0, /* Force the operation. */
|
||||||
|
+opt_r = 0, /* Set up a Rx-only slave. */
|
||||||
|
+opt_d = 0, /* detach a slave interface. */
|
||||||
|
+opt_c = 0, /* change-active-slave flag. */
|
||||||
|
+verbose = 0, /* Verbose flag. */
|
||||||
|
+opt_version = 0,
|
||||||
|
+opt_howto = 0;
|
||||||
|
+int skfd = -1; /* AF_INET socket for ioctl() calls. */
|
||||||
|
+
|
||||||
|
+static void if_print(char *ifname);
|
||||||
|
+static int get_abi_ver(char *master_ifname);
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+main(int argc, char **argv)
|
||||||
|
+{
|
||||||
|
+ struct ifreq ifr2, if_hwaddr, if_ipaddr, if_metric, if_mtu, if_dstaddr;
|
||||||
|
+ struct ifreq if_netmask, if_brdaddr, if_flags;
|
||||||
|
+ int rv, goterr = 0;
|
||||||
|
+ int c, errflag = 0;
|
||||||
|
+ sa_family_t master_family;
|
||||||
|
+ char **spp, *master_ifname, *slave_ifname;
|
||||||
|
+ int hwaddr_notset;
|
||||||
|
+ int abi_ver = 0;
|
||||||
|
+
|
||||||
|
+ while ((c = getopt_long(argc, argv, "acdfrvV?h", longopts, 0)) != EOF)
|
||||||
|
+ switch (c) {
|
||||||
|
+ case 'a': opt_a++; break;
|
||||||
|
+ case 'f': opt_f++; break;
|
||||||
|
+ case 'r': opt_r++; break;
|
||||||
|
+ case 'd': opt_d++; break;
|
||||||
|
+ case 'c': opt_c++; break;
|
||||||
|
+ case 'v': verbose++; break;
|
||||||
|
+ case 'V': opt_version++; break;
|
||||||
|
+ case 'h': opt_howto++; break;
|
||||||
|
+ case '?': errflag++;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* option check */
|
||||||
|
+ if (opt_c)
|
||||||
|
+ if(opt_a || opt_f || opt_r || opt_d || verbose || opt_version ||
|
||||||
|
+ opt_howto || errflag ) {
|
||||||
|
+ fprintf(stderr, usage_msg);
|
||||||
|
+ return 2;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (errflag) {
|
||||||
|
+ fprintf(stderr, usage_msg);
|
||||||
|
+ return 2;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (opt_howto) {
|
||||||
|
+ fprintf(stderr, howto_msg);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (verbose || opt_version) {
|
||||||
|
+ printf(version);
|
||||||
|
+ if (opt_version)
|
||||||
|
+ exit(0);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Open a basic socket. */
|
||||||
|
+ if ((skfd = socket(AF_INET, SOCK_DGRAM,0)) < 0) {
|
||||||
|
+ perror("socket");
|
||||||
|
+ exit(-1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (verbose)
|
||||||
|
+ fprintf(stderr, "DEBUG: argc=%d, optind=%d and argv[optind] is %s.\n",
|
||||||
|
+ argc, optind, argv[optind]);
|
||||||
|
+
|
||||||
|
+ /* No remaining args means show all interfaces. */
|
||||||
|
+ if (optind == argc) {
|
||||||
|
+ if_print((char *)NULL);
|
||||||
|
+ (void) close(skfd);
|
||||||
|
+ exit(0);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Copy the interface name. */
|
||||||
|
+ spp = argv + optind;
|
||||||
|
+ master_ifname = *spp++;
|
||||||
|
+ slave_ifname = *spp++;
|
||||||
|
+
|
||||||
|
+ /* Check command line. */
|
||||||
|
+ if (opt_c) {
|
||||||
|
+ char **tempp = spp;
|
||||||
|
+ if ((master_ifname == NULL)||(slave_ifname == NULL)||(*tempp++ != NULL)) {
|
||||||
|
+ fprintf(stderr, usage_msg);
|
||||||
|
+ (void) close(skfd);
|
||||||
|
+ return 2;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* A single args means show the configuration for this interface. */
|
||||||
|
+ if (slave_ifname == NULL) {
|
||||||
|
+ if_print(master_ifname);
|
||||||
|
+ (void) close(skfd);
|
||||||
|
+ exit(0);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* exchange abi version with bonding driver */
|
||||||
|
+ abi_ver = get_abi_ver(master_ifname);
|
||||||
|
+ if (abi_ver < 0) {
|
||||||
|
+ (void) close(skfd);
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Get the vitals from the master interface. */
|
||||||
|
+ {
|
||||||
|
+ struct ifreq *ifra[7] = { &if_ipaddr, &if_mtu, &if_dstaddr,
|
||||||
|
+ &if_brdaddr, &if_netmask, &if_flags,
|
||||||
|
+ &if_hwaddr };
|
||||||
|
+ const char *req_name[7] = {
|
||||||
|
+ "IP address", "MTU", "destination address",
|
||||||
|
+ "broadcast address", "netmask", "status flags",
|
||||||
|
+ "hardware address" };
|
||||||
|
+ const int ioctl_req_type[7] = {
|
||||||
|
+ SIOCGIFADDR, SIOCGIFMTU, SIOCGIFDSTADDR,
|
||||||
|
+ SIOCGIFBRDADDR, SIOCGIFNETMASK, SIOCGIFFLAGS,
|
||||||
|
+ SIOCGIFHWADDR };
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < 7; i++) {
|
||||||
|
+ strncpy(ifra[i]->ifr_name, master_ifname, IFNAMSIZ);
|
||||||
|
+ if (ioctl(skfd, ioctl_req_type[i], ifra[i]) < 0) {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "Something broke getting the master's %s: %s.\n",
|
||||||
|
+ req_name[i], strerror(errno));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* check if master is up; if not then fail any operation */
|
||||||
|
+ if (!(if_flags.ifr_flags & IFF_UP)) {
|
||||||
|
+ fprintf(stderr, "Illegal operation; the specified master interface '%s' is not up.\n", master_ifname);
|
||||||
|
+ (void) close(skfd);
|
||||||
|
+ exit (1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ hwaddr_notset = 1; /* assume master's address not set yet */
|
||||||
|
+ for (i = 0; hwaddr_notset && (i < 6); i++) {
|
||||||
|
+ hwaddr_notset &= ((unsigned char *)if_hwaddr.ifr_hwaddr.sa_data)[i] == 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* The family '1' is ARPHRD_ETHER for ethernet. */
|
||||||
|
+ if (if_hwaddr.ifr_hwaddr.sa_family != 1 && !opt_f) {
|
||||||
|
+ fprintf(stderr, "The specified master interface '%s' is not"
|
||||||
|
+ " ethernet-like.\n This program is designed to work"
|
||||||
|
+ " with ethernet-like network interfaces.\n"
|
||||||
|
+ " Use the '-f' option to force the operation.\n",
|
||||||
|
+ master_ifname);
|
||||||
|
+ (void) close(skfd);
|
||||||
|
+ exit (1);
|
||||||
|
+ }
|
||||||
|
+ master_family = if_hwaddr.ifr_hwaddr.sa_family;
|
||||||
|
+ if (verbose) {
|
||||||
|
+ unsigned char *hwaddr = (unsigned char *)if_hwaddr.ifr_hwaddr.sa_data;
|
||||||
|
+ printf("The current hardware address (SIOCGIFHWADDR) of %s is type %d "
|
||||||
|
+ "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x.\n", master_ifname,
|
||||||
|
+ if_hwaddr.ifr_hwaddr.sa_family, hwaddr[0], hwaddr[1],
|
||||||
|
+ hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5]);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ /* do this when enslaving interfaces */
|
||||||
|
+ do {
|
||||||
|
+ if (opt_d) { /* detach a slave interface from the master */
|
||||||
|
+ strncpy(if_flags.ifr_name, master_ifname, IFNAMSIZ);
|
||||||
|
+ strncpy(if_flags.ifr_slave, slave_ifname, IFNAMSIZ);
|
||||||
|
+ if ((ioctl(skfd, SIOCBONDRELEASE, &if_flags) < 0) &&
|
||||||
|
+ (ioctl(skfd, BOND_RELEASE_OLD, &if_flags) < 0)) {
|
||||||
|
+ fprintf(stderr, "SIOCBONDRELEASE: cannot detach %s from %s. errno=%s.\n",
|
||||||
|
+ slave_ifname, master_ifname, strerror(errno));
|
||||||
|
+ }
|
||||||
|
+ else if (abi_ver < 1) {
|
||||||
|
+ /* The driver is using an old ABI, so we'll set the interface
|
||||||
|
+ * down to avoid any conflicts due to same IP/MAC
|
||||||
|
+ */
|
||||||
|
+ strncpy(ifr2.ifr_name, slave_ifname, IFNAMSIZ);
|
||||||
|
+ if (ioctl(skfd, SIOCGIFFLAGS, &ifr2) < 0) {
|
||||||
|
+ int saved_errno = errno;
|
||||||
|
+ fprintf(stderr, "SIOCGIFFLAGS on %s failed: %s\n", slave_ifname,
|
||||||
|
+ strerror(saved_errno));
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ ifr2.ifr_flags &= ~(IFF_UP | IFF_RUNNING);
|
||||||
|
+ if (ioctl(skfd, SIOCSIFFLAGS, &ifr2) < 0) {
|
||||||
|
+ int saved_errno = errno;
|
||||||
|
+ fprintf(stderr, "Shutting down interface %s failed: %s\n",
|
||||||
|
+ slave_ifname, strerror(saved_errno));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } else if (opt_c) { /* change primary slave */
|
||||||
|
+ strncpy(if_flags.ifr_name, master_ifname, IFNAMSIZ);
|
||||||
|
+ strncpy(if_flags.ifr_slave, slave_ifname, IFNAMSIZ);
|
||||||
|
+ if ((ioctl(skfd, SIOCBONDCHANGEACTIVE, &if_flags) < 0) &&
|
||||||
|
+ (ioctl(skfd, BOND_CHANGE_ACTIVE_OLD, &if_flags) < 0)) {
|
||||||
|
+ fprintf(stderr, "SIOCBONDCHANGEACTIVE: %s.\n", strerror(errno));
|
||||||
|
+ }
|
||||||
|
+ } else { /* attach a slave interface to the master */
|
||||||
|
+
|
||||||
|
+ strncpy(ifr2.ifr_name, slave_ifname, IFNAMSIZ);
|
||||||
|
+ if (ioctl(skfd, SIOCGIFFLAGS, &ifr2) < 0) {
|
||||||
|
+ int saved_errno = errno;
|
||||||
|
+ fprintf(stderr, "SIOCGIFFLAGS on %s failed: %s\n", slave_ifname,
|
||||||
|
+ strerror(saved_errno));
|
||||||
|
+ (void) close(skfd);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ((ifr2.ifr_flags & IFF_SLAVE) && !opt_r) {
|
||||||
|
+ fprintf(stderr, "%s is already a slave\n", slave_ifname);
|
||||||
|
+ (void) close(skfd);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* if hwaddr_notset, assign the slave hw address to the master */
|
||||||
|
+ if (hwaddr_notset) {
|
||||||
|
+ /* assign the slave hw address to the
|
||||||
|
+ * master since it currently does not
|
||||||
|
+ * have one; otherwise, slaves may
|
||||||
|
+ * have different hw addresses in
|
||||||
|
+ * active-backup mode as seen when enslaving
|
||||||
|
+ * using "ifenslave bond0 eth0 eth1" because
|
||||||
|
+ * hwaddr_notset is set outside this loop.
|
||||||
|
+ * TODO: put this and the "else" portion in
|
||||||
|
+ * a function.
|
||||||
|
+ */
|
||||||
|
+ /* get the slaves MAC address */
|
||||||
|
+ strncpy(if_hwaddr.ifr_name, slave_ifname,
|
||||||
|
+ IFNAMSIZ);
|
||||||
|
+ rv = ioctl(skfd, SIOCGIFHWADDR, &if_hwaddr);
|
||||||
|
+ if (-1 == rv) {
|
||||||
|
+ fprintf(stderr, "Could not get MAC "
|
||||||
|
+ "address of %s: %s\n",
|
||||||
|
+ slave_ifname,
|
||||||
|
+ strerror(errno));
|
||||||
|
+ strncpy(if_hwaddr.ifr_name,
|
||||||
|
+ master_ifname, IFNAMSIZ);
|
||||||
|
+ goterr = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!goterr) {
|
||||||
|
+ if (abi_ver < 1) {
|
||||||
|
+ /* In ABI versions older than 1, the
|
||||||
|
+ * master's set_mac routine couldn't
|
||||||
|
+ * work if it was up, because it
|
||||||
|
+ * used the default ethernet set_mac
|
||||||
|
+ * function.
|
||||||
|
+ */
|
||||||
|
+ /* bring master down */
|
||||||
|
+ if_flags.ifr_flags &= ~IFF_UP;
|
||||||
|
+ if (ioctl(skfd, SIOCSIFFLAGS,
|
||||||
|
+ &if_flags) < 0) {
|
||||||
|
+ goterr = 1;
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "Shutting down "
|
||||||
|
+ "interface %s failed: "
|
||||||
|
+ "%s\n",
|
||||||
|
+ master_ifname,
|
||||||
|
+ strerror(errno));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ strncpy(if_hwaddr.ifr_name,
|
||||||
|
+ master_ifname, IFNAMSIZ);
|
||||||
|
+ if (ioctl(skfd, SIOCSIFHWADDR,
|
||||||
|
+ &if_hwaddr) < 0) {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "Could not set MAC "
|
||||||
|
+ "address of %s: %s\n",
|
||||||
|
+ master_ifname,
|
||||||
|
+ strerror(errno));
|
||||||
|
+ goterr=1;
|
||||||
|
+ } else {
|
||||||
|
+ hwaddr_notset = 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (abi_ver < 1) {
|
||||||
|
+ /* bring master back up */
|
||||||
|
+ if_flags.ifr_flags |= IFF_UP;
|
||||||
|
+ if (ioctl(skfd, SIOCSIFFLAGS,
|
||||||
|
+ &if_flags) < 0) {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "Bringing up interface "
|
||||||
|
+ "%s failed: %s\n",
|
||||||
|
+ master_ifname,
|
||||||
|
+ strerror(errno));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } else if (abi_ver < 1) { /* if (hwaddr_notset) */
|
||||||
|
+
|
||||||
|
+ /* The driver is using an old ABI, so we'll set the interface
|
||||||
|
+ * down and assign the master's hwaddr to it
|
||||||
|
+ */
|
||||||
|
+ if (ifr2.ifr_flags & IFF_UP) {
|
||||||
|
+ ifr2.ifr_flags &= ~IFF_UP;
|
||||||
|
+ if (ioctl(skfd, SIOCSIFFLAGS, &ifr2) < 0) {
|
||||||
|
+ int saved_errno = errno;
|
||||||
|
+ fprintf(stderr, "Shutting down interface %s failed: %s\n",
|
||||||
|
+ slave_ifname, strerror(saved_errno));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ strncpy(if_hwaddr.ifr_name, slave_ifname, IFNAMSIZ);
|
||||||
|
+ if (ioctl(skfd, SIOCSIFHWADDR, &if_hwaddr) < 0) {
|
||||||
|
+ int saved_errno = errno;
|
||||||
|
+ fprintf(stderr, "SIOCSIFHWADDR on %s failed: %s\n", if_hwaddr.ifr_name,
|
||||||
|
+ strerror(saved_errno));
|
||||||
|
+ if (saved_errno == EBUSY)
|
||||||
|
+ fprintf(stderr, " The slave device %s is busy: it must be"
|
||||||
|
+ " idle before running this command.\n", slave_ifname);
|
||||||
|
+ else if (saved_errno == EOPNOTSUPP)
|
||||||
|
+ fprintf(stderr, " The slave device you specified does not support"
|
||||||
|
+ " setting the MAC address.\n Your kernel likely does not"
|
||||||
|
+ " support slave devices.\n");
|
||||||
|
+ else if (saved_errno == EINVAL)
|
||||||
|
+ fprintf(stderr, " The slave device's address type does not match"
|
||||||
|
+ " the master's address type.\n");
|
||||||
|
+ } else {
|
||||||
|
+ if (verbose) {
|
||||||
|
+ unsigned char *hwaddr = if_hwaddr.ifr_hwaddr.sa_data;
|
||||||
|
+ printf("Slave's (%s) hardware address set to "
|
||||||
|
+ "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x.\n", slave_ifname,
|
||||||
|
+ hwaddr[0], hwaddr[1], hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5]);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (*spp && !strcmp(*spp, "metric")) {
|
||||||
|
+ if (*++spp == NULL) {
|
||||||
|
+ fprintf(stderr, usage_msg);
|
||||||
|
+ (void) close(skfd);
|
||||||
|
+ exit(2);
|
||||||
|
+ }
|
||||||
|
+ if_metric.ifr_metric = atoi(*spp);
|
||||||
|
+ strncpy(if_metric.ifr_name, slave_ifname, IFNAMSIZ);
|
||||||
|
+ if (ioctl(skfd, SIOCSIFMETRIC, &if_metric) < 0) {
|
||||||
|
+ fprintf(stderr, "SIOCSIFMETRIC on %s: %s\n", slave_ifname,
|
||||||
|
+ strerror(errno));
|
||||||
|
+ goterr = 1;
|
||||||
|
+ }
|
||||||
|
+ spp++;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (strncpy(if_ipaddr.ifr_name, slave_ifname, IFNAMSIZ) <= 0
|
||||||
|
+ || ioctl(skfd, SIOCSIFADDR, &if_ipaddr) < 0) {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "Something broke setting the slave's address: %s.\n",
|
||||||
|
+ strerror(errno));
|
||||||
|
+ } else {
|
||||||
|
+ if (verbose) {
|
||||||
|
+ unsigned char *ipaddr = if_ipaddr.ifr_addr.sa_data;
|
||||||
|
+ printf("Set the slave's (%s) IP address to %d.%d.%d.%d.\n",
|
||||||
|
+ slave_ifname, ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (strncpy(if_mtu.ifr_name, slave_ifname, IFNAMSIZ) <= 0
|
||||||
|
+ || ioctl(skfd, SIOCSIFMTU, &if_mtu) < 0) {
|
||||||
|
+ fprintf(stderr, "Something broke setting the slave MTU: %s.\n",
|
||||||
|
+ strerror(errno));
|
||||||
|
+ } else {
|
||||||
|
+ if (verbose)
|
||||||
|
+ printf("Set the slave's (%s) MTU to %d.\n", slave_ifname, if_mtu.ifr_mtu);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (strncpy(if_dstaddr.ifr_name, slave_ifname, IFNAMSIZ) <= 0
|
||||||
|
+ || ioctl(skfd, SIOCSIFDSTADDR, &if_dstaddr) < 0) {
|
||||||
|
+ fprintf(stderr, "Error setting the slave (%s) with SIOCSIFDSTADDR: %s.\n",
|
||||||
|
+ slave_ifname, strerror(errno));
|
||||||
|
+ } else {
|
||||||
|
+ if (verbose) {
|
||||||
|
+ unsigned char *ipaddr = if_dstaddr.ifr_dstaddr.sa_data;
|
||||||
|
+ printf("Set the slave's (%s) destination address to %d.%d.%d.%d.\n",
|
||||||
|
+ slave_ifname, ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (strncpy(if_brdaddr.ifr_name, slave_ifname, IFNAMSIZ) <= 0
|
||||||
|
+ || ioctl(skfd, SIOCSIFBRDADDR, &if_brdaddr) < 0) {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "Something broke setting the slave (%s) broadcast address: %s.\n",
|
||||||
|
+ slave_ifname, strerror(errno));
|
||||||
|
+ } else {
|
||||||
|
+ if (verbose) {
|
||||||
|
+ unsigned char *ipaddr = if_brdaddr.ifr_broadaddr.sa_data;
|
||||||
|
+ printf("Set the slave's (%s) broadcast address to %d.%d.%d.%d.\n",
|
||||||
|
+ slave_ifname, ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (strncpy(if_netmask.ifr_name, slave_ifname, IFNAMSIZ) <= 0
|
||||||
|
+ || ioctl(skfd, SIOCSIFNETMASK, &if_netmask) < 0) {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "Something broke setting the slave (%s) netmask: %s.\n",
|
||||||
|
+ slave_ifname, strerror(errno));
|
||||||
|
+ } else {
|
||||||
|
+ if (verbose) {
|
||||||
|
+ unsigned char *ipaddr = if_netmask.ifr_netmask.sa_data;
|
||||||
|
+ printf("Set the slave's (%s) netmask to %d.%d.%d.%d.\n",
|
||||||
|
+ slave_ifname, ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (abi_ver < 1) {
|
||||||
|
+
|
||||||
|
+ /* The driver is using an old ABI, so we'll set the interface
|
||||||
|
+ * up before enslaving it
|
||||||
|
+ */
|
||||||
|
+ ifr2.ifr_flags |= IFF_UP;
|
||||||
|
+ if ((ifr2.ifr_flags &= ~(IFF_SLAVE | IFF_MASTER)) == 0
|
||||||
|
+ || strncpy(ifr2.ifr_name, slave_ifname, IFNAMSIZ) <= 0
|
||||||
|
+ || ioctl(skfd, SIOCSIFFLAGS, &ifr2) < 0) {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "Something broke setting the slave (%s) flags: %s.\n",
|
||||||
|
+ slave_ifname, strerror(errno));
|
||||||
|
+ } else {
|
||||||
|
+ if (verbose)
|
||||||
|
+ printf("Set the slave's (%s) flags %4.4x.\n",
|
||||||
|
+ slave_ifname, if_flags.ifr_flags);
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ /* the bonding module takes care of setting the slave's mac address
|
||||||
|
+ * and opening its interface
|
||||||
|
+ */
|
||||||
|
+ if (ifr2.ifr_flags & IFF_UP) { /* the interface will need to be down */
|
||||||
|
+ ifr2.ifr_flags &= ~IFF_UP;
|
||||||
|
+ if (ioctl(skfd, SIOCSIFFLAGS, &ifr2) < 0) {
|
||||||
|
+ int saved_errno = errno;
|
||||||
|
+ fprintf(stderr, "Shutting down interface %s failed: %s\n",
|
||||||
|
+ slave_ifname, strerror(saved_errno));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Do the real thing */
|
||||||
|
+ if (!opt_r) {
|
||||||
|
+ strncpy(if_flags.ifr_name, master_ifname, IFNAMSIZ);
|
||||||
|
+ strncpy(if_flags.ifr_slave, slave_ifname, IFNAMSIZ);
|
||||||
|
+ if ((ioctl(skfd, SIOCBONDENSLAVE, &if_flags) < 0) &&
|
||||||
|
+ (ioctl(skfd, BOND_ENSLAVE_OLD, &if_flags) < 0)) {
|
||||||
|
+ fprintf(stderr, "SIOCBONDENSLAVE: %s.\n", strerror(errno));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } while ( (slave_ifname = *spp++) != NULL);
|
||||||
|
+
|
||||||
|
+ /* Close the socket. */
|
||||||
|
+ (void) close(skfd);
|
||||||
|
+
|
||||||
|
+ return(goterr);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static short mif_flags;
|
||||||
|
+
|
||||||
|
+/* Get the inteface configuration from the kernel. */
|
||||||
|
+static int if_getconfig(char *ifname)
|
||||||
|
+{
|
||||||
|
+ struct ifreq ifr;
|
||||||
|
+ int metric, mtu; /* Parameters of the master interface. */
|
||||||
|
+ struct sockaddr dstaddr, broadaddr, netmask;
|
||||||
|
+
|
||||||
|
+ strcpy(ifr.ifr_name, ifname);
|
||||||
|
+ if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0)
|
||||||
|
+ return -1;
|
||||||
|
+ mif_flags = ifr.ifr_flags;
|
||||||
|
+ printf("The result of SIOCGIFFLAGS on %s is %x.\n",
|
||||||
|
+ ifname, ifr.ifr_flags);
|
||||||
|
+
|
||||||
|
+ strcpy(ifr.ifr_name, ifname);
|
||||||
|
+ if (ioctl(skfd, SIOCGIFADDR, &ifr) < 0)
|
||||||
|
+ return -1;
|
||||||
|
+ printf("The result of SIOCGIFADDR is %2.2x.%2.2x.%2.2x.%2.2x.\n",
|
||||||
|
+ ifr.ifr_addr.sa_data[0], ifr.ifr_addr.sa_data[1],
|
||||||
|
+ ifr.ifr_addr.sa_data[2], ifr.ifr_addr.sa_data[3]);
|
||||||
|
+
|
||||||
|
+ strcpy(ifr.ifr_name, ifname);
|
||||||
|
+ if (ioctl(skfd, SIOCGIFHWADDR, &ifr) < 0)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ {
|
||||||
|
+ /* Gotta convert from 'char' to unsigned for printf(). */
|
||||||
|
+ unsigned char *hwaddr = (unsigned char *)ifr.ifr_hwaddr.sa_data;
|
||||||
|
+ printf("The result of SIOCGIFHWADDR is type %d "
|
||||||
|
+ "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x.\n",
|
||||||
|
+ ifr.ifr_hwaddr.sa_family, hwaddr[0], hwaddr[1],
|
||||||
|
+ hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5]);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ strcpy(ifr.ifr_name, ifname);
|
||||||
|
+ if (ioctl(skfd, SIOCGIFMETRIC, &ifr) < 0) {
|
||||||
|
+ metric = 0;
|
||||||
|
+ } else
|
||||||
|
+ metric = ifr.ifr_metric;
|
||||||
|
+
|
||||||
|
+ strcpy(ifr.ifr_name, ifname);
|
||||||
|
+ if (ioctl(skfd, SIOCGIFMTU, &ifr) < 0)
|
||||||
|
+ mtu = 0;
|
||||||
|
+ else
|
||||||
|
+ mtu = ifr.ifr_mtu;
|
||||||
|
+
|
||||||
|
+ strcpy(ifr.ifr_name, ifname);
|
||||||
|
+ if (ioctl(skfd, SIOCGIFDSTADDR, &ifr) < 0) {
|
||||||
|
+ memset(&dstaddr, 0, sizeof(struct sockaddr));
|
||||||
|
+ } else
|
||||||
|
+ dstaddr = ifr.ifr_dstaddr;
|
||||||
|
+
|
||||||
|
+ strcpy(ifr.ifr_name, ifname);
|
||||||
|
+ if (ioctl(skfd, SIOCGIFBRDADDR, &ifr) < 0) {
|
||||||
|
+ memset(&broadaddr, 0, sizeof(struct sockaddr));
|
||||||
|
+ } else
|
||||||
|
+ broadaddr = ifr.ifr_broadaddr;
|
||||||
|
+
|
||||||
|
+ strcpy(ifr.ifr_name, ifname);
|
||||||
|
+ if (ioctl(skfd, SIOCGIFNETMASK, &ifr) < 0) {
|
||||||
|
+ memset(&netmask, 0, sizeof(struct sockaddr));
|
||||||
|
+ } else
|
||||||
|
+ netmask = ifr.ifr_netmask;
|
||||||
|
+
|
||||||
|
+ return(0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void if_print(char *ifname)
|
||||||
|
+{
|
||||||
|
+ char buff[1024];
|
||||||
|
+ struct ifconf ifc;
|
||||||
|
+ struct ifreq *ifr;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ if (ifname == (char *)NULL) {
|
||||||
|
+ ifc.ifc_len = sizeof(buff);
|
||||||
|
+ ifc.ifc_buf = buff;
|
||||||
|
+ if (ioctl(skfd, SIOCGIFCONF, &ifc) < 0) {
|
||||||
|
+ fprintf(stderr, "SIOCGIFCONF: %s\n", strerror(errno));
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ifr = ifc.ifc_req;
|
||||||
|
+ for (i = ifc.ifc_len / sizeof(struct ifreq); --i >= 0; ifr++) {
|
||||||
|
+ if (if_getconfig(ifr->ifr_name) < 0) {
|
||||||
|
+ fprintf(stderr, "%s: unknown interface.\n",
|
||||||
|
+ ifr->ifr_name);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (((mif_flags & IFF_UP) == 0) && !opt_a) continue;
|
||||||
|
+ /*ife_print(&ife);*/
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ if (if_getconfig(ifname) < 0)
|
||||||
|
+ fprintf(stderr, "%s: unknown interface.\n", ifname);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int get_abi_ver(char *master_ifname)
|
||||||
|
+{
|
||||||
|
+ struct ifreq ifr;
|
||||||
|
+ struct ethtool_drvinfo info;
|
||||||
|
+ int abi_ver = 0;
|
||||||
|
+
|
||||||
|
+ memset(&ifr, 0, sizeof(ifr));
|
||||||
|
+ strncpy(ifr.ifr_name, master_ifname, IFNAMSIZ);
|
||||||
|
+ ifr.ifr_data = (caddr_t)&info;
|
||||||
|
+
|
||||||
|
+ info.cmd = ETHTOOL_GDRVINFO;
|
||||||
|
+ strncpy(info.driver, "ifenslave", 32);
|
||||||
|
+ snprintf(info.fw_version, 32, "%d", BOND_ABI_VERSION);
|
||||||
|
+ if (ioctl(skfd, SIOCETHTOOL, &ifr) >= 0) {
|
||||||
|
+ char *endptr;
|
||||||
|
+
|
||||||
|
+ abi_ver = strtoul(info.fw_version, &endptr, 0);
|
||||||
|
+ if (*endptr) {
|
||||||
|
+ fprintf(stderr, "Error: got invalid string as an ABI "
|
||||||
|
+ "version from the bonding module\n");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (verbose) {
|
||||||
|
+ printf("ABI ver is %d\n", abi_ver);
|
||||||
|
+ }
|
||||||
|
+ return abi_ver;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Local variables:
|
||||||
|
+ * version-control: t
|
||||||
|
+ * kept-new-versions: 5
|
||||||
|
+ * c-indent-level: 4
|
||||||
|
+ * c-basic-offset: 4
|
||||||
|
+ * tab-width: 4
|
||||||
|
+ * compile-command: "gcc -Wall -Wstrict-prototypes -O -I/usr/src/linux/include ifenslave.c -o ifenslave"
|
||||||
|
+ * End:
|
||||||
|
+ */
|
239
iputils.changes
Normal file
239
iputils.changes
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Dec 6 15:24:00 CET 2006 - ms@suse.de
|
||||||
|
|
||||||
|
- ping_common.c: added check for oversized packages (-s) (#222010)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Nov 23 17:04:15 CET 2006 - olh@suse.de
|
||||||
|
|
||||||
|
- move ifenslave.c to the first patch to allow quilt setup *.spec
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Nov 22 11:47:46 CET 2006 - ms@suse.de
|
||||||
|
|
||||||
|
- ping6: use getaddrinfo() instead of gethostbyname2 (#221745)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Nov 10 12:26:57 CET 2006 - ro@suse.de
|
||||||
|
|
||||||
|
- fix manpage permissions
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Aug 7 20:38:57 CEST 2006 - aj@suse.de
|
||||||
|
|
||||||
|
- use sysconf(_SC_CLK_TCK) instead of HZ
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Mar 1 15:47:50 CET 2006 - schwab@suse.de
|
||||||
|
|
||||||
|
- ifenslave: fix display of interface address.
|
||||||
|
- Don't strip binaries.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jan 25 21:36:41 CET 2006 - mls@suse.de
|
||||||
|
|
||||||
|
- converted neededforbuild to BuildRequires
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jan 23 13:45:37 CET 2006 - mmj@suse.de
|
||||||
|
|
||||||
|
- Fix ping6 [#143932]
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jul 8 10:34:54 CEST 2005 - mmj@suse.de
|
||||||
|
|
||||||
|
- Patch from ak which allows to use the standard ping6
|
||||||
|
link-local-addr%interface syntax instead of ping6 -I interface
|
||||||
|
link-local-addr.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jun 16 09:58:16 CEST 2005 - mmj@suse.de
|
||||||
|
|
||||||
|
- Compile with -fpie, link with -pie
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Sep 3 11:40:14 CEST 2004 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Fix compiling with new glibc headers
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Mar 19 12:07:00 CET 2004 - mmj@suse.de
|
||||||
|
|
||||||
|
- Use correct permissions for manpages [#36321]
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Mar 17 13:16:15 CET 2004 - mmj@suse.de
|
||||||
|
|
||||||
|
- Add Olaf Kirch patch to only do name lookup once in ping [#36161]
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jan 12 13:20:18 CET 2004 - mmj@suse.de
|
||||||
|
|
||||||
|
- Update ifenslave.c to the one from linux-2.6.1
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Oct 16 12:17:57 CEST 2003 - mmj@suse.de
|
||||||
|
|
||||||
|
- Don't build as root
|
||||||
|
- Cleanup a bit
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jun 4 15:40:48 CEST 2003 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Don't include net/if.h and linux/if.h at the same time
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon May 12 13:43:31 CEST 2003 - mmj@suse.de
|
||||||
|
|
||||||
|
- Update to newest snapshot, ss021109
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Feb 24 20:44:28 CET 2003 - schwab@suse.de
|
||||||
|
|
||||||
|
- Fix use of kernel headers.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Oct 30 11:36:11 CET 2002 - mmj@suse.de
|
||||||
|
|
||||||
|
- Apply patch for the ping/ping6 manpage to mention the -R option
|
||||||
|
is for IPv4 only.
|
||||||
|
- Clean up the specfile a bit.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Oct 25 08:25:20 CEST 2002 - mmj@suse.de
|
||||||
|
|
||||||
|
- Apply patch for setuid() return value check from Thomas Biege
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Oct 2 13:40:50 CEST 2002 - mmj@suse.de
|
||||||
|
|
||||||
|
- Add the ifenslave binary from the kernel Documentation directory
|
||||||
|
[#20372]
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Oct 1 15:28:16 CEST 2002 - mmj@suse.de
|
||||||
|
|
||||||
|
- Update to snapshot 020927 which among other things should have
|
||||||
|
below fix merged.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Aug 8 16:42:52 CEST 2002 - mmj@suse.de
|
||||||
|
|
||||||
|
- Apply other patch to fix the dynamic IP problem and still allows
|
||||||
|
the from address to be printed. Thanks to Olaf Kirch. [#17519]
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Jul 28 09:25:06 CEST 2002 - kukuk@suse.de
|
||||||
|
|
||||||
|
- remove unused tetex from neededforbuild
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jul 25 18:23:55 CEST 2002 - mmj@suse.de
|
||||||
|
|
||||||
|
- Disabled traceroute6
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jul 5 19:39:39 CEST 2002 - bk@suse.de
|
||||||
|
|
||||||
|
- fix build on ia64(use glibc kernel headers, not /usr/src/linux)
|
||||||
|
- add optflags
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jul 4 21:22:16 MEST 2002 - bk@suse.de
|
||||||
|
|
||||||
|
- add fix for buffer overflow problem in traceroute6.c(datalen.patch)
|
||||||
|
- add fix for ipv6 error printing problem (ping6-errorprinting.patch)
|
||||||
|
- add patch to activate the rdisc server (rdisc-server.patch)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jun 17 14:41:30 CEST 2002 - mmj@suse.de
|
||||||
|
|
||||||
|
- Revert back to the ping from iputils, and apply patch to fix
|
||||||
|
the dynamic ip problem.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jun 10 15:27:18 CEST 2002 - mmj@suse.de
|
||||||
|
|
||||||
|
- Use old nkitb ping which works with dynamic IP [#12568]
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Feb 4 15:57:00 CET 2002 - mmj@suse.de
|
||||||
|
|
||||||
|
- Update to snapshot from January 24th 2002
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jan 22 14:38:43 CET 2002 - mmj@suse.de
|
||||||
|
|
||||||
|
- Update to snapshot from December 2nd 2001
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Dec 10 15:51:04 CET 2001 - bjacke@suse.de
|
||||||
|
|
||||||
|
- move arping to /sbin/
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Oct 10 15:01:25 CEST 2001 - mmj@suse.de
|
||||||
|
|
||||||
|
- Update to snapshot from October 2 2001
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Sep 6 16:20:30 CEST 2001 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Remove wrong warning about to old kernel and warning about
|
||||||
|
problems with the clock from ping (ping has a special handler
|
||||||
|
for this, so it is okay). Both only confuses tester [Bug #10141
|
||||||
|
and Bug #10146].
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Aug 25 12:53:59 CEST 2001 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Update to snapshot from 24 Aug 2001
|
||||||
|
- Use included ping like all other distributions do
|
||||||
|
- Don't use included rarpd and tftpd
|
||||||
|
- Lot of new functions and minor bug fixes
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jun 18 16:19:41 CEST 2001 - schwab@suse.de
|
||||||
|
|
||||||
|
- Fix use of cpp directives inside macro call.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Mar 30 14:07:34 CEST 2001 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Use ping6 from inet6-apps package [Bug #6354]
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Mar 12 11:57:23 CET 2001 - schwab@suse.de
|
||||||
|
|
||||||
|
- Fix use of kernel headers.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Mar 9 16:39:25 CET 2001 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Add ping and ping.8 manual page from OpenBSD.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Mar 5 10:50:44 CET 2001 - kukuk@suse.de
|
||||||
|
|
||||||
|
- fix to build with current glibc
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Feb 14 15:50:22 CET 2001 - uli@suse.de
|
||||||
|
|
||||||
|
- fixed to build on PPC
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Nov 11 13:30:26 CET 2000 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Update to new version (20001110).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Oct 14 15:15:11 CEST 2000 - kukuk@suse.de
|
||||||
|
|
||||||
|
- spec file fixes
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Oct 14 14:14:51 CEST 2000 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Initial version
|
||||||
|
|
222
iputils.spec
Normal file
222
iputils.spec
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
#
|
||||||
|
# spec file for package iputils (Version ss021109)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
|
# This file and all modifications and additions to the pristine
|
||||||
|
# package are under the same license as the package itself.
|
||||||
|
#
|
||||||
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
# norootforbuild
|
||||||
|
|
||||||
|
Name: iputils
|
||||||
|
Summary: IPv4and IPv6 Networking Utilities
|
||||||
|
Version: ss021109
|
||||||
|
Release: 190
|
||||||
|
License: BSD License and BSD-like, GNU General Public License (GPL)
|
||||||
|
Group: Productivity/Networking/Other
|
||||||
|
Provides: nkitb
|
||||||
|
Obsoletes: nkitb
|
||||||
|
URL: ftp://ftp.tux.org/people/alexey-kuznetsov/ip-routing
|
||||||
|
Source: iputils-%{version}-try.tar.bz2
|
||||||
|
Patch: %name-%version.diff
|
||||||
|
Patch1: %name-%version-rdisc-server.patch
|
||||||
|
Patch2: %name-%version-sec-traceroute6-setuid-retvalcheck.diff
|
||||||
|
Patch3: %name-%version-sec-ping6-setuid-retvalcheck.diff
|
||||||
|
Patch4: %name-%version-sec-ping-setuid-retvalcheck.diff
|
||||||
|
Patch5: %name-%version-ping-R-option-doc.diff
|
||||||
|
Patch6: %name-headers.patch
|
||||||
|
Patch7: %name-%version-pingnamelookuponce.diff
|
||||||
|
Patch8: %name-ss021109-traceroute6-stdint.diff
|
||||||
|
Patch9: %name-ADDLIB.diff
|
||||||
|
Patch10: %name-ss021109-locallinksyntax.diff
|
||||||
|
Patch11: iputils-ss021109-ping6kernel261x.diff
|
||||||
|
Patch12: %name-ifenslave.patch
|
||||||
|
Patch13: %name-HZ.patch
|
||||||
|
Patch14: %name-%version-ping6_getaddrinfo.patch
|
||||||
|
Patch15: %name-%version-ping_common.dif
|
||||||
|
Prefix: %_prefix
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
|
%description
|
||||||
|
This package contains some small network tools for IPv4 and IPv6 like
|
||||||
|
rdisc, ping6, traceroute6, tracepath, and tracepath6.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Authors:
|
||||||
|
--------
|
||||||
|
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -n %name
|
||||||
|
%patch -p1
|
||||||
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
%patch4 -p1
|
||||||
|
%patch5 -p1
|
||||||
|
%patch6
|
||||||
|
%patch7 -p1
|
||||||
|
%patch8
|
||||||
|
%patch9
|
||||||
|
%patch10 -p1
|
||||||
|
%patch11 -p1
|
||||||
|
%patch12
|
||||||
|
%patch13
|
||||||
|
%patch14
|
||||||
|
%patch15
|
||||||
|
mkdir linux
|
||||||
|
touch linux/autoconf.h
|
||||||
|
|
||||||
|
%build
|
||||||
|
make KERNEL_INCLUDE=$PWD DEFINES='%optflags -fpie' ADDLIB='-pie'
|
||||||
|
gcc $RPM_OPT_FLAGS -o ifenslave ifenslave.c
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%_sbindir
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/{bin,sbin}
|
||||||
|
install arping $RPM_BUILD_ROOT/sbin/
|
||||||
|
install ifenslave $RPM_BUILD_ROOT/sbin/
|
||||||
|
install clockdiff $RPM_BUILD_ROOT/sbin/
|
||||||
|
install rdisc $RPM_BUILD_ROOT/sbin/in.rdisc
|
||||||
|
install ping $RPM_BUILD_ROOT/bin
|
||||||
|
install ping6 $RPM_BUILD_ROOT/bin
|
||||||
|
install ipg $RPM_BUILD_ROOT/bin
|
||||||
|
install tracepath $RPM_BUILD_ROOT/sbin
|
||||||
|
install tracepath6 $RPM_BUILD_ROOT/sbin
|
||||||
|
mkdir -p $RPM_BUILD_ROOT%_mandir/man8
|
||||||
|
install -m 644 doc/arping.8 $RPM_BUILD_ROOT%_mandir/man8/
|
||||||
|
install -m 644 doc/clockdiff.8 $RPM_BUILD_ROOT%_mandir/man8/
|
||||||
|
install -m 644 doc/tracepath.8 $RPM_BUILD_ROOT%_mandir/man8/
|
||||||
|
install -m 644 doc/ping.8 $RPM_BUILD_ROOT%_mandir/man8/
|
||||||
|
install -m 644 doc/ping.8 $RPM_BUILD_ROOT%_mandir/man8/ping6.8
|
||||||
|
install -m 644 doc/pg3.8 $RPM_BUILD_ROOT%_mandir/man8/
|
||||||
|
install -m 644 doc/rdisc.8 $RPM_BUILD_ROOT%_mandir/man8/
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%doc RELNOTES
|
||||||
|
/sbin/arping
|
||||||
|
/sbin/ifenslave
|
||||||
|
/sbin/clockdiff
|
||||||
|
%attr(4755,root,root) /bin/ping
|
||||||
|
%attr(4755,root,root) /bin/ping6
|
||||||
|
/bin/ipg
|
||||||
|
/sbin/tracepath
|
||||||
|
/sbin/tracepath6
|
||||||
|
/sbin/in.rdisc
|
||||||
|
%attr(644,root,root) %_mandir/man8/*
|
||||||
|
|
||||||
|
%changelog -n iputils
|
||||||
|
* Wed Dec 06 2006 - ms@suse.de
|
||||||
|
- ping_common.c: added check for oversized packages (-s) (#222010)
|
||||||
|
* Thu Nov 23 2006 - olh@suse.de
|
||||||
|
- move ifenslave.c to the first patch to allow quilt setup *.spec
|
||||||
|
* Wed Nov 22 2006 - ms@suse.de
|
||||||
|
- ping6: use getaddrinfo() instead of gethostbyname2 (#221745)
|
||||||
|
* Fri Nov 10 2006 - ro@suse.de
|
||||||
|
- fix manpage permissions
|
||||||
|
* Mon Aug 07 2006 - aj@suse.de
|
||||||
|
- use sysconf(_SC_CLK_TCK) instead of HZ
|
||||||
|
* Wed Mar 01 2006 - schwab@suse.de
|
||||||
|
- ifenslave: fix display of interface address.
|
||||||
|
- Don't strip binaries.
|
||||||
|
* Wed Jan 25 2006 - mls@suse.de
|
||||||
|
- converted neededforbuild to BuildRequires
|
||||||
|
* Mon Jan 23 2006 - mmj@suse.de
|
||||||
|
- Fix ping6 [#143932]
|
||||||
|
* Fri Jul 08 2005 - mmj@suse.de
|
||||||
|
- Patch from ak which allows to use the standard ping6
|
||||||
|
link-local-addr%%interface syntax instead of ping6 -I interface
|
||||||
|
link-local-addr.
|
||||||
|
* Thu Jun 16 2005 - mmj@suse.de
|
||||||
|
- Compile with -fpie, link with -pie
|
||||||
|
* Fri Sep 03 2004 - kukuk@suse.de
|
||||||
|
- Fix compiling with new glibc headers
|
||||||
|
* Fri Mar 19 2004 - mmj@suse.de
|
||||||
|
- Use correct permissions for manpages [#36321]
|
||||||
|
* Wed Mar 17 2004 - mmj@suse.de
|
||||||
|
- Add Olaf Kirch patch to only do name lookup once in ping [#36161]
|
||||||
|
* Mon Jan 12 2004 - mmj@suse.de
|
||||||
|
- Update ifenslave.c to the one from linux-2.6.1
|
||||||
|
* Thu Oct 16 2003 - mmj@suse.de
|
||||||
|
- Don't build as root
|
||||||
|
- Cleanup a bit
|
||||||
|
* Wed Jun 04 2003 - kukuk@suse.de
|
||||||
|
- Don't include net/if.h and linux/if.h at the same time
|
||||||
|
* Mon May 12 2003 - mmj@suse.de
|
||||||
|
- Update to newest snapshot, ss021109
|
||||||
|
* Mon Feb 24 2003 - schwab@suse.de
|
||||||
|
- Fix use of kernel headers.
|
||||||
|
* Wed Oct 30 2002 - mmj@suse.de
|
||||||
|
- Apply patch for the ping/ping6 manpage to mention the -R option
|
||||||
|
is for IPv4 only.
|
||||||
|
- Clean up the specfile a bit.
|
||||||
|
* Fri Oct 25 2002 - mmj@suse.de
|
||||||
|
- Apply patch for setuid() return value check from Thomas Biege
|
||||||
|
* Wed Oct 02 2002 - mmj@suse.de
|
||||||
|
- Add the ifenslave binary from the kernel Documentation directory
|
||||||
|
[#20372]
|
||||||
|
* Tue Oct 01 2002 - mmj@suse.de
|
||||||
|
- Update to snapshot 020927 which among other things should have
|
||||||
|
below fix merged.
|
||||||
|
* Thu Aug 08 2002 - mmj@suse.de
|
||||||
|
- Apply other patch to fix the dynamic IP problem and still allows
|
||||||
|
the from address to be printed. Thanks to Olaf Kirch. [#17519]
|
||||||
|
* Sun Jul 28 2002 - kukuk@suse.de
|
||||||
|
- remove unused tetex from neededforbuild
|
||||||
|
* Thu Jul 25 2002 - mmj@suse.de
|
||||||
|
- Disabled traceroute6
|
||||||
|
* Fri Jul 05 2002 - bk@suse.de
|
||||||
|
- fix build on ia64(use glibc kernel headers, not /usr/src/linux)
|
||||||
|
- add optflags
|
||||||
|
* Thu Jul 04 2002 - bk@suse.de
|
||||||
|
- add fix for buffer overflow problem in traceroute6.c(datalen.patch)
|
||||||
|
- add fix for ipv6 error printing problem (ping6-errorprinting.patch)
|
||||||
|
- add patch to activate the rdisc server (rdisc-server.patch)
|
||||||
|
* Mon Jun 17 2002 - mmj@suse.de
|
||||||
|
- Revert back to the ping from iputils, and apply patch to fix
|
||||||
|
the dynamic ip problem.
|
||||||
|
* Mon Jun 10 2002 - mmj@suse.de
|
||||||
|
- Use old nkitb ping which works with dynamic IP [#12568]
|
||||||
|
* Mon Feb 04 2002 - mmj@suse.de
|
||||||
|
- Update to snapshot from January 24th 2002
|
||||||
|
* Tue Jan 22 2002 - mmj@suse.de
|
||||||
|
- Update to snapshot from December 2nd 2001
|
||||||
|
* Mon Dec 10 2001 - bjacke@suse.de
|
||||||
|
- move arping to /sbin/
|
||||||
|
* Wed Oct 10 2001 - mmj@suse.de
|
||||||
|
- Update to snapshot from October 2 2001
|
||||||
|
* Thu Sep 06 2001 - kukuk@suse.de
|
||||||
|
- Remove wrong warning about to old kernel and warning about
|
||||||
|
problems with the clock from ping (ping has a special handler
|
||||||
|
for this, so it is okay). Both only confuses tester [Bug #10141
|
||||||
|
and Bug #10146].
|
||||||
|
* Sat Aug 25 2001 - kukuk@suse.de
|
||||||
|
- Update to snapshot from 24 Aug 2001
|
||||||
|
- Use included ping like all other distributions do
|
||||||
|
- Don't use included rarpd and tftpd
|
||||||
|
- Lot of new functions and minor bug fixes
|
||||||
|
* Mon Jun 18 2001 - schwab@suse.de
|
||||||
|
- Fix use of cpp directives inside macro call.
|
||||||
|
* Fri Mar 30 2001 - kukuk@suse.de
|
||||||
|
- Use ping6 from inet6-apps package [Bug #6354]
|
||||||
|
* Mon Mar 12 2001 - schwab@suse.de
|
||||||
|
- Fix use of kernel headers.
|
||||||
|
* Fri Mar 09 2001 - kukuk@suse.de
|
||||||
|
- Add ping and ping.8 manual page from OpenBSD.
|
||||||
|
* Mon Mar 05 2001 - kukuk@suse.de
|
||||||
|
- fix to build with current glibc
|
||||||
|
* Wed Feb 14 2001 - uli@suse.de
|
||||||
|
- fixed to build on PPC
|
||||||
|
* Sat Nov 11 2000 - kukuk@suse.de
|
||||||
|
- Update to new version (20001110).
|
||||||
|
* Sat Oct 14 2000 - kukuk@suse.de
|
||||||
|
- spec file fixes
|
||||||
|
* Sat Oct 14 2000 - kukuk@suse.de
|
||||||
|
- Initial version
|
Loading…
Reference in New Issue
Block a user