busybox/udhcpc: set DHCP hostname
[vuplus_openvuplus] / meta-openvuplus / recipes-core / busybox / busybox-1.19.4 / 0004-ifupdown-support-metric-for-static-default-gw.patch
1 From fecb0cbff5ca703f8fc00a8e0e93f1f2e3ae942b Mon Sep 17 00:00:00 2001
2 From: Natanael Copa <natanael.copa@gmail.com>
3 Date: Fri, 17 Feb 2012 19:36:26 +0000
4 Subject: [PATCH 04/10] ifupdown: support metric for static default gw
5
6 This is useful when you have multiple ISPs with failover. It allows
7 setting the priority of the static gateway and makes it possible
8 to specify multiple static gateways.
9
10 The ubuntu ifupdown supports it.
11
12 function                                             old     new   delta
13 .rodata                                           116725  116797     +72
14 ------------------------------------------------------------------------------
15 (add/remove: 0/0 grow/shrink: 1/0 up/down: 72/0)               Total: 72 bytes
16    text    data     bss     dec     hex filename
17  953343    7313    8984  969640   ecba8 busybox_old
18  953415    7313    8984  969712   ecbf0 busybox_unstripped
19
20 Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
22 ---
23  networking/ifupdown.c |    8 ++++----
24  1 file changed, 4 insertions(+), 4 deletions(-)
25
26 diff --git a/networking/ifupdown.c b/networking/ifupdown.c
27 index 9c2cad2..9f49619 100644
28 --- a/networking/ifupdown.c
29 +++ b/networking/ifupdown.c
30 @@ -403,11 +403,11 @@ static int FAST_FUNC static_up6(struct interface_defn_t *ifd, execfn *exec)
31         result = execute("ip addr add %address%/%netmask% dev %iface%[[ label %label%]]", ifd, exec);
32         result += execute("ip link set[[ mtu %mtu%]][[ addr %hwaddress%]] %iface% up", ifd, exec);
33         /* Was: "[[ ip ....%gateway% ]]". Removed extra spaces w/o checking */
34 -       result += execute("[[ip route add ::/0 via %gateway%]]", ifd, exec);
35 +       result += execute("[[ip route add ::/0 via %gateway%]][[ prio %metric%]]", ifd, exec);
36  # else
37         result = execute("ifconfig %iface%[[ media %media%]][[ hw %hwaddress%]][[ mtu %mtu%]] up", ifd, exec);
38         result += execute("ifconfig %iface% add %address%/%netmask%", ifd, exec);
39 -       result += execute("[[route -A inet6 add ::/0 gw %gateway%]]", ifd, exec);
40 +       result += execute("[[route -A inet6 add ::/0 gw %gateway%[[ metric %metric%]]]]", ifd, exec);
41  # endif
42         return ((result == 3) ? 3 : 0);
43  }
44 @@ -490,7 +490,7 @@ static int FAST_FUNC static_up(struct interface_defn_t *ifd, execfn *exec)
45         result = execute("ip addr add %address%/%bnmask%[[ broadcast %broadcast%]] "
46                         "dev %iface%[[ peer %pointopoint%]][[ label %label%]]", ifd, exec);
47         result += execute("ip link set[[ mtu %mtu%]][[ addr %hwaddress%]] %iface% up", ifd, exec);
48 -       result += execute("[[ip route add default via %gateway% dev %iface%]]", ifd, exec);
49 +       result += execute("[[ip route add default via %gateway% dev %iface%[[ prio %metric%]]]]", ifd, exec);
50         return ((result == 3) ? 3 : 0);
51  # else
52         /* ifconfig said to set iface up before it processes hw %hwaddress%,
53 @@ -500,7 +500,7 @@ static int FAST_FUNC static_up(struct interface_defn_t *ifd, execfn *exec)
54         result += execute("ifconfig %iface% %address% netmask %netmask%"
55                                 "[[ broadcast %broadcast%]][[ pointopoint %pointopoint%]] ",
56                                 ifd, exec);
57 -       result += execute("[[route add default gw %gateway% %iface%]]", ifd, exec);
58 +       result += execute("[[route add default gw %gateway%[[ metric %metric%]] %iface%]]", ifd, exec);
59         return ((result == 3) ? 3 : 0);
60  # endif
61  }
62 -- 
63 1.7.10.4
64