dhcp: make dhclient to get configuration for other programs
PATCH RESEND v2 1/1 dhcp: make dhclient to get configuration for other programs
From: Li Wang <[email protected]>
Make dhclient to run /etc/dhcp/dhclient.d/*.sh, and get the configuration for ntp, nis or other programes
These codes are from redhat rpm package.
--- .../dhcp/dhcp/dhcp-add-exec-script-function.patch | 101 +++++++++++++++++++++ meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb | 1 + meta/recipes-connectivity/dhcp/files/dhclient.conf | 1 + 3 files changed, 103 insertions(+) create mode 100644 meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch
meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +101 -0
@@ -0,0 +1,101 @@ +[PATCH] dhcp: add exec script function + +Upstream-Statue: Pending + +Make dhclient to run /etc/dhcp/dhclient.d/*.sh, and get the configuration +for ntp, nis or other programes + +These codes are from redhat rpm packages. + +Signed-off-by: Li Wang <[email protected]> +Signed-off-by: Roy Li <[email protected]> +--- + client/scripts/linux | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +diff --git a/client/scripts/linux b/client/scripts/linux +index 232a0aa..bdb5e22 100755 +--- a/client/scripts/linux ++++ b/client/scripts/linux +@@ -24,6 +24,8 @@ + + # 'ip' just looks too weird. /sbin/ip looks less weird. + ip=/sbin/ip ++ETCDIR="/etc/dhcp" ++export SAVEDIR=/var/lib/dhclient + + make_resolv_conf() { + if [ x"$new_domain_name_servers" != x ]; then +@@ -80,6 +82,20 @@ exit_with_hooks() { + exit $exit_status + } + ++execute_client_side_configuration_scripts() { ++# execute any additional client side configuration scripts we have ++ if [ "${1}" == "config" ] || [ "${1}" == "restore" ]; then ++ for f in ${ETCDIR}/dhclient.d/*.sh ; do ++ if [ -x ${f} ]; then ++ subsystem="${f%.sh}" ++ subsystem="${subsystem##*/}" ++ . ${f} ++ "${subsystem}_${1}" ++ fi ++ done ++ fi ++} ++ + # Invoke the local dhcp client enter hooks, if they exist. + if [ -f /etc/dhclient-enter-hooks ]; then + exit_status=0 +@@ -198,11 +214,14 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ + ${ip} -4 route add ${alias_ip_address} dev ${interface} >/dev/null 2>&1 + fi + make_resolv_conf ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + + if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \ + || [ x$reason = xSTOP ]; then ++ execute_client_side_configuration_scripts "restore" ++ + if [ x$alias_ip_address != x ]; then + # Turn off alias interface. + ${ip} -4 addr flush dev ${interface} label ${interface}:0 +@@ -281,7 +300,7 @@ if [ x$reason = xBOUND6 ] ; then + + # Check for nameserver options. + make_resolv_conf +- ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -299,6 +318,7 @@ if [ x$reason = xRENEW6 ] || [ x$reason = xREBIND6 ] ; then + make_resolv_conf + fi + ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -310,6 +330,7 @@ if [ x$reason = xDEPREF6 ] ; then + ${ip} -f inet6 addr change ${new_ip6_address}/${new_ip6_prefixlen} \ + dev ${interface} scope global preferred_lft 0 + ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -318,6 +339,8 @@ if [ x$reason = xEXPIRE6 -o x$reason = xRELEASE6 -o x$reason = xSTOP6 ] ; then + exit_with_hooks 2; + fi + ++ execute_client_side_configuration_scripts "restore" ++ + ${ip} -f inet6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \ + dev ${interface} + +-- +1.9.1 +
meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb +1 -0
@@ -6,6 +6,7 @@ SRC_URI += "file://dhcp-3.0.3-dhclient-dbus.patch;striplevel=0 \ file://fixsepbuild.patch \ file://dhclient-script-drop-resolv.conf.dhclient.patch \ file://replace-ifconfig-route.patch \ + file://dhcp-add-exec-script-function.patch \ " SRC_URI[md5sum] = "5a284875dd2c12ddd388416d69156a67"
meta/recipes-connectivity/dhcp/files/dhclient.conf +1 -0
@@ -17,6 +17,7 @@ #supersede domain-name "fugue.com home.vix.com"; #prepend domain-name-servers 127.0.0.1; request subnet-mask, broadcast-address, time-offset, routers, + nis-domain, nis-servers, domain-search, ntp-servers, domain-name, domain-name-servers, host-name, netbios-name-servers, netbios-scope; #require subnet-mask, domain-name-servers;
Signature · 1 line
1.9.1
ping
-Roy
Quoted 148 lines · On 2015年07月17日 14:31, [email protected] wrote:
From: Li Wang <[email protected]>
Make dhclient to run
/etc/dhcp/dhclient.d/*.sh, and get the configuration for ntp, nis or other programesThese codes are from redhat rpm package.
Signed-off-by Li Wang <[email protected]>Signed-off-by Roy Li <[email protected]>--- .../dhcp/dhcp/dhcp-add-exec-script-function.patch | 101 +++++++++++++++++++++ meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb | 1 + meta/recipes-connectivity/dhcp/files/dhclient.conf | 1 + 3 files changed, 103 insertions(+)create mode 100644
meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patchmeta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +101
-0@@ -0,0 +1,101 @@ +[PATCH] dhcp: add exec script function + +Upstream-Statue: Pending + +Make dhclient to run /etc/dhcp/dhclient.d/*.sh, and get the configuration +for ntp, nis or other programes + +These codes are from redhat rpm packages. + +Signed-off-by: Li Wang <[email protected]> +Signed-off-by: Roy Li <[email protected]> +--- + client/scripts/linux | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +diff --git a/client/scripts/linux b/client/scripts/linux +index 232a0aa..bdb5e22 100755 +--- a/client/scripts/linux ++++ b/client/scripts/linux +@@ -24,6 +24,8 @@ + + # 'ip' just looks too weird. /sbin/ip looks less weird. + ip=/sbin/ip ++ETCDIR="/etc/dhcp" ++export SAVEDIR=/var/lib/dhclient + + make_resolv_conf() { + if [ x"$new_domain_name_servers" != x ]; then +@@ -80,6 +82,20 @@ exit_with_hooks() { + exit $exit_status + } + ++execute_client_side_configuration_scripts() { ++# execute any additional client side configuration scripts we have ++ if [ "${1}" == "config" ] || [ "${1}" == "restore" ]; then ++ for f in ${ETCDIR}/dhclient.d/*.sh ; do ++ if [ -x ${f} ]; then ++ subsystem="${f%.sh}" ++ subsystem="${subsystem##*/}" ++ . ${f} ++ "${subsystem}_${1}" ++ fi ++ done ++ fi ++} ++ + # Invoke the local dhcp client enter hooks, if they exist. + if [ -f /etc/dhclient-enter-hooks ]; then + exit_status=0 +@@ -198,11 +214,14 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ + ${ip} -4 route add ${alias_ip_address} dev ${interface} >/dev/null 2>&1 + fi + make_resolv_conf ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + + if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \ + || [ x$reason = xSTOP ]; then ++ execute_client_side_configuration_scripts "restore" ++ + if [ x$alias_ip_address != x ]; then + # Turn off alias interface. + ${ip} -4 addr flush dev ${interface} label ${interface}:0 +@@ -281,7 +300,7 @@ if [ x$reason = xBOUND6 ] ; then + + # Check for nameserver options. + make_resolv_conf +- ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -299,6 +318,7 @@ if [ x$reason = xRENEW6 ] || [ x$reason = xREBIND6 ] ; then + make_resolv_conf + fi + ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -310,6 +330,7 @@ if [ x$reason = xDEPREF6 ] ; then + ${ip} -f inet6 addr change ${new_ip6_address}/${new_ip6_prefixlen} \ + dev ${interface} scope global preferred_lft 0 + ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -318,6 +339,8 @@ if [ x$reason = xEXPIRE6 -o x$reason = xRELEASE6 -o x$reason = xSTOP6 ] ; then + exit_with_hooks 2; + fi + ++ execute_client_side_configuration_scripts "restore" ++ + ${ip} -f inet6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \ + dev ${interface} + +-- +1.9.1 +meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb +1
-0@@ -6,6 +6,7 @@ SRC_URI += "file://dhcp-3.0.3-dhclient-dbus.patch;striplevel=0 \ file://fixsepbuild.patch \ file://dhclient-script-drop-resolv.conf.dhclient.patch \ file://replace-ifconfig-route.patch \ + file://dhcp-add-exec-script-function.patch \ " SRC_URI[md5sum] = "5a284875dd2c12ddd388416d69156a67"meta/recipes-connectivity/dhcp/files/dhclient.conf +1
-0@@ -17,6 +17,7 @@ #supersede domain-name "fugue.com home.vix.com"; #prepend domain-name-servers 127.0.0.1; request subnet-mask, broadcast-address, time-offset, routers, + nis-domain, nis-servers, domain-search, ntp-servers, domain-name, domain-name-servers, host-name, netbios-name-servers, netbios-scope; #require subnet-mask, domain-name-servers;
Signature · 2 lines
Best Reagrds, Roy | RongQing Li
Quoted 3 lines · Rongqing Li
ping
-Roy
ping
-R
Quoted 165 lines · On 2015年07月17日 14:31, [email protected] wrote:
Quoted 162 lines
From: Li Wang <[email protected]>
Make dhclient to run
/etc/dhcp/dhclient.d/*.sh, and get the configuration for ntp, nis or other programesThese codes are from redhat rpm package.
Signed-off-by Li Wang <[email protected]>Signed-off-by Roy Li <[email protected]>--- .../dhcp/dhcp/dhcp-add-exec-script-function.patch | 101 +++++++++++++++++++++ meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb | 1 + meta/recipes-connectivity/dhcp/files/dhclient.conf | 1 + 3 files changed, 103 insertions(+)create mode 100644
meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patchdiff --git
a/meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patchb/meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patchnew file mode 100644
index 0000000..73b3ce4
---/dev/null
+++b/meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patchmeta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +5
-0@@ -0,0 +1,101 @@ +[PATCH] dhcp: add exec script function + +Upstream-Statue: Pending + +Make dhclient to run /etc/dhcp/dhclient.d/*.sh, and get theconfiguration
meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +45
-0+for ntp, nis or other programes + +These codes are from redhat rpm packages. + +Signed-off-by: Li Wang <[email protected]> +Signed-off-by: Roy Li <[email protected]> +--- + client/scripts/linux | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +diff --git a/client/scripts/linux b/client/scripts/linux +index 232a0aa..bdb5e22 100755 +--- a/client/scripts/linux ++++ b/client/scripts/linux +@@ -24,6 +24,8 @@ + + # 'ip' just looks too weird. /sbin/ip looks less weird. + ip=/sbin/ip ++ETCDIR="/etc/dhcp" ++export SAVEDIR=/var/lib/dhclient + + make_resolv_conf() { + if [ x"$new_domain_name_servers" != x ]; then +@@ -80,6 +82,20 @@ exit_with_hooks() { + exit $exit_status + } + ++execute_client_side_configuration_scripts() { ++# execute any additional client side configuration scripts we have ++ if [ "${1}" == "config" ] || [ "${1}" == "restore" ]; then ++ for f in ${ETCDIR}/dhclient.d/*.sh ; do ++ if [ -x ${f} ]; then ++ subsystem="${f%.sh}" ++ subsystem="${subsystem##*/}" ++ . ${f} ++ "${subsystem}_${1}" ++ fi ++ done ++ fi ++} ++ + # Invoke the local dhcp client enter hooks, if they exist. + if [ -f /etc/dhclient-enter-hooks ]; then + exit_status=0 +@@ -198,11 +214,14 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW] || \
+ ${ip} -4 route add ${alias_ip_address} dev ${interface}Quoted 1 line
/dev/null2>&1meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +7
-0+ fi + make_resolv_conf ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + + if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason =xRELEASE ] \
meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +16
-0+ || [ x$reason = xSTOP ]; then ++ execute_client_side_configuration_scripts "restore" ++ + if [ x$alias_ip_address != x ]; then + # Turn off alias interface. + ${ip} -4 addr flush dev ${interface} label ${interface}:0 +@@ -281,7 +300,7 @@ if [ x$reason = xBOUND6 ] ; then + + # Check for nameserver options. + make_resolv_conf +- ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -299,6 +318,7 @@ if [ x$reason = xRENEW6 ] || [ x$reason =xREBIND6 ] ; then
meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +27
-1+ make_resolv_conf + fi + ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -310,6 +330,7 @@ if [ x$reason = xDEPREF6 ] ; then + ${ip} -f inet6 addr change ${new_ip6_address}/${new_ip6_prefixlen} \ + dev ${interface} scope global preferred_lft 0 + ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -318,6 +339,8 @@ if [ x$reason = xEXPIRE6 -o x$reason = xRELEASE6 -o x$reason = xSTOP6 ] ; then + exit_with_hooks 2; + fi + ++ execute_client_side_configuration_scripts "restore" ++ + ${ip} -f inet6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \ + dev ${interface} + +-- +1.9.1 +meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb +1
-0@@ -6,6 +6,7 @@ SRC_URI += "file://dhcp-3.0.3-dhclient-dbus.patch;striplevel=0 \ file://fixsepbuild.patch \ file://dhclient-script-drop-resolv.conf.dhclient.patch \ file://replace-ifconfig-route.patch \ + file://dhcp-add-exec-script-function.patch \ "SRC_URI[md5sum] = "
5a284875dd2c12ddd388416d69156a67"meta/recipes-connectivity/dhcp/files/dhclient.conf +1
-0@@ -17,6 +17,7 @@ #supersede domain-name "fugue.com home.vix.com"; #prepend domain-name-servers 127.0.0.1; request subnet-mask, broadcast-address, time-offset, routers, + nis-domain, nis-servers, domain-search, ntp-servers, domain-name, domain-name-servers, host-name, netbios-name-servers, netbios-scope; #require subnet-mask, domain-name-servers;
Signature · 2 lines
Best Reagrds, Roy | RongQing Li
Quoted 10 lines · Rongqing Li
Quoted 3 lines · Rongqing Li
ping
-Roy
ping
-R
Ping
-Roy
Quoted 171 lines
Quoted 170 lines · On 2015年07月17日 14:31, [email protected] wrote:
Quoted 166 lines
From: Li Wang <[email protected]>
Make dhclient to run
/etc/dhcp/dhclient.d/*.sh, and get the configuration
for ntp, nis or other programesThese codes are from redhat rpm package.
Signed-off-by Li Wang <[email protected]>Signed-off-by Roy Li <[email protected]>--- .../dhcp/dhcp/dhcp-add-exec-script-function.patch | 101 +++++++++++++++++++++ meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb | 1 + meta/recipes-connectivity/dhcp/files/dhclient.conf | 1 + 3 files changed, 103 insertions(+)create mode 100644
meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patchdiff --git
a/meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch
b/meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patchnew file mode 100644
index 0000000..73b3ce4
---/dev/null
+++b/meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patchmeta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +5
-0@@ -0,0 +1,101 @@ +[PATCH] dhcp: add exec script function + +Upstream-Statue: Pending + +Make dhclient to run /etc/dhcp/dhclient.d/*.sh, and get theconfiguration
meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +45
-0+for ntp, nis or other programes + +These codes are from redhat rpm packages. + +Signed-off-by: Li Wang <[email protected]> +Signed-off-by: Roy Li <[email protected]> +--- + client/scripts/linux | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +diff --git a/client/scripts/linux b/client/scripts/linux +index 232a0aa..bdb5e22 100755 +--- a/client/scripts/linux ++++ b/client/scripts/linux +@@ -24,6 +24,8 @@ + + # 'ip' just looks too weird. /sbin/ip looks less weird. + ip=/sbin/ip ++ETCDIR="/etc/dhcp" ++export SAVEDIR=/var/lib/dhclient + + make_resolv_conf() { + if [ x"$new_domain_name_servers" != x ]; then +@@ -80,6 +82,20 @@ exit_with_hooks() { + exit $exit_status + } + ++execute_client_side_configuration_scripts() { ++# execute any additional client side configuration scripts we have ++ if [ "${1}" == "config" ] || [ "${1}" == "restore" ]; then ++ for f in ${ETCDIR}/dhclient.d/*.sh ; do ++ if [ -x ${f} ]; then ++ subsystem="${f%.sh}" ++ subsystem="${subsystem##*/}" ++ . ${f} ++ "${subsystem}_${1}" ++ fi ++ done ++ fi ++} ++ + # Invoke the local dhcp client enter hooks, if they exist. + if [ -f /etc/dhclient-enter-hooks ]; then + exit_status=0 +@@ -198,11 +214,14 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW] || \
+ ${ip} -4 route add ${alias_ip_address} dev ${interface}Quoted 1 line
/dev/null2>&1meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +7
-0+ fi + make_resolv_conf ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + + if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason =xRELEASE ] \
meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +16
-0+ || [ x$reason = xSTOP ]; then ++ execute_client_side_configuration_scripts "restore" ++ + if [ x$alias_ip_address != x ]; then + # Turn off alias interface. + ${ip} -4 addr flush dev ${interface} label ${interface}:0 +@@ -281,7 +300,7 @@ if [ x$reason = xBOUND6 ] ; then + + # Check for nameserver options. + make_resolv_conf +- ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -299,6 +318,7 @@ if [ x$reason = xRENEW6 ] || [ x$reason =xREBIND6 ] ; then
meta/recipes-connectivity/dhcp/dhcp/dhcp-add-exec-script-function.patch new file +27
-1+ make_resolv_conf + fi + ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -310,6 +330,7 @@ if [ x$reason = xDEPREF6 ] ; then + ${ip} -f inet6 addr change ${new_ip6_address}/${new_ip6_prefixlen} \ + dev ${interface} scope global preferred_lft 0 + ++ execute_client_side_configuration_scripts "config" + exit_with_hooks 0 + fi + +@@ -318,6 +339,8 @@ if [ x$reason = xEXPIRE6 -o x$reason = xRELEASE6 -o x$reason = xSTOP6 ] ; then + exit_with_hooks 2; + fi + ++ execute_client_side_configuration_scripts "restore" ++ + ${ip} -f inet6 addr del ${old_ip6_address}/${old_ip6_prefixlen} \ + dev ${interface} + +-- +1.9.1 +meta/recipes-connectivity/dhcp/dhcp_4.3.2.bb +1
-0@@ -6,6 +6,7 @@ SRC_URI += "file://dhcp-3.0.3-dhclient-dbus.patch;striplevel=0 \ file://fixsepbuild.patch \ file://dhclient-script-drop-resolv.conf.dhclient.patch \ file://replace-ifconfig-route.patch \ + file://dhcp-add-exec-script-function.patch \ "SRC_URI[md5sum] = "
5a284875dd2c12ddd388416d69156a67"meta/recipes-connectivity/dhcp/files/dhclient.conf +1
-0@@ -17,6 +17,7 @@ #supersede domain-name "fugue.com home.vix.com"; #prepend domain-name-servers 127.0.0.1; request subnet-mask, broadcast-address, time-offset, routers, + nis-domain, nis-servers, domain-search, ntp-servers, domain-name, domain-name-servers, host-name, netbios-name-servers, netbios-scope; #require subnet-mask, domain-name-servers;
Signature · 2 lines
Best Reagrds, Roy | RongQing Li