Commit | Line | Data |
---|---|---|
6dca1d21 JB |
1 | From Rawhide. Fixes IPV6 Lookup. |
2 | ||
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 | |
6 | @@ -133,28 +133,9 @@ | |
7 | } | |
8 | ||
9 | ||
10 | -static int INET6_getsock(char *bufp, struct sockaddr *sap) | |
11 | -{ | |
12 | - struct sockaddr_in6 *sin6; | |
13 | - | |
14 | - sin6 = (struct sockaddr_in6 *) sap; | |
15 | - sin6->sin6_family = AF_INET6; | |
16 | - sin6->sin6_port = 0; | |
17 | - | |
18 | - if (inet_pton(AF_INET6, bufp, sin6->sin6_addr.s6_addr) <= 0) | |
19 | - return (-1); | |
20 | - | |
21 | - return 16; /* ?;) */ | |
22 | -} | |
23 | - | |
24 | static int INET6_input(int type, char *bufp, struct sockaddr *sap) | |
25 | { | |
26 | - switch (type) { | |
27 | - case 1: | |
28 | - return (INET6_getsock(bufp, sap)); | |
29 | - default: | |
30 | - return (INET6_resolve(bufp, (struct sockaddr_in6 *) sap)); | |
31 | - } | |
32 | + return (INET6_resolve(bufp, (struct sockaddr_in6 *) sap)); | |
33 | } | |
34 | ||
35 | ||
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 | |
39 | @@ -100,7 +100,7 @@ | |
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), | |
45 | prefix_len); | |
46 | ||
47 | /* Fetch and resolve the nexthop address. */ | |
48 | @@ -109,7 +109,7 @@ | |
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)); | |
54 | ||
55 | /* Decode the flags. */ | |
56 | strcpy(flags, "U"); | |
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 | |
60 | @@ -63,7 +63,7 @@ | |
61 | if (*args == NULL) | |
62 | return (usage()); | |
63 | ||
64 | - strcpy(target, *args++); | |
65 | + safe_strncpy(target, *args++, sizeof(target)); | |
66 | if (!strcmp(target, "default")) { | |
67 | prefix_len = 0; | |
68 | memset(&sa6, 0, sizeof(sa6)); | |
69 | @@ -112,7 +112,7 @@ | |
70 | return (usage()); | |
71 | if (rt.rtmsg_flags & RTF_GATEWAY) | |
72 | return (usage()); | |
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); | |
78 | @@ -152,7 +152,7 @@ | |
79 | } | |
80 | if (devname) { | |
81 | memset(&ifr, 0, sizeof(ifr)); | |
82 | - strcpy(ifr.ifr_name, devname); | |
83 | + safe_strncpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name)); | |
84 | ||
85 | if (ioctl(skfd, SIOGIFINDEX, &ifr) < 0) { | |
86 | perror("SIOGIFINDEX"); |