Page MenuHomeVyOS Platform

Deprecated functions in /sbin/dhclient-script
Closed, ResolvedPublicBUG

Description

In the [[ https://github.com/vyos/vyos-replace/blob/e4a2eda8121a3a88b40868996577cde53a34ba0c/files/dhclient-script | /sbin/dhclient-script ]] is still exist $new_interface_mtu part which trying to run:

/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$interface --path

But, this was removed long time ago.

The same situation about vyatta_update_resolv.pl, link to which still exist in dhclient-script, but the script was removed.
We need to remove this rudiments from the dhclient-script too.

Details

Difficulty level
Easy (less than an hour)
Version
1.2.1
Why the issue appeared?
Will be filled on close

Related Objects

Event Timeline

zsdc changed the task status from Open to Confirmed.May 14 2019, 12:19 AM
zsdc assigned this task to hagbard.
zsdc triaged this task as Normal priority.
zsdc renamed this task from Deprecated function in /sbin/dhclient-script to Deprecated functions in /sbin/dhclient-script.May 14 2019, 2:16 PM
zsdc updated the task description. (Show Details)

Does it cause issues? I'm about to remove it from the code, juts want to find out if it is something urgent.

It's causing a few cloudinit log errors on GCP during 1st boot. We speculate that might be the cause of some of the issues getting an image running correctly on the 1st boot.

hagbard added subscribers: UnicronNL, hagbard.

https://github.com/vyos/vyos-replace/pull/2

I don't have write access, I created a PR and assign the task to @UnicronNL to review and either merge or reject.

@hagbard @UnicronNL, please make a new one PR. This is correct patch:

diff -Naur origin/dhclient-script pull2/dhclient-script
--- origin/dhclient-script	2019-05-15 19:32:59.001598203 +0300
+++ pull2/dhclient-script	2019-05-15 19:33:47.533181873 +0300
@@ -39,7 +39,6 @@
         echo " " > $new_resolv_conf
     fi
 
-    /opt/vyatta/sbin/vyatta_update_resolv.pl --dhclient-script 1
     if ! diff -q $old_resolv_conf $new_resolv_conf >&/dev/null; then
        if [ -d /opt/vyatta/config/active/service/dns/forwarding ]; then
           /opt/vyatta/sbin/vyatta-dns-forwarding.pl --update-dnsforwarding --outside-cli >&/dev/null
@@ -176,23 +175,6 @@
 if [ -n "$old_subnet_mask" ]; then
     old_prefix=$(get_prefix $old_ip_address $old_subnet_mask)
 fi
-if [ -n "$new_interface_mtu" ]; then
-    # Vyatta configuration overrides response from server to allow user
-    # to work around broken ISP's
-    mtu_path=$(/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$interface --path)
-    if [ -r $mtu_path ]; then
-	read new_interface_mtu < $mtu_path
-    fi
-
-    # The 576 MTU is only used for X.25 and dialup connections
-    # where the admin wants low latency.  Such a low MTU can cause
-    # problems with UDP traffic, among other things.  As such,
-    # disallow MTUs from 576 and below by default, so that broken
-    # MTUs are ignored, but higher stuff is allowed (1492, 1500, etc).
-    if [ $new_interface_mtu -le 576 ]; then
-	new_interface_mtu=
-    fi
-fi
 
 # The action starts here

Sorry I can't merge it, no write access for me.

In order to fully fix cloud-init issues this patch needs to be applied so that /etc/resolv.conf can be updated by cloud-init before host_name.py generates final resolv.conf. Since cloud-init fires before VyOS scripts this is required so that GCE metadata can be retried by cloud-init on 1st boot.

--- dhclient-script-old 2019-05-15 13:46:52.565872200 -0500
+++ dhclient-script-patched     2019-05-15 13:46:08.964544600 -0500
@@ -18,6 +18,7 @@
 make_resolv_conf() {
     local new_resolv_conf="/etc/resolv.conf.dhclient-new-$interface"
     local old_resolv_conf="/etc/resolv.conf.dhclient-old-$interface"
+    local resolv_conf="/etc/resolv.conf"
     mv -f $new_resolv_conf $old_resolv_conf
     if [ -n "$new_domain_name" -o -n "$new_domain_name_servers" ]; then
         if [ -n "$new_domain_name" ]; then
@@ -39,13 +40,13 @@
         echo " " > $new_resolv_conf
     fi

-    /opt/vyatta/sbin/vyatta_update_resolv.pl --dhclient-script 1
     if ! diff -q $old_resolv_conf $new_resolv_conf >&/dev/null; then
        if [ -d /opt/vyatta/config/active/service/dns/forwarding ]; then
           /opt/vyatta/sbin/vyatta-dns-forwarding.pl --update-dnsforwarding --outside-cli >&/dev/null
        fi
     fi
     rm -f $old_resolv_conf
+    mv -f $new_resolv_conf $resolv_conf
 }

 run_hook() {
@@ -176,23 +177,6 @@
 if [ -n "$old_subnet_mask" ]; then
     old_prefix=$(get_prefix $old_ip_address $old_subnet_mask)
 fi
-if [ -n "$new_interface_mtu" ]; then
-    # Vyatta configuration overrides response from server to allow user
-    # to work around broken ISP's
-    mtu_path=$(/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$interface --path)
-    if [ -r $mtu_path ]; then
-       read new_interface_mtu < $mtu_path
-    fi
-
-    # The 576 MTU is only used for X.25 and dialup connections
-    # where the admin wants low latency.  Such a low MTU can cause
-    # problems with UDP traffic, among other things.  As such,
-    # disallow MTUs from 576 and below by default, so that broken
-    # MTUs are ignored, but higher stuff is allowed (1492, 1500, etc).
-    if [ $new_interface_mtu -le 576 ]; then
-       new_interface_mtu=
-    fi
-fi

 # The action starts here

@joshua Can you please create a PR in github for this please, then you can post the reference here. thanks.

Also, there appear to be some leftovers from before 1.2 in dhclient-script@Line45, where vyatta-dns-forwarding.pl was removed in favour of dns_forwarding.py.