- Resolves: #218706 - now defines the destination address along RFC3484

- Resolves: #229630 - ifenslave(8) man page added
- Resolves: #213716 - arping doesn't work on InfiniBand ipoib interfaces
This commit is contained in:
Martin Bacovsky 2007-02-26 14:48:23 +00:00
parent 10cb7c84fa
commit 02525b9fbc
3 changed files with 192 additions and 17 deletions

View File

@ -0,0 +1,174 @@
--- iputils/Makefile.infiniband 2007-02-22 15:53:04.000000000 +0100
+++ iputils/Makefile 2007-02-22 15:55:05.000000000 +0100
@@ -45,6 +45,8 @@
rdisc_srv.o: rdisc.c
$(CC) $(CFLAGS) -DRDISC_SERVER -o rdisc_srv.o rdisc.c
+arping: arping.o
+ $(CC) $(LDFLAGS) arping.o $(LOADLIBES) $(LDLIBS) -lsysfs -o arping
check-kernel:
ifeq ($(KERNEL_INCLUDE),)
--- iputils/arping.c.infiniband 2007-02-22 15:53:04.000000000 +0100
+++ iputils/arping.c 2007-02-22 15:53:05.000000000 +0100
@@ -29,6 +29,7 @@
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <sysfs/libsysfs.h>
#include "SNAPSHOT.h"
@@ -48,8 +49,13 @@
int s;
int broadcast_only;
-struct sockaddr_ll me;
-struct sockaddr_ll he;
+/*
+ * Make these two structs have padding at the end so the overly long Infiniband
+ * hardware addresses can have the remainder of their address tacked onto
+ * the end of the struct without overlapping anything.
+ */
+struct sockaddr_ll me[2];
+struct sockaddr_ll he[2];
struct timeval start, last;
@@ -124,7 +130,8 @@
p+=4;
gettimeofday(&now, NULL);
- err = sendto(s, buf, p-buf, 0, (struct sockaddr*)HE, sizeof(*HE));
+ err = sendto(s, buf, p-buf, 0, (struct sockaddr*)HE, (ah->ar_hln > 8) ?
+ sizeof(*HE) + ah->ar_hln - 8 : sizeof(*HE));
if (err == p-buf) {
last = now;
sent++;
@@ -174,7 +181,7 @@
if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
count--;
- send_pack(s, src, dst, &me, &he);
+ send_pack(s, src, dst, &me[0], &he[0]);
if (count == 0 && unsolicited)
finish();
}
@@ -221,7 +228,7 @@
return 0;
if (ah->ar_pln != 4)
return 0;
- if (ah->ar_hln != me.sll_halen)
+ if (ah->ar_hln != me[0].sll_halen)
return 0;
if (len < sizeof(*ah) + 2*(4 + ah->ar_hln))
return 0;
@@ -232,7 +239,7 @@
return 0;
if (src.s_addr != dst_ip.s_addr)
return 0;
- if (memcmp(p+ah->ar_hln+4, &me.sll_addr, ah->ar_hln))
+ if (memcmp(p+ah->ar_hln+4, &me[0].sll_addr, ah->ar_hln))
return 0;
} else {
/* DAD packet was:
@@ -250,7 +257,7 @@
*/
if (src_ip.s_addr != dst.s_addr)
return 0;
- if (memcmp(p, &me.sll_addr, me.sll_halen) == 0)
+ if (memcmp(p, &me[0].sll_addr, me[0].sll_halen) == 0)
return 0;
if (src.s_addr && src.s_addr != dst_ip.s_addr)
return 0;
@@ -266,7 +273,7 @@
printf("for %s ", inet_ntoa(dst_ip));
s_printed = 1;
}
- if (memcmp(p+ah->ar_hln+4, me.sll_addr, ah->ar_hln)) {
+ if (memcmp(p+ah->ar_hln+4, me[0].sll_addr, ah->ar_hln)) {
if (!s_printed)
printf("for ");
printf("[");
@@ -292,7 +299,7 @@
if (quit_on_reply)
finish();
if(!broadcast_only) {
- memcpy(he.sll_addr, p, me.sll_halen);
+ memcpy(he[0].sll_addr, p, me[0].sll_halen);
unicasting=1;
}
return 1;
@@ -458,9 +465,9 @@
close(probe_fd);
};
- me.sll_family = AF_PACKET;
- me.sll_ifindex = ifindex;
- me.sll_protocol = htons(ETH_P_ARP);
+ me[0].sll_family = AF_PACKET;
+ me[0].sll_ifindex = ifindex;
+ me[0].sll_protocol = htons(ETH_P_ARP);
if (bind(s, (struct sockaddr*)&me, sizeof(me)) == -1) {
perror("bind");
exit(2);
@@ -473,14 +480,37 @@
exit(2);
}
}
- if (me.sll_halen == 0) {
+ if (me[0].sll_halen == 0) {
if (!quiet)
printf("Interface \"%s\" is not ARPable (no ll address)\n", device);
exit(dad?0:2);
}
-
- he = me;
- memset(he.sll_addr, -1, he.sll_halen);
+ he[0] = me[0];
+ he[1] = me[1];
+ {
+ struct sysfs_class_device *dev;
+ struct sysfs_attribute *brdcast;
+ char *next_ch;
+
+ dev = sysfs_open_class_device("net", device);
+ if (!dev) {
+ perror("sysfs class device");
+ exit(2);
+ }
+ brdcast = sysfs_get_classdev_attr(dev, "broadcast");
+ if (!brdcast) {
+ perror("sysfs attribute broadcast");
+ exit(2);
+ }
+ if (sysfs_read_attribute(brdcast)) {
+ perror("sysfs read brdcast");
+ exit(2);
+ }
+ for (ch=0; ch<he[0].sll_halen; ch++) {
+ he[0].sll_addr[ch] = strtol(brdcast->value + (ch*3),
+ &next_ch, 16);
+ }
+ }
if (!quiet) {
printf("ARPING %s ", inet_ntoa(dst));
@@ -500,7 +530,7 @@
while(1) {
sigset_t sset, osset;
unsigned char packet[4096];
- struct sockaddr_ll from;
+ struct sockaddr_ll from[2];
int alen = sizeof(from);
int cc;
@@ -513,7 +543,7 @@
sigaddset(&sset, SIGALRM);
sigaddset(&sset, SIGINT);
sigprocmask(SIG_BLOCK, &sset, &osset);
- recv_pack(packet, cc, &from);
+ recv_pack(packet, cc, &from[0]);
if(received == count)
exit(0);
sigprocmask(SIG_SETMASK, &osset, NULL);

View File

@ -1,7 +1,7 @@
Summary: Network monitoring tools including ping.
Summary: Network monitoring tools including ping
Name: iputils
Version: 20020927
Release: 41%{?dist}
Release: 42%{?dist}
License: BSD
Group: System Environment/Daemons
Source0: http://www.tux.org/pub/net/ip-routing/%{name}-ss020927.tar.gz
@ -19,9 +19,7 @@ Patch8: iputils-20020927-headers.patch
Patch9: iputils-20020927-unaligned.patch
Patch10: iputils-20020927-inet_pton.patch
Patch11: iputils-retvals.patch
#Patch12: iputils-arping.patch
Patch13: iputils-20020927-ia64_align.patch
Patch14: iputils-arping_buf_overflow.patch
Patch15: iputils-20020927-12-arping.patch
Patch16: iputils-getaddrinfo.patch
Patch17: iputils-flood.patch
@ -31,12 +29,15 @@ Patch20: iputils-gcc41.patch
Patch21: iputils-ping_cleanup.patch
Patch22: iputils-ifenslave.patch
Patch23: iputils-20020927-trace_stop.patch
Patch24: iputils-20020927-ping6-rfc3484.patch
Patch25: iputils-20020927-arping-infiniband.patch
Prefix: %{_prefix}
BuildRoot: %{_tmppath}/%{name}-root
BuildPreReq: docbook-utils perl-SGMLSpm
BuildPreReq: glibc-kernheaders >= 2.4-8.19
PreReq: chkconfig
BuildRequires: libsysfs-devel
%description
The iputils package contains basic utilities for monitoring a network,
@ -59,9 +60,7 @@ the target machine is alive and receiving network traffic.
%patch9 -p1 -b .unaligned
%patch10 -p1 -b .inet_pton
%patch11 -p1 -b .retvals
#%patch12 -b .arping
%patch13 -p1 -b .align
%patch14 -p1 -b .buf_overflow
%patch15 -p1 -b .timeout
%patch16 -p1 -b .getaddrinfo
%patch17 -p1 -b .flood
@ -71,6 +70,8 @@ the target machine is alive and receiving network traffic.
%patch21 -p1 -b .cleanup
%patch22 -p1 -b .addr
%patch23 -p1 -b .trace_stop
%patch24 -p1 -b .rfc3484
%patch25 -p1 -b .infiniband
%build
%ifarch s390 s390x
@ -103,13 +104,11 @@ install -c rdisc ${RPM_BUILD_ROOT}/sbin/
install -c ping6 ${RPM_BUILD_ROOT}/bin/
install -c tracepath ${RPM_BUILD_ROOT}/bin/
install -c tracepath6 ${RPM_BUILD_ROOT}/bin/
#install -c traceroute6 ${RPM_BUILD_ROOT}/bin/
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
ln -sf /bin/ping6 ${RPM_BUILD_ROOT}%{_sbindir}
ln -sf /bin/tracepath ${RPM_BUILD_ROOT}%{_sbindir}
ln -sf /bin/tracepath6 ${RPM_BUILD_ROOT}%{_sbindir}
#ln -sf /bin/traceroute6 ${RPM_BUILD_ROOT}%{_sbindir}
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man8
install -c doc/clockdiff.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/
@ -121,7 +120,6 @@ install -c ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/
ln -s %{_mandir}/man8/ping.8.gz ${RPM_BUILD_ROOT}%{_mandir}/man8/ping6.8.gz
ln -s %{_mandir}/man8/tracepath.8.gz ${RPM_BUILD_ROOT}%{_mandir}/man8/tracepath6.8.gz
#install service
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/rc.d/init.d
install -m 755 %SOURCE3 ${RPM_BUILD_ROOT}%{_sysconfdir}/rc.d/init.d/rdisc
@ -144,16 +142,16 @@ fi
rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(-,root,root)
%defattr(-,root,root,-)
%doc RELNOTES README.bonding
%{_sbindir}/clockdiff
%ifos linux
/sbin/arping
%{_sbindir}/arping
%attr(4755,root,root) /bin/ping
%attr(4755,root,root) /bin/ping
/sbin/ifenslave
%else
%attr(4755,root,root) %{_sbindir}/ping
%attr(4755,root,root) %{_sbindir}/ping
%{_sbindir}/arping
%{_sbindir}/ifenslave
%endif
@ -161,15 +159,18 @@ rm -rf ${RPM_BUILD_ROOT}
%attr(4755,root,root) /bin/ping6
/bin/tracepath
/bin/tracepath6
#%attr(4755,root,root)/bin/traceroute6
%{_sbindir}/ping6
%{_sbindir}/tracepath
%{_sbindir}/tracepath6
#%{_sbindir}/traceroute6
%attr(0644,root,root) %{_mandir}/man8/*
%config(noreplace) %{_sysconfdir}/rc.d/init.d/rdisc
%attr(644,root,root) %{_mandir}/man8/*
%{_sysconfdir}/rc.d/init.d/rdisc
%changelog
* Thu Feb 22 2007 Martin Bacovsky <mbacovsk@redhat.com>- 20020927-42
- Resolves: #218706 - now defines the destination address along RFC3484
- Resolves: #229630 - ifenslave(8) man page added
- Resolves: #213716 - arping doesn't work on InfiniBand ipoib interfaces
* Wed Sep 13 2006 Radek Vokal <rvokal@redhat.com> - 20020927-41
- new ifenslave/bonding documentation

View File

@ -1,3 +1,3 @@
b5493f7a2997130a4f86c486c9993b86 iputils-ss020927.tar.gz
349c02b907d61a143876f85cbd006c89 rdisc.initd
6c3f8bffe792b2b49a99aefcf730e72f ifenslave.tar.gz
7b1b81338efea21dd5ecac3fd1f89c1b ifenslave.tar.gz