busybox/udhcpc: set DHCP hostname
authorhschang <chang@dev3>
Sun, 3 Feb 2013 12:54:11 +0000 (21:54 +0900)
committerhschang <chang@dev3>
Tue, 5 Feb 2013 02:05:42 +0000 (11:05 +0900)
meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0001-ifupdown-support-post-up-pre-down-hooks.patch
meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0002-ifupdown-code-shrink.patch
meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0003-ifupdown-remove-interface-from-state_list-if-iface_u.patch
meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0004-ifupdown-support-metric-for-static-default-gw.patch
meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0005-ifupdown-improve-compatibility-with-Debian.patch
meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0006-get_linux_version_code-don-t-fail-on-3.0-foo.patch
meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0007-ifplugd-move-read_pid-to-libbb-pidfile.c-and-rename-.patch
meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0008-ifupdown-dhcp_down-wait-until-udhcpc-has-been-killed.patch
meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0009-udhcpc-calculate-broadcast-address-if-not-given-by-s.patch
meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0010-udhcpc-obtain-hostname-from-OS-by-default.patch [new file with mode: 0644]
meta-openvuplus/recipes-core/busybox/busybox_1.19.4.bbappend

index f62fe05..ae78e6d 100644 (file)
@@ -1,7 +1,7 @@
 From b58a1a06ca695aed6a4f6e5039e2de0e5a3df111 Mon Sep 17 00:00:00 2001
 From: Peter Korsgaard <jacmet@sunsite.dk>
 Date: Wed, 19 Oct 2011 02:35:54 +0200
-Subject: [PATCH 1/6] ifupdown: support post-up / pre-down hooks
+Subject: [PATCH 01/10] ifupdown: support post-up / pre-down hooks
 
 function                                             old     new   delta
 set_environ                                          330     371     +41
@@ -56,5 +56,5 @@ index 3820330..abc6b58 100644
        if (!iface->method->down(iface, doit)) return 0;
        if (!execute_all(iface, "post-down")) return 0;
 -- 
-1.7.9.5
+1.7.10.4
 
index d0ca655..2d9d695 100644 (file)
@@ -1,7 +1,7 @@
 From e5221a142e8ee4509734c17584f898a1f4ac86cc Mon Sep 17 00:00:00 2001
 From: Denys Vlasenko <vda.linux@googlemail.com>
 Date: Wed, 19 Oct 2011 02:37:08 +0200
-Subject: [PATCH 2/6] ifupdown: code shrink
+Subject: [PATCH 02/10] ifupdown: code shrink
 
 function                                             old     new   delta
 keywords_up_down                                       -      43     +43
@@ -118,5 +118,5 @@ index abc6b58..5946323 100644
                }
                *pp++ = setlocalenv("IF_%s=%s", iface->option[i].name, iface->option[i].value);
 -- 
-1.7.9.5
+1.7.10.4
 
index e53d78a..2f96179 100644 (file)
@@ -1,7 +1,7 @@
 From a7b406ba64b7a4d9c9610726cb72568fc9848f5d Mon Sep 17 00:00:00 2001
 From: Lauri Hintsala <lauri.hintsala@bluegiga.com>
 Date: Wed, 14 Dec 2011 16:49:58 +0200
-Subject: [PATCH 3/6] ifupdown: remove interface from state_list if iface_up
+Subject: [PATCH 03/10] ifupdown: remove interface from state_list if iface_up
  fails
 
 Fix the issue where interface is set to the configured state even if
@@ -27,5 +27,5 @@ index 5946323..9c2cad2 100644
                                if (iface_state == NULL) {
                                        llist_add_to_end(&state_list, newiface);
 -- 
-1.7.9.5
+1.7.10.4
 
index 3e77a1c..d9c14aa 100644 (file)
@@ -1,7 +1,7 @@
 From fecb0cbff5ca703f8fc00a8e0e93f1f2e3ae942b Mon Sep 17 00:00:00 2001
 From: Natanael Copa <natanael.copa@gmail.com>
 Date: Fri, 17 Feb 2012 19:36:26 +0000
-Subject: [PATCH 4/6] ifupdown: support metric for static default gw
+Subject: [PATCH 04/10] ifupdown: support metric for static default gw
 
 This is useful when you have multiple ISPs with failover. It allows
 setting the priority of the static gateway and makes it possible
@@ -60,5 +60,5 @@ index 9c2cad2..9f49619 100644
  # endif
  }
 -- 
-1.7.9.5
+1.7.10.4
 
index 84e1947..ae1f725 100644 (file)
@@ -1,7 +1,7 @@
 From 7ec30bf273cbdf5f0ae335684939a883182e493e Mon Sep 17 00:00:00 2001
 From: Andreas Oberritter <obi@opendreambox.org>
 Date: Mon, 23 Apr 2012 22:08:39 +0200
-Subject: [PATCH 5/6] ifupdown: improve compatibility with Debian
+Subject: [PATCH 05/10] ifupdown: improve compatibility with Debian
 
 Set environment variable 'PHASE'.
 Treat post-up and pre-down as aliases for up and down.
@@ -93,5 +93,5 @@ index 9f49619..5c3dcec 100644
        return 1;
  }
 -- 
-1.7.9.5
+1.7.10.4
 
index 41c31b8..f061814 100644 (file)
@@ -1,7 +1,7 @@
 From c011ab2fb52c2ee03aa9544b0d242683ee4362e1 Mon Sep 17 00:00:00 2001
 From: Andreas Oberritter <obi@opendreambox.org>
 Date: Fri, 27 Apr 2012 01:40:25 +0200
-Subject: [PATCH 6/6] get_linux_version_code: don't fail on 3.0-foo
+Subject: [PATCH 06/10] get_linux_version_code: don't fail on 3.0-foo
 
 Fixes segmentation fault in mount (nfs):
 
@@ -39,5 +39,5 @@ index a168a1e..12f1146 100644
        }
        return r;
 -- 
-1.7.9.5
+1.7.10.4
 
index c95b729..742e79b 100644 (file)
@@ -1,8 +1,8 @@
 From 4119652f74ce6f8f370df3c80076792d509bc941 Mon Sep 17 00:00:00 2001
 From: Andreas Oberritter <obi@opendreambox.org>
 Date: Mon, 14 May 2012 16:15:50 +0200
-Subject: [PATCH 7/9] ifplugd: move read_pid to libbb/pidfile.c and rename it
- to read_pidfile
+Subject: [PATCH 07/10] ifplugd: move read_pid to libbb/pidfile.c and rename
it to read_pidfile
 
 Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
 ---
@@ -90,5 +90,5 @@ index d8358cd..9a15576 100644
        if (opts & FLAG_KILL) {
                if (pid_from_pidfile > 0)
 -- 
-1.7.9.5
+1.7.10.4
 
index 9df63cb..3b43d3d 100644 (file)
@@ -1,7 +1,7 @@
 From 517f8da0345752d3cc5e2c99b8acd88c60355373 Mon Sep 17 00:00:00 2001
 From: Andreas Oberritter <obi@opendreambox.org>
 Date: Mon, 14 May 2012 16:20:36 +0200
-Subject: [PATCH 8/9] ifupdown: dhcp_down: wait until udhcpc has been killed
+Subject: [PATCH 08/10] ifupdown: dhcp_down: wait until udhcpc has been killed
 
 * Otherwise there's a race condition between ifdown and udhcpc,
   which executes deconfig scripts in /etc/udhcpc.d.
@@ -52,5 +52,5 @@ index 5c3dcec..35e5035 100644
  # else
  static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd UNUSED_PARAM,
 -- 
-1.7.9.5
+1.7.10.4
 
index c2a50e6..b623e3f 100644 (file)
@@ -1,7 +1,7 @@
 From 7f3d0f0e58602e8d96988736d80ba28d31338ea2 Mon Sep 17 00:00:00 2001
 From: Andreas Oberritter <obi@opendreambox.org>
 Date: Mon, 14 May 2012 17:32:16 +0200
-Subject: [PATCH 9/9] udhcpc: calculate broadcast address if not given by
+Subject: [PATCH 09/10] udhcpc: calculate broadcast address if not given by
  server
 
 * This is more efficient than doing it in the scripts
@@ -53,5 +53,5 @@ index 4d755e6..9fbd3b3 100644
  }
  
 -- 
-1.7.9.5
+1.7.10.4
 
diff --git a/meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0010-udhcpc-obtain-hostname-from-OS-by-default.patch b/meta-openvuplus/recipes-core/busybox/busybox-1.19.4/0010-udhcpc-obtain-hostname-from-OS-by-default.patch
new file mode 100644 (file)
index 0000000..489c735
--- /dev/null
@@ -0,0 +1,34 @@
+From 2b4773b6ae48fee56c60fb4a1835672cbca78aee Mon Sep 17 00:00:00 2001
+From: Andreas Oberritter <obi@opendreambox.org>
+Date: Tue, 15 Jan 2013 17:33:53 +0100
+Subject: [PATCH 10/10] udhcpc: obtain hostname from OS by default
+
+* Doesn't require the 'hostname' option in /etc/network/interfaces,
+  and thus makes udhcpc behave like other clients.
+
+Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
+---
+ networking/udhcp/dhcpc.c |    7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
+index 9fbd3b3..ec9f25d 100644
+--- a/networking/udhcp/dhcpc.c
++++ b/networking/udhcp/dhcpc.c
+@@ -1117,6 +1117,13 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
+               );
+       if (opt & (OPT_h|OPT_H))
+               client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0);
++      else {
++              char hostname[256];     /* SUSv2: hostnames are <= 255 bytes */
++              if (gethostname(hostname, sizeof(hostname)) == 0) {
++                      hostname[sizeof(hostname) - 1] = '\0';
++                      client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, hostname, 0);
++              }
++      }
+       if (opt & OPT_F) {
+               /* FQDN option format: [0x51][len][flags][0][0]<fqdn> */
+               client_config.fqdn = alloc_dhcp_option(DHCP_FQDN, str_F, 3);
+-- 
+1.7.10.4
+
index 8e8fad0..c061202 100644 (file)
@@ -1,4 +1,4 @@
-PR .= "-vuplus8"
+PR .= "-vuplus9"
 
 SRC_URI += " \
             file://0001-ifupdown-support-post-up-pre-down-hooks.patch \
@@ -9,6 +9,7 @@ SRC_URI += " \
             file://0006-get_linux_version_code-don-t-fail-on-3.0-foo.patch \
             file://0007-ifplugd-move-read_pid-to-libbb-pidfile.c-and-rename-.patch \
             file://0009-udhcpc-calculate-broadcast-address-if-not-given-by-s.patch \
+            file://0010-udhcpc-obtain-hostname-from-OS-by-default.patch \
             file://0001-work-around-linux-ext2_fs.h-breakage.patch \
             file://0002-Create-and-use-our-own-copy-of-linux-ext2_fs.h.patch \
             file://0003-Drop-include-bb_linux_ext2_fs.h-use-existing-e2fspro.patch \