summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-extended/net-tools/net-tools/0001-lib-inet6.c-INET6_rresolve-various-fixes.patch87
-rw-r--r--meta/recipes-extended/net-tools/net-tools_1.60-26.bb1
2 files changed, 88 insertions, 0 deletions
diff --git a/meta/recipes-extended/net-tools/net-tools/0001-lib-inet6.c-INET6_rresolve-various-fixes.patch b/meta/recipes-extended/net-tools/net-tools/0001-lib-inet6.c-INET6_rresolve-various-fixes.patch
new file mode 100644
index 0000000000..8be45ccac9
--- /dev/null
+++ b/meta/recipes-extended/net-tools/net-tools/0001-lib-inet6.c-INET6_rresolve-various-fixes.patch
@@ -0,0 +1,87 @@
1From 08abfcd923e9f37d1902db26771b1dc6731eb265 Mon Sep 17 00:00:00 2001
2From: Jiri Popelka <jpopelka@redhat.com>
3Date: Fri, 27 Sep 2013 18:40:06 +0200
4Subject: [PATCH 1/1] lib/inet6.c:INET6_rresolve() - various fixes
5
61) Fall-back to numeric address if getnameinfo fails.
7 Reverse lookup is not mandatory, therefore its fail
8 is not an error. Just return numeric address in that case.
9 This makes netstat/route show IPv6 address instead of
10 [UNKNOWN] in case of DNS problems.
11
122) Pass length of 'name' buffer into function.
13 'name' is a pointer and therefore sizeof(name)
14 returns size of pointer and not size of the buffer.
15 see http://stackoverflow.com/questions/14298710/c-pointers-and-arrays-sizeof-operator
16 The sizeof() usage was added with commit 604785adc,
17 so I checked all the other changes in that commit
18 and they seem to be OK.
19
203) remove unused 's' variable
21
22Upstream-Status: Pending
23
24Signed-off-by: Shan Hai <shan.hai@windriver.com>
25Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com>
26---
27 lib/inet6.c | 21 ++++++++++-----------
28 1 file changed, 10 insertions(+), 11 deletions(-)
29
30diff --git a/lib/inet6.c b/lib/inet6.c
31index 9a484a0..2a9c459 100644
32--- a/lib/inet6.c
33+++ b/lib/inet6.c
34@@ -84,10 +84,9 @@ static int INET6_resolve(char *name, struct sockaddr_in6 *sin6)
35 #endif
36
37
38-static int INET6_rresolve(char *name, struct sockaddr_in6 *sin6, int numeric)
39+static int INET6_rresolve(char *name, size_t namelen,
40+ struct sockaddr_in6 *sin6, int numeric)
41 {
42- int s;
43-
44 /* Grmpf. -FvK */
45 if (sin6->sin6_family != AF_INET6) {
46 #ifdef DEBUG
47@@ -98,21 +97,20 @@ static int INET6_rresolve(char *name, struct sockaddr_in6 *sin6, int numeric)
48 return (-1);
49 }
50 if (numeric & 0x7FFF) {
51- inet_ntop( AF_INET6, &sin6->sin6_addr, name, 80);
52+ inet_ntop( AF_INET6, &sin6->sin6_addr, name, namelen);
53 return (0);
54 }
55 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
56 if (numeric & 0x8000)
57- strcpy(name, "default");
58+ safe_strncpy(name, "default", namelen);
59 else
60- strcpy(name, "[::]");
61+ safe_strncpy(name, "[::]", namelen);
62 return (0);
63 }
64
65- if ((s = getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6),
66- name, 255 /* !! */ , NULL, 0, 0))) {
67- fputs("getnameinfo failed\n", stderr);
68- return -1;
69+ if (getnameinfo((struct sockaddr *) sin6, sizeof(struct sockaddr_in6),
70+ name, namelen , NULL, 0, 0)) {
71+ inet_ntop( AF_INET6, &sin6->sin6_addr, name, namelen);
72 }
73 return (0);
74 }
75@@ -143,7 +141,8 @@ static char *INET6_sprint(struct sockaddr *sap, int numeric)
76
77 if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
78 return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff));
79- if (INET6_rresolve(buff, (struct sockaddr_in6 *) sap, numeric) != 0)
80+ if (INET6_rresolve(buff, sizeof(buff),
81+ (struct sockaddr_in6 *) sap, numeric) != 0)
82 return safe_strncpy(buff, _("[UNKNOWN]"), sizeof(buff));
83 return (fix_v4_address(buff, &((struct sockaddr_in6 *)sap)->sin6_addr));
84 }
85--
861.8.5.2.233.g932f7e4
87
diff --git a/meta/recipes-extended/net-tools/net-tools_1.60-26.bb b/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
index 759de0a700..9c2adfa62e 100644
--- a/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
+++ b/meta/recipes-extended/net-tools/net-tools_1.60-26.bb
@@ -15,6 +15,7 @@ SRC_URI = "http://snapshot.debian.org/archive/debian/20050312T000000Z/pool/main/
15 file://net-tools-1.60-sctp1.patch \ 15 file://net-tools-1.60-sctp1.patch \
16 file://net-tools-1.60-sctp2-quiet.patch \ 16 file://net-tools-1.60-sctp2-quiet.patch \
17 file://net-tools-1.60-sctp3-addrs.patch \ 17 file://net-tools-1.60-sctp3-addrs.patch \
18 file://0001-lib-inet6.c-INET6_rresolve-various-fixes.patch \
18 " 19 "
19 20
20# for this package we're mostly interested in tracking debian patches, 21# for this package we're mostly interested in tracking debian patches,