aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch
blob: 37a61c9bc1654c329a7c0020e1283260717aa935 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
From 7efe4676747e4e4a056b9bfb4e9424c8354e9996 Mon Sep 17 00:00:00 2001
From: "Maxin B. John" <maxin.john@intel.com>
Date: Wed, 21 Dec 2016 15:32:07 +0200
Subject: [PATCH] inet[6].defn: fix inverted checks for loopback

Compared to the hurd link.defn for loopback, we see these
are inverted, meaning that you would only be able to configure
a loopback device that was _not_ named "lo" (unlikely to exist).

The result was that we'd update /run/network/ifstate for "lo"
but never actually do anything for up/down, as shown below:

root@localhost:~# ifconfig -s
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR  TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0   7736329      0   2016 0 5289422      0      0      0 BMRU
lo        65536 0        18      0      0 0      18      0      0      0 LRU
root@localhost:~# ifdown lo
root@localhost:~# echo $?
0
root@localhost:~# ifconfig -s
Iface   MTU Met   RX-OK RX-ERR RX-DRP  RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0   7736406      0  2016 0   5289455      0      0      0 BMRU
lo        65536 0        18      0   0 0            18    0    0    0     LRU
root@localhost:~# ifconfig lo down
root@localhost:~# ifconfig -s
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0   7736474 0   2016 0       5289481      0     0      0 BMRU
root@localhost:~#

Also reverted the commit:
commit 80b878497663dae08f70b4d3cffe127b57a3cfc
which uses absolute paths to binaries called by ifup/ifdown.

Upstream-Status: Inappropriate [OE specific]

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Maxin B. John <maxin.john@intel.com>
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
 inet.defn | 140 +++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 70 insertions(+), 70 deletions(-)

diff --git a/inet.defn b/inet.defn
index 75e6744..23c7756 100644
--- a/inet.defn
+++ b/inet.defn
@@ -6,10 +6,10 @@ method loopback
     This method may be used to define the IPv4 loopback interface.
 
   up
-    /bin/ip link set dev %iface% up if (!iface_is_lo())
+    ip link set dev %iface% up if (!iface_is_lo())
 
   down
-    /bin/ip link set dev %iface% down if (!iface_is_lo())
+    ip link set dev %iface% down if (!iface_is_lo())
 
 method static
   description
@@ -36,17 +36,17 @@ method static
     broadcast compute_v4_broadcast
 
   up
-    /bin/ip addr add %address%[[/%netmask%]] [[broadcast %broadcast%]] \
+    ip addr add %address%[[/%netmask%]] [[broadcast %broadcast%]] \
 	[[peer %pointopoint%]] [[scope %scope%]] dev %iface% label %iface%
-    /bin/ip link set dev %iface% [[mtu %mtu%]] [[address %hwaddress%]] up
+    ip link set dev %iface% [[mtu %mtu%]] [[address %hwaddress%]] up
 
-    [[ /bin/ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
+    [[ ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
 
   down
-    [[ /bin/ip route del default via %gateway% [[metric %metric%]] dev %iface% 2>&1 1>/dev/null || true ]]
-    /bin/ip addr del %address%[[/%netmask%]] [[broadcast %broadcast%]] \
+    [[ ip route del default via %gateway% [[metric %metric%]] dev %iface% 2>&1 1>/dev/null || true ]]
+    ip addr del %address%[[/%netmask%]] [[broadcast %broadcast%]] \
 	[[peer %pointopoint%]] [[scope %scope%]] dev %iface% label %iface%
-    /bin/ip link set dev %iface% down \
+    ip link set dev %iface% down \
 		if (iface_is_link())
 
 method manual
@@ -63,12 +63,12 @@ method manual
     hwaddress cleanup_hwaddress
 
   up
-    [[/bin/ip link set dev %iface% mtu %mtu%]]
-    [[/bin/ip link set dev %iface% address %hwaddress%]]
-    /bin/ip link set dev %iface% up 2>/dev/null || true
+    [[ip link set dev %iface% mtu %mtu%]]
+    [[ip link set dev %iface% address %hwaddress%]]
+    ip link set dev %iface% up 2>/dev/null || true
 
   down
-    /bin/ip link set dev %iface% down 2>/dev/null || true \
+    ip link set dev %iface% down 2>/dev/null || true \
         if (iface_is_link() && !do_all)
 
 method dhcp
@@ -93,33 +93,33 @@ method dhcp
     hwaddress cleanup_hwaddress
 
   up
-    [[/bin/ip link set dev %iface% address %hwaddress%]]
-    /sbin/dhclient -v -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
+    [[ip link set dev %iface% address %hwaddress%]]
+    dhclient -v -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
 	[[-e IF_METRIC=%metric%]] \
         if (execable("/sbin/dhclient"))
-    /sbin/pump -i %iface% [[-h %hostname%]] [[-l %leasehours%]] \
+    pump -i %iface% [[-h %hostname%]] [[-l %leasehours%]] \
         elsif (execable("/sbin/pump"))
-    /sbin/udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-x hostname:%hostname%]] \
+    udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-x hostname:%hostname%]] \
         elsif (execable("/sbin/udhcpc"))
-    /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
+    dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
            [[-l %leasetime%]] [[-m %metric%]] %iface% \
         elsif (execable("/sbin/dhcpcd"))
     echo 'No DHCP client software found!' >/dev/stderr; false \
         elsif (1)
 
   down
-    /sbin/dhclient -v -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
+    dhclient -v -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
         if (execable("/sbin/dhclient"))
-    /sbin/pump -i %iface% -r \
+    pump -i %iface% -r \
         elsif (execable("/sbin/pump"))
-    if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(/bin/cat /run/udhcpc.%iface%.pid); kill -TERM $(/bin/cat /run/udhcpc.%iface%.pid); fi \
+    if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(cat /run/udhcpc.%iface%.pid); kill -TERM $(cat /run/udhcpc.%iface%.pid); fi \
         elsif (execable("/sbin/udhcpc"))
-    /sbin/dhcpcd -k %iface% \
+    dhcpcd -k %iface% \
         elsif (execable("/sbin/dhcpcd"))
     echo 'No DHCP client software found!' >/dev/stderr; false \
         elsif (1)
 
-    /bin/ip link set dev %iface% down \
+    ip link set dev %iface% down \
 		if (iface_is_link())
 
 method bootp
@@ -134,11 +134,11 @@ method bootp
                       whatever it really is.
 
   up
-    /sbin/bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \
+    bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \
            [[--hwaddr %hwaddr%]] --returniffail --serverbcast
 
   down
-    /bin/ip link set dev %iface% down \
+    ip link set dev %iface% down \
         if (iface_is_link())
 
 method tunnel
@@ -158,13 +158,13 @@ method tunnel
     ttl time              -- TTL setting
     mtu size              -- MTU size
   up
-    /bin/ip tunnel add %iface% mode %mode% remote %endpoint% [[local %local%]] \
+    ip tunnel add %iface% mode %mode% remote %endpoint% [[local %local%]] \
        [[ttl %ttl%]]
-    /bin/ip link set %iface% up [[mtu %mtu%]]
-    /bin/ip addr add %address%/%netmask% dev %iface% [[peer %dstaddr%]]
-    [[ /bin/ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
+    ip link set %iface% up [[mtu %mtu%]]
+    ip addr add %address%/%netmask% dev %iface% [[peer %dstaddr%]]
+    [[ ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
   down
-    /bin/ip tunnel del %iface%
+    ip tunnel del %iface%
 
 method ppp
   description
@@ -175,9 +175,9 @@ method ppp
     unit number    -- Use /number/ as the ppp unit number.
     options string -- Pass /string/ as additional options to pon.
   up
-    /usr/bin/pon [[%provider%]] [[unit %unit%]] [[%options%]]
+    pon [[%provider%]] [[unit %unit%]] [[%options%]]
   down
-    /usr/bin/poff [[%provider%]]
+    poff [[%provider%]]
 
 method wvdial
   description
@@ -186,10 +186,10 @@ method wvdial
   options
     provider name  -- Use /name/ as the provider (from /etc/wvdial.conf).
   up
-    /sbin/start-stop-daemon --start -x /usr/bin/wvdial \
+    start-stop-daemon --start -x /usr/bin/wvdial \
                       -p /run/wvdial.%iface%.pid -b -m -- [[ %provider% ]]
   down
-    /sbin/start-stop-daemon --stop -x /usr/bin/wvdial \
+    start-stop-daemon --stop -x /usr/bin/wvdial \
                       -p /run/wvdial.%iface%.pid -s 2
 
 
@@ -200,9 +200,9 @@ method ipv4ll
     known as APIPA or IPAC, and often colloquially referred to
     as "Zeroconf address".
   up
-    /usr/sbin/avahi-autoipd -D %iface%
+    avahi-autoipd -D %iface%
   down
-    /usr/sbin/avahi-autoipd --kill %iface%
+    avahi-autoipd --kill %iface%
 
 architecture kfreebsd
 
@@ -211,11 +211,11 @@ method loopback
     This method may be used to define the IPv4 loopback interface.
 
   up
-    /sbin/ifconfig %iface% 127.0.0.1 up \
+    ifconfig %iface% 127.0.0.1 up \
 	if (!iface_is_lo())
 
   down
-    /sbin/ifconfig %iface% down \
+    ifconfig %iface% down \
 	if (!iface_is_lo())
 
 method static
@@ -238,15 +238,15 @@ method static
     hwaddress cleanup_hwaddress
 
   up
-    [[ /sbin/ifconfig %iface% link %hwaddress%]]
-    /sbin/ifconfig %iface% %address% [[netmask %netmask%]] [[broadcast %broadcast%]] \
+    [[ ifconfig %iface% link %hwaddress%]]
+    ifconfig %iface% %address% [[netmask %netmask%]] [[broadcast %broadcast%]] \
 	[[pointopoint %pointopoint%]] [[media %media%]] [[mtu %mtu%]] \
 	up
-    [[ /sbin/route add default %gateway% ]]
+    [[ route add default %gateway% ]]
 
   down
-    [[ /sbin/route del default %gateway% 2>&1 1>/dev/null || true ]]
-    /sbin/ifconfig %iface% down
+    [[ route del default %gateway% 2>&1 1>/dev/null || true ]]
+    ifconfig %iface% down
 
 method manual
   description
@@ -279,30 +279,30 @@ method dhcp
     hwaddress cleanup_hwaddress
 
   up
-    [[/sbin/ifconfig %iface% link %hwaddress%]]
-    /sbin/dhclient -v -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
+    [[ifconfig %iface% link %hwaddress%]]
+    dhclient -v -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
 	[[-e IF_METRIC=%metric%]] \
         if (execable("/sbin/dhclient"))
-    /sbin/udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-H %hostname%]] \
+    udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-H %hostname%]] \
            [[-c %client%]] \
         elsif (execable("/sbin/udhcpc"))
-    /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
+    dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
            [[-l %leasetime%]] %iface% \
         elsif (execable("/sbin/dhcpcd"))
     echo 'No DHCP client software found!' >/dev/stderr; false \
         elsif (1)
 
   down
-    /sbin/dhclient -v -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
+    dhclient -v -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
         if (execable("/sbin/dhclient"))
-    if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(/bin/cat /run/udhcpc.%iface%.pid); kill -TERM $(/bin/cat /run/udhcpc.%iface%.pid); fi \
+    if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(cat /run/udhcpc.%iface%.pid); kill -TERM $(cat /run/udhcpc.%iface%.pid); fi \
         elsif (execable("/sbin/udhcpc"))
-    /sbin/dhcpcd -k %iface% \
+    dhcpcd -k %iface% \
         elsif (execable("/sbin/dhcpcd"))
     echo 'No DHCP client software found!' >/dev/stderr; false \
         elsif (1)
 
-    /sbin/ifconfig %iface% down
+    ifconfig %iface% down
 
 method bootp
   description
@@ -316,11 +316,11 @@ method bootp
                       whatever it really is.
 
   up
-    /sbin/bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \
+    bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \
            [[--hwaddr %hwaddr%]] --returniffail --serverbcast
 
   down
-    /sbin/ifconfig %iface% down
+    ifconfig %iface% down
 
 method ppp
   description
@@ -331,9 +331,9 @@ method ppp
     unit number    -- Use /number/ as the ppp unit number.
     options string -- Pass /string/ as additional options to pon.
   up
-    /usr/bin/pon [[%provider%]] [[unit %unit%]] [[%options%]]
+    pon [[%provider%]] [[unit %unit%]] [[%options%]]
   down
-    /usr/bin/poff [[%provider%]]
+    poff [[%provider%]]
 
 method wvdial
   description
@@ -342,10 +342,10 @@ method wvdial
   options
     provider name  -- Use /name/ as the provider (from /etc/wvdial.conf).
   up
-    /sbin/start-stop-daemon --start -x /usr/bin/wvdial \
+    start-stop-daemon --start -x /usr/bin/wvdial \
                       -p /run/wvdial.%iface%.pid -b -m -- [[ %provider% ]]
   down
-    /sbin/start-stop-daemon --stop -x /usr/bin/wvdial \
+    start-stop-daemon --stop -x /usr/bin/wvdial \
                       -p /run/wvdial.%iface%.pid -s 2
 
 
@@ -356,9 +356,9 @@ method ipv4ll
     known as APIPA or IPAC, and often colloquially referred to
     as "Zeroconf address".
   up
-    /usr/sbin/avahi-autoipd -D %iface%
+    avahi-autoipd -D %iface%
   down
-    /usr/sbin/avahi-autoipd --kill %iface%
+    avahi-autoipd --kill %iface%
 architecture hurd
 
 method loopback
@@ -432,23 +432,23 @@ method dhcp
 
   up
     [[Warning: Option hwaddress: %hwaddress% not yet supported]]
-    /sbin/dhclient -v -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \
+    dhclient -v -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \
         if (execable("/sbin/dhclient"))
-    /sbin/udhcpc -n -p /run/udhcpc.%iface///.%.pid -i %iface% [[-H %hostname%]] \
+    udhcpc -n -p /run/udhcpc.%iface///.%.pid -i %iface% [[-H %hostname%]] \
            [[-c %client%]] \
         elsif (execable("/sbin/udhcpc"))
-    /sbin/dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
+    dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
            [[-l %leasetime%]] %iface% \
         elsif (execable("/sbin/dhcpcd"))
     echo 'No DHCP client software found!' >/dev/stderr; false \
         elsif (1)
 
   down
-    /sbin/dhclient -v -r -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \
+    dhclient -v -r -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \
         if (execable("/sbin/dhclient"))
-    if test -f /run/udhcpc.%iface///.%.pid; then kill -USR2 $(/bin/cat /run/udhcpc.%iface///.%.pid); kill -TERM $(/bin/cat /run/udhcpc.%iface///.%.pid); fi \
+    if test -f /run/udhcpc.%iface///.%.pid; then kill -USR2 $(cat /run/udhcpc.%iface///.%.pid); kill -TERM $(cat /run/udhcpc.%iface///.%.pid); fi \
         elsif (execable("/sbin/udhcpc"))
-    /sbin/dhcpcd -k %iface% \
+    dhcpcd -k %iface% \
         elsif (execable("/sbin/dhcpcd"))
     echo 'No DHCP client software found!' >/dev/stderr; false \
         elsif (1)
@@ -482,9 +482,9 @@ method ppp
     unit number    -- Use /number/ as the ppp unit number.
     options string -- Pass /string/ as additional options to pon.
   up
-    /usr/bin/pon [[%provider%]] [[unit %unit%]] [[%options%]]
+    pon [[%provider%]] [[unit %unit%]] [[%options%]]
   down
-    /usr/bin/poff [[%provider%]]
+    poff [[%provider%]]
 
 method wvdial
   description
@@ -493,10 +493,10 @@ method wvdial
   options
     provider name  -- Use /name/ as the provider (from /etc/wvdial.conf).
   up
-    /sbin/start-stop-daemon --start -x /usr/bin/wvdial \
+    start-stop-daemon --start -x /usr/bin/wvdial \
                       -p /run/wvdial.%iface///.%.pid -b -m -- [[ %provider% ]]
   down
-    /sbin/start-stop-daemon --stop -x /usr/bin/wvdial \
+    start-stop-daemon --stop -x /usr/bin/wvdial \
                       -p /run/wvdial.%iface///.%.pid -s 2
 
 
@@ -507,6 +507,6 @@ method ipv4ll
     known as APIPA or IPAC, and often colloquially referred to
     as "Zeroconf address".
   up
-    /usr/sbin/avahi-autoipd -D %iface%
+    avahi-autoipd -D %iface%
   down
-    /usr/sbin/avahi-autoipd --kill %iface%
+    avahi-autoipd --kill %iface%
-- 
2.7.4