Update patches
This commit is contained in:
parent
e355996ccc
commit
c5503791d8
@ -1,6 +1,6 @@
|
||||
--- iputils/Makefile.rh7 2002-09-20 20:23:55.000000000 +0200
|
||||
+++ iputils/Makefile 2004-05-12 15:08:25.638310270 +0200
|
||||
@@ -12,9 +12,9 @@ ADDLIB=
|
||||
--- a/Makefile 2012-10-11 08:36:40.000000000 +0200
|
||||
+++ b/Makefile 2012-10-15 11:53:14.663426710 +0200
|
||||
@@ -26,9 +26,9 @@ endif
|
||||
|
||||
CC=gcc
|
||||
# What a pity, all new gccs are buggy and -Werror does not work. Sigh.
|
||||
|
@ -1,21 +1,13 @@
|
||||
diff -up iputils-s20100418/Makefile.idn iputils-s20100418/Makefile
|
||||
--- iputils-s20100418/Makefile.idn 2010-04-20 16:07:59.018479157 +0200
|
||||
+++ iputils-s20100418/Makefile 2010-04-20 16:10:06.389481427 +0200
|
||||
@@ -28,8 +28,13 @@ all: $(TARGETS)
|
||||
|
||||
tftpd: tftpd.o tftpsubs.o
|
||||
-arping: arping.o -lsysfs
|
||||
+arping: arping.o
|
||||
+
|
||||
--- iputils-s20121011/Makefile.orig 2012-10-15 12:30:47.000000000 +0200
|
||||
+++ iputils-s20121011/Makefile 2012-10-15 12:31:53.057830727 +0200
|
||||
@@ -48,7 +48,7 @@
|
||||
arping: arping.o
|
||||
$(LINK.o) -o $@ $^ $(LIB_SYSFS) $(LIB_CAP)
|
||||
ping: ping.o ping_common.o
|
||||
-ping6: ping6.o ping_common.o -lresolv -lcrypto
|
||||
+ $(CC) $(CFLAGS) $(LDFLAGS) ping.o ping_common.o -lidn -o ping
|
||||
+
|
||||
+ping6: ping6.o ping_common.o
|
||||
+ $(CC) $(CFLAGS) $(LDFLAGS) ping6.o ping_common.o -lresolv -lcrypto -o ping6
|
||||
+
|
||||
ping.o ping6.o ping_common.o: ping_common.h
|
||||
tftpd.o tftpsubs.o: tftp.h
|
||||
- $(LINK.o) -o $@ $^ $(LIB_CAP)
|
||||
+ $(LINK.o) -o $@ $^ -lidn $(LIB_CAP)
|
||||
ping6: ping6.o ping_common.o
|
||||
$(LINK.o) -o $@ $^ -lresolv -lcrypto $(LIB_CAP)
|
||||
|
||||
diff -up iputils-s20100418/ping.c.idn iputils-s20100418/ping.c
|
||||
--- iputils-s20100418/ping.c.idn 2010-04-20 16:07:59.038484302 +0200
|
||||
@ -95,4 +87,3 @@ diff -up iputils-s20100418/ping_common.c.idn iputils-s20100418/ping_common.c
|
||||
+ setlocale(LC_ALL, "");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,15 +1,3 @@
|
||||
diff -up iputils-s20100418/ping6.c.corr_type iputils-s20100418/ping6.c
|
||||
--- iputils-s20100418/ping6.c.corr_type 2010-04-20 15:42:39.181245576 +0200
|
||||
+++ iputils-s20100418/ping6.c 2010-04-20 15:42:39.198230879 +0200
|
||||
@@ -1335,7 +1335,7 @@ parse_reply(struct msghdr *msg, int cc,
|
||||
#endif
|
||||
if (c->cmsg_len < CMSG_LEN(sizeof(int)))
|
||||
continue;
|
||||
- hops = *(int*)CMSG_DATA(c);
|
||||
+ memcpy(&hops, CMSG_DATA(c), sizeof (int));
|
||||
}
|
||||
}
|
||||
|
||||
diff -up iputils-s20100418/ping.c.corr_type iputils-s20100418/ping.c
|
||||
--- iputils-s20100418/ping.c.corr_type 2010-04-20 15:42:39.193242030 +0200
|
||||
+++ iputils-s20100418/ping.c 2010-04-20 15:42:39.199231317 +0200
|
||||
@ -62,27 +50,3 @@ diff -up iputils-s20100418/rdisc.c.corr_type iputils-s20100418/rdisc.c
|
||||
rt.rt_flags = RTF_UP | RTF_GATEWAY;
|
||||
|
||||
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
diff -up iputils-s20100418/tracepath6.c.corr_type iputils-s20100418/tracepath6.c
|
||||
--- iputils-s20100418/tracepath6.c.corr_type 2010-04-18 06:45:45.000000000 +0200
|
||||
+++ iputils-s20100418/tracepath6.c 2010-04-20 15:44:15.129480911 +0200
|
||||
@@ -173,7 +173,7 @@ restart:
|
||||
#ifdef IPV6_2292HOPLIMIT
|
||||
case IPV6_2292HOPLIMIT:
|
||||
#endif
|
||||
- rethops = *(int*)CMSG_DATA(cmsg);
|
||||
+ memcpy(&rethops, CMSG_DATA(cmsg), sizeof (int));
|
||||
break;
|
||||
default:
|
||||
printf("cmsg6:%d\n ", cmsg->cmsg_type);
|
||||
diff -up iputils-s20100418/tracepath.c.corr_type iputils-s20100418/tracepath.c
|
||||
--- iputils-s20100418/tracepath.c.corr_type 2010-04-18 06:45:45.000000000 +0200
|
||||
+++ iputils-s20100418/tracepath.c 2010-04-20 15:42:39.203240403 +0200
|
||||
@@ -145,7 +145,7 @@ restart:
|
||||
if (cmsg->cmsg_type == IP_RECVERR) {
|
||||
e = (struct sock_extended_err *) CMSG_DATA(cmsg);
|
||||
} else if (cmsg->cmsg_type == IP_TTL) {
|
||||
- rethops = *(int*)CMSG_DATA(cmsg);
|
||||
+ memcpy(&rethops, CMSG_DATA(cmsg), sizeof(int));
|
||||
} else {
|
||||
printf("cmsg:%d\n ", cmsg->cmsg_type);
|
||||
}
|
||||
|
@ -1,16 +1,17 @@
|
||||
diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
--- iputils-s20101006/arping.c.infiniband 2010-10-11 09:17:57.440390823 +0200
|
||||
+++ iputils-s20101006/arping.c 2010-10-11 09:23:36.147402252 +0200
|
||||
@@ -32,8 +32,6 @@
|
||||
--- iputils-s20121011/arping.c.orig 2012-10-16 11:31:38.542591530 +0200
|
||||
+++ iputils-s20121011/arping.c 2012-10-16 11:31:03.000000000 +0200
|
||||
@@ -35,10 +35,6 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
-#ifdef USE_SYSFS
|
||||
-#include <sysfs/libsysfs.h>
|
||||
-#endif
|
||||
-
|
||||
#include "SNAPSHOT.h"
|
||||
|
||||
static void usage(void) __attribute__((noreturn));
|
||||
@@ -52,14 +50,22 @@ int unicasting;
|
||||
@@ -57,14 +53,22 @@ int unicasting;
|
||||
int s;
|
||||
int broadcast_only;
|
||||
|
||||
@ -30,12 +31,12 @@ diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
+#define SYSFS_BROADCAST "broadcast"
|
||||
+#define SYSFS_PATH_ENV "SYSFS_PATH"
|
||||
+#define SYSFS_PATH_LEN 256
|
||||
+#define SOCKADDR_LEN (2 * sizeof(struct sockaddr_ll))
|
||||
+#define SOCKADDR_LEN (2 * sizeof(struct sockaddr_ll))
|
||||
+
|
||||
#define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
|
||||
((tv1).tv_usec-(tv2).tv_usec)/1000 )
|
||||
|
||||
@@ -166,6 +172,10 @@ void finish(void)
|
||||
@@ -171,6 +175,10 @@ void finish(void)
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
@ -46,7 +47,7 @@ diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
if (dad)
|
||||
exit(!!received);
|
||||
if (unsolicited)
|
||||
@@ -186,8 +196,7 @@ void catcher(void)
|
||||
@@ -191,8 +199,7 @@ void catcher(void)
|
||||
finish();
|
||||
|
||||
if (last.tv_sec==0 || MS_TDIFF(tv,last) > 500) {
|
||||
@ -56,7 +57,7 @@ diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
if (count == 0 && unsolicited)
|
||||
finish();
|
||||
}
|
||||
@@ -234,7 +243,7 @@ int recv_pack(unsigned char *buf, int le
|
||||
@@ -239,7 +246,7 @@ int recv_pack(unsigned char *buf, int le
|
||||
return 0;
|
||||
if (ah->ar_pln != 4)
|
||||
return 0;
|
||||
@ -65,7 +66,7 @@ diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
return 0;
|
||||
if (len < sizeof(*ah) + 2*(4 + ah->ar_hln))
|
||||
return 0;
|
||||
@@ -245,7 +254,7 @@ int recv_pack(unsigned char *buf, int le
|
||||
@@ -250,7 +257,7 @@ int recv_pack(unsigned char *buf, int le
|
||||
return 0;
|
||||
if (src.s_addr != dst_ip.s_addr)
|
||||
return 0;
|
||||
@ -74,7 +75,7 @@ diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
return 0;
|
||||
} else {
|
||||
/* DAD packet was:
|
||||
@@ -263,7 +272,7 @@ int recv_pack(unsigned char *buf, int le
|
||||
@@ -268,7 +275,7 @@ int recv_pack(unsigned char *buf, int le
|
||||
*/
|
||||
if (src_ip.s_addr != dst.s_addr)
|
||||
return 0;
|
||||
@ -83,7 +84,7 @@ diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
return 0;
|
||||
if (src.s_addr && src.s_addr != dst_ip.s_addr)
|
||||
return 0;
|
||||
@@ -279,7 +288,7 @@ int recv_pack(unsigned char *buf, int le
|
||||
@@ -284,7 +291,7 @@ int recv_pack(unsigned char *buf, int le
|
||||
printf("for %s ", inet_ntoa(dst_ip));
|
||||
s_printed = 1;
|
||||
}
|
||||
@ -92,7 +93,7 @@ diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
if (!s_printed)
|
||||
printf("for ");
|
||||
printf("[");
|
||||
@@ -305,40 +314,67 @@ int recv_pack(unsigned char *buf, int le
|
||||
@@ -310,43 +317,67 @@ int recv_pack(unsigned char *buf, int le
|
||||
if (quit_on_reply)
|
||||
finish();
|
||||
if(!broadcast_only) {
|
||||
@ -106,86 +107,89 @@ diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
-void set_device_broadcast(char *device, unsigned char *ba, size_t balen)
|
||||
+int get_sysfs_mnt_path(char *mnt_path, size_t len)
|
||||
{
|
||||
-#if USE_SYSFS
|
||||
- struct sysfs_class_device *dev;
|
||||
- struct sysfs_attribute *brdcast;
|
||||
- unsigned char *p;
|
||||
- int ch;
|
||||
+ const char *sysfs_path_env;
|
||||
+ int pth_len=0;
|
||||
+ const char *sysfs_path_env;
|
||||
+ int pth_len=0;
|
||||
|
||||
- dev = sysfs_open_class_device("net", device);
|
||||
- if (!dev) {
|
||||
- perror("sysfs_open_class_device(net)");
|
||||
- exit(2);
|
||||
- }
|
||||
+ if (len == 0 || mnt_path == NULL)
|
||||
+ return -1;
|
||||
+ if (len == 0 || mnt_path == NULL)
|
||||
+ return -1;
|
||||
|
||||
- brdcast = sysfs_get_classdev_attr(dev, "broadcast");
|
||||
- if (!brdcast) {
|
||||
- perror("sysfs_get_classdev_attr(broadcast)");
|
||||
- exit(2);
|
||||
- }
|
||||
+ /* possible overrride of real mount path */
|
||||
+ sysfs_path_env = getenv(SYSFS_PATH_ENV);
|
||||
+ memset(mnt_path, 0, len);
|
||||
+ strncpy(mnt_path,
|
||||
+ sysfs_path_env != NULL ? sysfs_path_env : SYSFS_MNT_PATH,
|
||||
+ len-1);
|
||||
+ /* possible overrride of real mount path */
|
||||
+ sysfs_path_env = getenv(SYSFS_PATH_ENV);
|
||||
+ memset(mnt_path, 0, len);
|
||||
+ strncpy(mnt_path,
|
||||
+ sysfs_path_env != NULL ? sysfs_path_env : SYSFS_MNT_PATH,
|
||||
+ len-1);
|
||||
|
||||
- if (sysfs_read_attribute(brdcast)) {
|
||||
- perror("sysfs_read_attribute");
|
||||
- exit(2);
|
||||
- }
|
||||
+ if ((pth_len = strlen(mnt_path)) > 0 && mnt_path[pth_len-1] == '/')
|
||||
+ mnt_path[pth_len-1] = '\0';
|
||||
+ if ((pth_len = strlen(mnt_path)) > 0 && mnt_path[pth_len-1] == '/')
|
||||
+ mnt_path[pth_len-1] = '\0';
|
||||
+
|
||||
+ return 0;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int make_sysfs_broadcast_path(char *broadcast_path, size_t len)
|
||||
+{
|
||||
+ char mnt_path[SYSFS_PATH_LEN];
|
||||
+ char mnt_path[SYSFS_PATH_LEN];
|
||||
+
|
||||
+ if (get_sysfs_mnt_path(mnt_path, len) != 0)
|
||||
+ return -1;
|
||||
|
||||
- for (p = ba, ch = 0; p < ba + balen; p++, ch += 3)
|
||||
- *p = strtoul(brdcast->value + ch, NULL, 16);
|
||||
+ snprintf(broadcast_path, len,
|
||||
+ "%s/" SYSFS_CLASS "/" SYSFS_NET "/%s/" SYSFS_BROADCAST,
|
||||
+ mnt_path, device);
|
||||
|
||||
- return;
|
||||
+ return 0;
|
||||
+ if (get_sysfs_mnt_path(mnt_path, len) != 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ snprintf(broadcast_path, len,
|
||||
+ "%s/" SYSFS_CLASS "/" SYSFS_NET "/%s/" SYSFS_BROADCAST,
|
||||
+ mnt_path, device);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+char * read_sysfs_broadcast(char *brdcast_path)
|
||||
+{
|
||||
+ int fd;
|
||||
+ int len_to_read;
|
||||
+ char *brdcast = NULL;
|
||||
+ int fd;
|
||||
+ int len_to_read;
|
||||
+ char *brdcast = NULL;
|
||||
+
|
||||
+ if ((fd = open(brdcast_path, O_RDONLY)) > -1) {
|
||||
+ len_to_read = lseek(fd, 0L, SEEK_END);
|
||||
+ if ((brdcast = malloc(len_to_read+1)) != NULL) {
|
||||
+ lseek(fd, 0L, SEEK_SET);
|
||||
+ memset(brdcast, 0, len_to_read+1);
|
||||
+ if (read(fd, brdcast, len_to_read) == -1) {
|
||||
+ free(brdcast);
|
||||
+ brdcast = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ close(fd);
|
||||
+ }
|
||||
+
|
||||
+ return brdcast;
|
||||
+ if ((fd = open(brdcast_path, O_RDONLY)) > -1) {
|
||||
+ len_to_read = lseek(fd, 0L, SEEK_END);
|
||||
+ if ((brdcast = malloc(len_to_read+1)) != NULL) {
|
||||
+ lseek(fd, 0L, SEEK_SET);
|
||||
+ memset(brdcast, 0, len_to_read+1);
|
||||
+ if (read(fd, brdcast, len_to_read) == -1) {
|
||||
+ free(brdcast);
|
||||
+ brdcast = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+ close(fd);
|
||||
}
|
||||
|
||||
- for (p = ba, ch = 0; p < ba + balen; p++, ch += 3)
|
||||
- *p = strtoul(brdcast->value + ch, NULL, 16);
|
||||
-#else
|
||||
- memset(ba, -1, balen);
|
||||
-#endif
|
||||
- return;
|
||||
+ return brdcast;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -356,6 +392,17 @@ main(int argc, char **argv)
|
||||
exit(-1);
|
||||
@@ -375,6 +406,17 @@ main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
+ me = malloc(SOCKADDR_LEN);
|
||||
+ if (!me) {
|
||||
@ -201,7 +205,7 @@ diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
while ((ch = getopt(argc, argv, "h?bfDUAqc:w:s:I:V")) != EOF) {
|
||||
switch(ch) {
|
||||
case 'b':
|
||||
@@ -504,34 +551,51 @@ main(int argc, char **argv)
|
||||
@@ -523,31 +565,48 @@ main(int argc, char **argv)
|
||||
close(probe_fd);
|
||||
};
|
||||
|
||||
@ -235,10 +239,7 @@ diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
|
||||
- he = me;
|
||||
+ memcpy(he, me, SOCKADDR_LEN);
|
||||
|
||||
#if 1
|
||||
- set_device_broadcast(device, ((struct sockaddr_ll *)&he)->sll_addr,
|
||||
- ((struct sockaddr_ll *)&he)->sll_halen);
|
||||
+
|
||||
+ char brdcast_path[SYSFS_PATH_LEN];
|
||||
+ char *brdcast_val=NULL;
|
||||
+ char *next_ch;
|
||||
@ -256,11 +257,24 @@ diff -up iputils-s20101006/arping.c.infiniband iputils-s20101006/arping.c
|
||||
+ for (ch=0; ch<he->sll_halen; ch++) {
|
||||
+ he->sll_addr[ch] = strtol(brdcast_val + (ch*3), &next_ch, 16);
|
||||
+ }
|
||||
+
|
||||
|
||||
- set_device_broadcast(device, ((struct sockaddr_ll *)&he)->sll_addr,
|
||||
- ((struct sockaddr_ll *)&he)->sll_halen);
|
||||
+ free(brdcast_val);
|
||||
#else
|
||||
- memset(((struct sockaddr_ll *)&he)->sll_addr, -1, ((struct sockaddr_ll *)&he)->sll_halen);
|
||||
+ memset(he->sll_addr, -1, he->sll_halen);
|
||||
#endif
|
||||
|
||||
if (!quiet) {
|
||||
printf("ARPING %s ", inet_ntoa(dst));
|
||||
--- iputils-s20121011/Makefile~ 2012-10-16 11:32:11.548574050 +0200
|
||||
+++ iputils-s20121011/Makefile 2012-10-16 11:33:19.326548839 +0200
|
||||
@@ -19,11 +19,6 @@ ifneq ($(USE_CAP),no)
|
||||
LIB_CAP = -lcap
|
||||
endif
|
||||
|
||||
-ifneq ($(USE_SYSFS),no)
|
||||
- DEFINES += -DUSE_SYSFS
|
||||
- LIB_SYSFS = -lsysfs
|
||||
-endif
|
||||
-
|
||||
CC=gcc
|
||||
# What a pity, all new gccs are buggy and -Werror does not work. Sigh.
|
||||
CCOPT=-Wstrict-prototypes -fno-strict-aliasing -Werror
|
||||
|
@ -42,12 +42,11 @@ diff -up iputils-s20100418/in6_flowlabel.h.flowlabel iputils-s20100418/in6_flowl
|
||||
+#define IPV6_FLOWLABEL_MGR 32
|
||||
+#define IPV6_FLOWINFO_SEND 33
|
||||
+
|
||||
diff -up iputils-s20100418/Makefile.flowlabel iputils-s20100418/Makefile
|
||||
--- iputils-s20100418/Makefile.flowlabel 2010-05-17 13:54:03.339556213 +0200
|
||||
+++ iputils-s20100418/Makefile 2010-05-17 13:54:03.423585869 +0200
|
||||
@@ -35,7 +35,7 @@ ping: ping.o ping_common.o
|
||||
--- iputils-s20121011/Makefile.flowlabel 2012-10-16 10:31:41.000000000 +0200
|
||||
+++ iputils-s20121011/Makefile 2012-10-16 10:33:05.687870860 +0200
|
||||
@@ -52,7 +52,7 @@
|
||||
ping6: ping6.o ping_common.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) ping6.o ping_common.o -lresolv -lcrypto -o ping6
|
||||
$(LINK.o) -o $@ $^ -lresolv -lcrypto $(LIB_CAP)
|
||||
|
||||
-ping.o ping6.o ping_common.o: ping_common.h
|
||||
+ping.o ping6.o ping_common.o: ping_common.h in6_flowlabel.h
|
||||
|
@ -1,7 +1,6 @@
|
||||
diff -up iputils-s20101006/arping.c.eth iputils-s20101006/arping.c
|
||||
--- iputils-s20101006/arping.c.eth 2011-11-10 09:06:08.101748109 +0100
|
||||
+++ iputils-s20101006/arping.c 2011-11-10 09:34:09.880501394 +0100
|
||||
@@ -37,7 +37,7 @@
|
||||
--- iputils-s20121011/arping.c.orig 2012-10-16 11:46:12.000000000 +0200
|
||||
+++ iputils-s20121011/arping.c 2012-10-16 11:49:09.746673028 +0200
|
||||
@@ -40,7 +40,7 @@
|
||||
static void usage(void) __attribute__((noreturn));
|
||||
|
||||
int quit_on_reply=0;
|
||||
@ -10,20 +9,20 @@ diff -up iputils-s20101006/arping.c.eth iputils-s20101006/arping.c
|
||||
int ifindex;
|
||||
char *source;
|
||||
struct in_addr src, dst;
|
||||
@@ -66,6 +66,11 @@ int received, brd_recv, req_recv;
|
||||
@@ -69,6 +69,11 @@ int received, brd_recv, req_recv;
|
||||
#define SYSFS_PATH_LEN 256
|
||||
#define SOCKADDR_LEN (2 * sizeof(struct sockaddr_ll))
|
||||
#define SOCKADDR_LEN (2 * sizeof(struct sockaddr_ll))
|
||||
|
||||
+#define PREF_ETH "eth"
|
||||
+#define PREF_EM "em"
|
||||
+#define PREF_ETH "eth"
|
||||
+#define PREF_EM "em"
|
||||
+
|
||||
+static char *dev_file = "/proc/self/net/dev";
|
||||
+
|
||||
#define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
|
||||
((tv1).tv_usec-(tv2).tv_usec)/1000 )
|
||||
|
||||
@@ -377,6 +382,46 @@ char * read_sysfs_broadcast(char *brdcas
|
||||
return brdcast;
|
||||
@@ -380,6 +385,46 @@ char * read_sysfs_broadcast(char *brdcas
|
||||
return brdcast;
|
||||
}
|
||||
|
||||
+/*
|
||||
@ -32,44 +31,44 @@ diff -up iputils-s20101006/arping.c.eth iputils-s20101006/arping.c
|
||||
+ */
|
||||
+char * get_first_ethernet(void)
|
||||
+{
|
||||
+ FILE *f;
|
||||
+ char buf[255], *dv, *smc;
|
||||
+ char pci[16];
|
||||
+ FILE *f;
|
||||
+ char buf[255], *dv, *smc;
|
||||
+ char pci[16];
|
||||
+
|
||||
+ memset(pci, 0, sizeof(pci));
|
||||
+ if ((f = fopen(dev_file, "r")) != NULL)
|
||||
+ {
|
||||
+ // go through network dev file
|
||||
+ while (fgets (buf, sizeof(buf), f) != NULL)
|
||||
+ {
|
||||
+ // the line describes interface
|
||||
+ if ((smc = strchr(buf, ':')) != NULL)
|
||||
+ {
|
||||
+ // trim white characters
|
||||
+ for (dv=buf, *smc=0; *dv <= ' '; dv++) ;
|
||||
+ // is "eth" (originial ethernet name) or "em" (ethernet on board)
|
||||
+ if (!strncmp(dv, PREF_ETH, strlen(PREF_ETH)) ||
|
||||
+ !strncmp(dv, PREF_EM, strlen(PREF_EM)))
|
||||
+ {
|
||||
+ return strdup(dv);
|
||||
+ }
|
||||
+ // remember the first pci NIC-card
|
||||
+ if (strlen(pci) == 0 && dv[0] == 'p' && isdigit(dv[1]))
|
||||
+ {
|
||||
+ strcpy(pci, dv);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ fclose(f);
|
||||
+ }
|
||||
+ // return pci NIC-card or nil if no if name
|
||||
+ return strlen(pci) > 0 ? strdup(pci) : 0L;
|
||||
+ memset(pci, 0, sizeof(pci));
|
||||
+ if ((f = fopen(dev_file, "r")) != NULL)
|
||||
+ {
|
||||
+ // go through network dev file
|
||||
+ while (fgets (buf, sizeof(buf), f) != NULL)
|
||||
+ {
|
||||
+ // the line describes interface
|
||||
+ if ((smc = strchr(buf, ':')) != NULL)
|
||||
+ {
|
||||
+ // trim white characters
|
||||
+ for (dv=buf, *smc=0; *dv <= ' '; dv++) ;
|
||||
+ // is "eth" (originial ethernet name) or "em" (ethernet on board)
|
||||
+ if (!strncmp(dv, PREF_ETH, strlen(PREF_ETH)) ||
|
||||
+ !strncmp(dv, PREF_EM, strlen(PREF_EM)))
|
||||
+ {
|
||||
+ return strdup(dv);
|
||||
+ }
|
||||
+ // remember the first pci NIC-card
|
||||
+ if (strlen(pci) == 0 && dv[0] == 'p' && isdigit(dv[1]))
|
||||
+ {
|
||||
+ strcpy(pci, dv);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ fclose(f);
|
||||
+ }
|
||||
+ // return pci NIC-card or nil if no if name
|
||||
+ return strlen(pci) > 0 ? strdup(pci) : 0L;
|
||||
+}
|
||||
+
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -403,6 +448,8 @@ main(int argc, char **argv)
|
||||
@@ -417,6 +462,8 @@ main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -78,7 +77,7 @@ diff -up iputils-s20101006/arping.c.eth iputils-s20101006/arping.c
|
||||
while ((ch = getopt(argc, argv, "h?bfDUAqc:w:s:I:V")) != EOF) {
|
||||
switch(ch) {
|
||||
case 'b':
|
||||
@@ -429,6 +476,10 @@ main(int argc, char **argv)
|
||||
@@ -443,6 +490,10 @@ main(int argc, char **argv)
|
||||
timeout = atoi(optarg);
|
||||
break;
|
||||
case 'I':
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include <netdb.h>
|
||||
+#include <setjmp.h>
|
||||
|
||||
#ifdef HAVE_CAPABILITIES
|
||||
#ifdef CAPABILITIES
|
||||
#include <sys/capability.h>
|
||||
@@ -219,3 +220,6 @@ extern int gather_statistics(__u8 *ptr,
|
||||
int csfailed, struct timeval *tv, char *from,
|
||||
|
@ -18,28 +18,3 @@ diff -up iputils-s20101006/clockdiff.c.unused iputils-s20101006/clockdiff.c
|
||||
/*
|
||||
* a hosts using a time format different from
|
||||
* ms. since midnight UT (as per RFC792) should
|
||||
diff -up iputils-s20101006/ping6.c.unused iputils-s20101006/ping6.c
|
||||
--- iputils-s20101006/ping6.c.unused 2011-02-09 16:14:11.413299738 +0100
|
||||
+++ iputils-s20101006/ping6.c 2011-02-09 16:46:39.158299066 +0100
|
||||
@@ -1215,7 +1215,7 @@ void pr_niquery_reply_name(struct ni_hdr
|
||||
}
|
||||
while (p < end) {
|
||||
int fqdn = 1;
|
||||
- int len;
|
||||
+ int buf_len;
|
||||
int i;
|
||||
|
||||
memset(buf, 0xff, sizeof(buf));
|
||||
@@ -1230,10 +1230,10 @@ void pr_niquery_reply_name(struct ni_hdr
|
||||
}
|
||||
if (p + ret < end && *(p + ret) == '\0')
|
||||
fqdn = 0;
|
||||
- len = strlen(buf);
|
||||
+ buf_len = strlen(buf);
|
||||
|
||||
putchar(' ');
|
||||
- for (i = 0; i < strlen(buf); i++)
|
||||
+ for (i = 0; i < buf_len; i++)
|
||||
putchar_safe(buf[i]);
|
||||
if (fqdn)
|
||||
putchar('.');
|
||||
|
@ -170,6 +170,7 @@ mv -f RELNOTES.tmp RELNOTES
|
||||
* Mon Oct 15 2012 Jan Synáček <jsynacek@redhat.com> - 20121011-1
|
||||
- Update to iputils-s20121011
|
||||
+ drop unnecessary patches
|
||||
+ update patches
|
||||
|
||||
* Wed Aug 22 2012 Jan Synáček <jsynacek@redhat.com> - 20101006-18
|
||||
- Improve spec for fedora
|
||||
|
Loading…
Reference in New Issue
Block a user