1 From Rawhide. Fixes IPV6 Lookup.
3 diff -Naur net-tools-1.60.orig/lib/inet6.c net-tools-1.60/lib/inet6.c
4 --- net-tools-1.60.orig/lib/inet6.c 2000-10-28 11:04:00.000000000 +0000
5 +++ net-tools-1.60/lib/inet6.c 2003-09-12 22:40:45.000000000 +0000
10 -static int INET6_getsock(char *bufp, struct sockaddr *sap)
12 - struct sockaddr_in6 *sin6;
14 - sin6 = (struct sockaddr_in6 *) sap;
15 - sin6->sin6_family = AF_INET6;
16 - sin6->sin6_port = 0;
18 - if (inet_pton(AF_INET6, bufp, sin6->sin6_addr.s6_addr) <= 0)
21 - return 16; /* ?;) */
24 static int INET6_input(int type, char *bufp, struct sockaddr *sap)
28 - return (INET6_getsock(bufp, sap));
30 - return (INET6_resolve(bufp, (struct sockaddr_in6 *) sap));
32 + return (INET6_resolve(bufp, (struct sockaddr_in6 *) sap));
36 diff -Naur net-tools-1.60.orig/lib/inet6_gr.c net-tools-1.60/lib/inet6_gr.c
37 --- net-tools-1.60.orig/lib/inet6_gr.c 2001-04-01 14:48:06.000000000 +0000
38 +++ net-tools-1.60/lib/inet6_gr.c 2003-09-12 22:40:45.000000000 +0000
40 addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
41 inet6_aftype.input(1, addr6, (struct sockaddr *) &saddr6);
42 snprintf(addr6, sizeof(addr6), "%s/%d",
43 - inet6_aftype.sprint((struct sockaddr *) &saddr6, 1),
44 + inet6_aftype.sprint((struct sockaddr *) &saddr6, numeric),
47 /* Fetch and resolve the nexthop address. */
49 naddr6p[4], naddr6p[5], naddr6p[6], naddr6p[7]);
50 inet6_aftype.input(1, naddr6, (struct sockaddr *) &snaddr6);
51 snprintf(naddr6, sizeof(naddr6), "%s",
52 - inet6_aftype.sprint((struct sockaddr *) &snaddr6, 1));
53 + inet6_aftype.sprint((struct sockaddr *) &snaddr6, numeric));
55 /* Decode the flags. */
57 diff -Naur net-tools-1.60.orig/lib/inet6_sr.c net-tools-1.60/lib/inet6_sr.c
58 --- net-tools-1.60.orig/lib/inet6_sr.c 2000-05-22 21:18:37.000000000 +0000
59 +++ net-tools-1.60/lib/inet6_sr.c 2003-09-12 22:40:45.000000000 +0000
64 - strcpy(target, *args++);
65 + safe_strncpy(target, *args++, sizeof(target));
66 if (!strcmp(target, "default")) {
68 memset(&sa6, 0, sizeof(sa6));
71 if (rt.rtmsg_flags & RTF_GATEWAY)
73 - strcpy(gateway, *args);
74 + safe_strncpy(gateway, *args, sizeof(gateway));
75 if (inet6_aftype.input(1, gateway,
76 (struct sockaddr *) &sa6) < 0) {
77 inet6_aftype.herror(gateway);
81 memset(&ifr, 0, sizeof(ifr));
82 - strcpy(ifr.ifr_name, devname);
83 + safe_strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name));
85 if (ioctl(skfd, SIOGIFINDEX, &ifr) < 0) {
86 perror("SIOGIFINDEX");