recipes: networking/ineutils: Apply patches from Debian in order to refresh this...
[dragora.git] / patches / inetutils / 0003-ifconfig-More-info-on-tunnel-interfaces.patch
blobbfbf1c9d5a6b44043e919bdc37b659170fea0005
1 From 6922b5fd00efbddf90ddcc5b05dc0161bdbbf6a0 Mon Sep 17 00:00:00 2001
2 From: Mats Erik Andersson <gnu@gisladisker.se>
3 Date: Mon, 20 Jul 2015 23:28:19 +0200
4 Subject: [PATCH 03/60] ifconfig: More info on tunnel interfaces.
6 All formats display point-to-point destination.
7 Display tunnel endpoints on BSD systems.
8 ---
9 ChangeLog | 22 ++++++++++++++++++++++
10 ifconfig/options.c | 7 +++++++
11 ifconfig/system/bsd.c | 37 +++++++++++++++++++++++++++++++++++--
12 ifconfig/system/bsd.h | 8 +++++++-
13 4 files changed, 71 insertions(+), 3 deletions(-)
15 diff --git a/ChangeLog b/ChangeLog
16 index 18a584ba..d0172fa8 100644
17 --- a/ChangeLog
18 +++ b/ChangeLog
19 @@ -1,3 +1,25 @@
20 +2015-07-20 Mats Erik Andersson <gnu@gisladisker.se>
22 + ifconfig: More info on tunnel interfaces.
24 + * ifconfig/options.c (formats) <net-tools format>: Add
25 + destination address for point-to-point interfaces. It is
26 + present in some other formats.
27 + <unix format>: Display tunnel addresses for p-t-p interfaces.
28 + <osf format>: Add destination address for p-t-p interfaces
29 + and hardware type and hardware address for any device.
31 + * ifconfig/system/bsd.c (system_fh_brdaddr_query): Check
32 + that IFF_BROADCAST is set and access the relevant member
33 + `fp->ifa_broadaddr'.
34 + (system_fh_brdaddr): Check for set IFF_BROADCAST.
35 + (system_fh_tunnel_query, system_fh_tundst, system_fh_tunsrc):
36 + New functions.
37 + * ifconfig/system/bsd.h (SYSTEM_FORMAT_HANDLER): Add the
38 + keys `tunnel?', `tundst', and `tunsrc'.
39 + (system_fh_tunnel_query, system_fh_tundst, system_fh_tunsrc):
40 + New prototypes.
42 2015-07-18 Mats Erik Andersson <gnu@gisladisker.se>
44 ifconfig: Improve the support for GNU/Hurd.
45 diff --git a/ifconfig/options.c b/ifconfig/options.c
46 index 3356f0e5..2f20e75f 100644
47 --- a/ifconfig/options.c
48 +++ b/ifconfig/options.c
49 @@ -102,6 +102,7 @@ struct format formats[] = {
50 "${name}${exists?}{hwtype?}{${hwtype?}{${tab}{10}Link encap:${hwtype}}"
51 "${hwaddr?}{ HWaddr ${hwaddr}}}${\\n}"
52 "${addr?}{${tab}{10}inet addr:${addr}"
53 + "${dstaddr?}{ P-t-P:${dstaddr}}"
54 "${brdaddr?}{ Bcast:${brdaddr}}"
55 "${netmask?}{ Mask:${netmask}}"
56 "${newline}}"
57 @@ -164,6 +165,8 @@ struct format formats[] = {
58 "${exists?}{hwtype?}{"
59 "${hwtype?}{${\\t}${hwtype}${exists?}{hwaddr?}{"
60 "${hwaddr?}{ ${hwaddr}}}${\\n}}}"
61 + "${exists?}{tunnel?}{"
62 + "${tunnel?}{${\\t}tunnel inet ${tunsrc} --> ${tundst}${\\n}}}"
63 "${addr?}{${\\t}inet ${addr}"
64 "${dstaddr?}{ --> ${dstaddr}}"
65 " netmask ${netmask}{0}{%#02x}${netmask}{1}{%02x}"
66 @@ -180,9 +183,13 @@ struct format formats[] = {
67 "${ifdisplay?}{"
68 "${name}: flags=${flags}{number}{%x}<${flags}{string}{,}>${\\n}"
69 "${addr?}{${\\t}inet ${addr}"
70 + "${dstaddr?}{ --> ${dstaddr}}"
71 " netmask ${netmask}{0}{%02x}${netmask}{1}{%02x}"
72 "${netmask}{2}{%02x}${netmask}{3}{%02x}"
73 "${brdaddr?}{ broadcast ${brdaddr}}" "${mtu?}{ ipmtu ${mtu}}${\\n}}"
74 + "${exists?}{hwtype?}{"
75 + "${hwtype?}{${\\t}${hwtype}${exists?}{hwaddr?}{"
76 + "${hwaddr?}{ ${hwaddr}}}${\\n}}}"
77 "}"
79 {"check",
80 diff --git a/ifconfig/system/bsd.c b/ifconfig/system/bsd.c
81 index 47461242..910a75ef 100644
82 --- a/ifconfig/system/bsd.c
83 +++ b/ifconfig/system/bsd.c
84 @@ -217,7 +217,7 @@ system_fh_brdaddr_query (format_data_t form, int argc, char *argv[])
85 strcmp (fp->ifa_name, form->ifr->ifr_name))
86 continue;
88 - if (fp->ifa_netmask)
89 + if ((fp->ifa_flags & IFF_BROADCAST) && fp->ifa_broadaddr)
90 missing = 0;
91 break;
93 @@ -242,7 +242,7 @@ system_fh_brdaddr (format_data_t form, int argc, char *argv[])
94 strcmp (fp->ifa_name, form->ifr->ifr_name))
95 continue;
97 - if (fp->ifa_broadaddr)
98 + if ((fp->ifa_flags & IFF_BROADCAST) && fp->ifa_broadaddr)
100 missing = 0;
101 put_addr (form, argc, argv, fp->ifa_broadaddr);
102 @@ -588,3 +588,36 @@ system_fh_status (format_data_t form, int argc, char *argv[])
103 #endif /* SIOCGIFMEDIA */
104 put_string (form, "(not known)");
107 +void
108 +system_fh_tunnel_query (format_data_t form, int argc, char *argv[])
110 +#if defined SIOCGIFPSRCADDR && defined SIOCGIFPDSTADDR
111 + if (ioctl (form->sfd, SIOCGIFPSRCADDR, form->ifr) >= 0)
112 + select_arg (form, argc, argv, 0);
113 + else
114 +#endif /* SIOCGIFPSRCADDR && SIOCGIFPDSTADDR */
115 + select_arg (form, argc, argv, 1);
118 +void
119 +system_fh_tundst (format_data_t form, int argc, char *argv[])
121 +#ifdef SIOCGIFPDSTADDR
122 + if (ioctl (form->sfd, SIOCGIFPDSTADDR, form->ifr) >= 0)
123 + put_addr (form, argc, argv, &form->ifr->ifr_addr);
124 + else
125 + put_string (form, "(no phydst)");
126 +#endif /* SIOCGIFPDSTADDR */
129 +void
130 +system_fh_tunsrc (format_data_t form, int argc, char *argv[])
132 +#ifdef SIOCGIFPSRCADDR
133 + if (ioctl (form->sfd, SIOCGIFPSRCADDR, form->ifr) >= 0)
134 + put_addr (form, argc, argv, &form->ifr->ifr_addr);
135 + else
136 + put_string (form, "(no physrc)");
137 +#endif /* SIOCGIFPSRCADDR */
139 diff --git a/ifconfig/system/bsd.h b/ifconfig/system/bsd.h
140 index 0b802a60..918c1f2c 100644
141 --- a/ifconfig/system/bsd.h
142 +++ b/ifconfig/system/bsd.h
143 @@ -71,7 +71,10 @@ struct system_ifconfig
144 {"netmask?", system_fh_netmask_query}, \
145 {"netmask", system_fh_netmask}, \
146 {"status?", system_fh_status_query}, \
147 - {"status", system_fh_status},
148 + {"status", system_fh_status}, \
149 + {"tunnel?", system_fh_tunnel_query}, \
150 + {"tundst", system_fh_tundst}, \
151 + {"tunsrc", system_fh_tunsrc},
153 void system_fh_brdaddr_query (format_data_t form, int argc, char *argv[]);
154 void system_fh_brdaddr (format_data_t form, int argc, char *argv[]);
155 @@ -85,5 +88,8 @@ void system_fh_netmask_query (format_data_t form, int argc, char *argv[]);
156 void system_fh_netmask (format_data_t form, int argc, char *argv[]);
157 void system_fh_status_query (format_data_t form, int argc, char *argv[]);
158 void system_fh_status (format_data_t form, int argc, char *argv[]);
159 +void system_fh_tunnel_query (format_data_t form, int argc, char *argv[]);
160 +void system_fh_tundst (format_data_t form, int argc, char *argv[]);
161 +void system_fh_tunsrc (format_data_t form, int argc, char *argv[]);
163 #endif /* IFCONFIG_SYSTEM_BSD_H */
165 2.26.0.292.g33ef6b2f38