summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/dhcp/dhcp/replace-ifconfig-route.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/dhcp/dhcp/replace-ifconfig-route.patch')
-rw-r--r--meta/recipes-connectivity/dhcp/dhcp/replace-ifconfig-route.patch188
1 files changed, 0 insertions, 188 deletions
diff --git a/meta/recipes-connectivity/dhcp/dhcp/replace-ifconfig-route.patch b/meta/recipes-connectivity/dhcp/dhcp/replace-ifconfig-route.patch
deleted file mode 100644
index d84df5cd34..0000000000
--- a/meta/recipes-connectivity/dhcp/dhcp/replace-ifconfig-route.patch
+++ /dev/null
@@ -1,188 +0,0 @@
1Found this patch here:
2https://lists.isc.org/pipermail/dhcp-users/2011-January/012910.html
3
4and made some adjustments/updates to make it work with this version.
5Wasn't able to find that why this patch was not accepted by ISC DHCP developers.
6
7Upstream-Status: Pending
8
9Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
10
11Rebase to 4.3.4
12
13Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
14---
15 client/scripts/linux | 82 ++++++++++++++++++++++++++++------------------------
16 1 file changed, 45 insertions(+), 37 deletions(-)
17
18diff --git a/client/scripts/linux b/client/scripts/linux
19index a02cfd9..232a0aa 100755
20--- a/client/scripts/linux
21+++ b/client/scripts/linux
22@@ -101,17 +101,11 @@ fi
23 if [ x$old_broadcast_address != x ]; then
24 old_broadcast_arg="broadcast $old_broadcast_address"
25 fi
26-if [ x$new_subnet_mask != x ]; then
27- new_subnet_arg="netmask $new_subnet_mask"
28+if [ -n "$new_subnet_mask" ]; then
29+ new_mask="/$new_subnet_mask"
30 fi
31-if [ x$old_subnet_mask != x ]; then
32- old_subnet_arg="netmask $old_subnet_mask"
33-fi
34-if [ x$alias_subnet_mask != x ]; then
35- alias_subnet_arg="netmask $alias_subnet_mask"
36-fi
37-if [ x$new_interface_mtu != x ]; then
38- mtu_arg="mtu $new_interface_mtu"
39+if [ -n "$alias_subnet_mask" ]; then
40+ alias_mask="/$alias_subnet_mask"
41 fi
42 if [ x$IF_METRIC != x ]; then
43 metric_arg="metric $IF_METRIC"
44@@ -125,9 +119,9 @@ fi
45 if [ x$reason = xPREINIT ]; then
46 if [ x$alias_ip_address != x ]; then
47 # Bring down alias interface. Its routes will disappear too.
48- ifconfig $interface:0- inet 0
49+ ${ip} -4 addr flush dev ${interface} label ${interface}:0
50 fi
51- ifconfig $interface 0 up
52+ ${ip} link set dev ${interface} up
53
54 # We need to give the kernel some time to get the interface up.
55 sleep 1
56@@ -154,25 +148,30 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
57 if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
58 [ x$alias_ip_address != x$old_ip_address ]; then
59 # Possible new alias. Remove old alias.
60- ifconfig $interface:0- inet 0
61+ ${ip} -4 addr flush dev ${interface} label ${interface}:0
62 fi
63 if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
64 # IP address changed. Bringing down the interface will delete all routes,
65 # and clear the ARP cache.
66- ifconfig $interface inet 0 down
67+ ${ip} -4 addr flush dev ${interface} label ${interface}
68
69 fi
70 if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
71 [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
72
73- ifconfig $interface inet $new_ip_address $new_subnet_arg \
74- $new_broadcast_arg $mtu_arg
75+ ${ip} -4 addr add ${new_ip_address}${new_mask} ${new_broadcast_arg} \
76+ dev ${interface} label ${interface}
77+ if [ -n "$new_interface_mtu" ]; then
78+ # set MTU
79+ ${ip} link set dev ${interface} mtu ${new_interface_mtu}
80+ fi
81 # Add a network route to the computed network address.
82 for router in $new_routers; do
83 if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
84- route add -host $router dev $interface
85+ ${ip} -4 route add ${router} dev $interface >/dev/null 2>&1
86 fi
87- route add default gw $router $metric_arg dev $interface
88+ ${ip} -4 route add default via ${router} dev ${interface} \
89+ ${metric_arg} >/dev/null 2>&1
90 done
91 else
92 # we haven't changed the address, have we changed other options
93@@ -180,21 +179,23 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
94 if [ x$new_routers != x ] && [ x$new_routers != x$old_routers ] ; then
95 # if we've changed routers delete the old and add the new.
96 for router in $old_routers; do
97- route del default gw $router
98+ ${ip} -4 route delete default via ${router}
99 done
100 for router in $new_routers; do
101 if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
102- route add -host $router dev $interface
103- fi
104- route add default gw $router $metric_arg dev $interface
105+ ${ip} -4 route add ${router} dev $interface >/dev/null 2>&1
106+ fi
107+ ${ip} -4 route add default via ${router} dev ${interface} \
108+ ${metric_arg} >/dev/null 2>&1
109 done
110 fi
111 fi
112 if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
113 then
114- ifconfig $interface:0- inet 0
115- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
116- route add -host $alias_ip_address $interface:0
117+ ${ip} -4 addr flush dev ${interface} label ${interface}:0
118+ ${ip} -4 addr add ${alias_ip_address}${alias_mask} \
119+ dev ${interface} label ${interface}:0
120+ ${ip} -4 route add ${alias_ip_address} dev ${interface} >/dev/null 2>&1
121 fi
122 make_resolv_conf
123 exit_with_hooks 0
124@@ -204,42 +205,49 @@ if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \
125 || [ x$reason = xSTOP ]; then
126 if [ x$alias_ip_address != x ]; then
127 # Turn off alias interface.
128- ifconfig $interface:0- inet 0
129+ ${ip} -4 addr flush dev ${interface} label ${interface}:0
130 fi
131 if [ x$old_ip_address != x ]; then
132 # Shut down interface, which will delete routes and clear arp cache.
133- ifconfig $interface inet 0 down
134+ ${ip} -4 addr flush dev ${interface} label ${interface}
135 fi
136 if [ x$alias_ip_address != x ]; then
137- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
138- route add -host $alias_ip_address $interface:0
139+ ${ip} -4 addr add ${alias_ip_address}${alias_network_arg} \
140+ dev ${interface} label ${interface}:0
141+ ${ip} -4 route add ${alias_ip_address} dev ${interface} >/dev/null 2>&1
142 fi
143 exit_with_hooks 0
144 fi
145
146 if [ x$reason = xTIMEOUT ]; then
147 if [ x$alias_ip_address != x ]; then
148- ifconfig $interface:0- inet 0
149+ ${ip} -4 addr flush dev ${interface} label ${interface}:0
150+ fi
151+ ${ip} -4 addr add ${new_ip_address}${new_mask} ${new_broadcast_arg} \
152+ dev ${interface} label ${interface}
153+ if [ -n "$new_interface_mtu" ]; then
154+ # set MTU
155+ ip link set dev ${interface} mtu ${new_interface_mtu}
156 fi
157- ifconfig $interface inet $new_ip_address $new_subnet_arg \
158- $new_broadcast_arg $mtu_arg
159 set $new_routers
160 if ping -q -c 1 $1; then
161 if [ x$new_ip_address != x$alias_ip_address ] && \
162 [ x$alias_ip_address != x ]; then
163- ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
164- route add -host $alias_ip_address dev $interface:0
165+ ${ip} -4 addr add ${alias_ip_address}${alias_mask} \
166+ dev ${interface} label ${interface}:0
167+ ${ip} -4 route add ${alias_ip_address} dev ${interface} >/dev/null 2>&1
168 fi
169 for router in $new_routers; do
170 if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
171- route add -host $router dev $interface
172+ ${ip} -4 route add ${router} dev $interface >/dev/null 2>&1
173 fi
174- route add default gw $router $metric_arg dev $interface
175+ ${ip} -4 route add default via ${router} dev ${interface} \
176+ ${metric_arg} >/dev/null 2>&1
177 done
178 make_resolv_conf
179 exit_with_hooks 0
180 fi
181- ifconfig $interface inet 0 down
182+ ${ip} -4 addr flush dev ${interface}
183 exit_with_hooks 1
184 fi
185
186--
1872.8.1
188