]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/initscripts/init.d/networking/dhcpcd.exe
Merge remote-tracking branch 'erik/sendEmail' into core67-merge
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / networking / dhcpcd.exe
index d69f53d0b43d5bcdb58999467c14cca8769c1d68..a7bad47b5037c0af2ef4af5551940ef21a51b6f0 100644 (file)
@@ -23,11 +23,23 @@ dhcpcd_up()
        set | grep "^new_" | sed "s|^new_||g" | \
        sort > /var/ipfire/dhcpc/dhcpcd-$interface.info
 
+       #Check if this was the Red device...
+       if [ ! "$interface" == "$RED_DEV" ]; then
+               exit 0;
+       fi
+
        # Only if RED_TYPE=DHCP update /var/ipfire/red
        if [ "$RED_TYPE" == "DHCP" ]; then
 
+               #Force MTU option for KabelDeutschland because this ISP
+               #set the MTU to 576 instead of the supportet 1500
+               if [ $RED_DHCP_FORCE_MTU -ge 576 ]; then
+                       logger -p local0.info -t dhcpcd.exe[$$] "Force mtu to $RED_DHCP_FORCE_MTU"
+                       ip link set $interface mtu $RED_DHCP_FORCE_MTU
+               fi
+
                #Check if we have to restart the services at update
-               [ ! -e "/var/ipfire/red/active" ] update=1;
+               [ ! -e "/var/ipfire/red/active" ] && update=1;
                if [ "$old_domain_name_service" != "$new_domain_name_service" ]; then
                        update=1;
                fi
@@ -49,17 +61,17 @@ dhcpcd_up()
                fi
 
                #Get IP Address
-               echo "$new_ip_address"  > /var/ipfire/red/local-ipaddress
+               echo -n "$new_ip_address"  > /var/ipfire/red/local-ipaddress
 
                #Get default gateway
-               grep -v " gateway$" /etc/hosts > /tmp/hosts
-               echo "$new_routers gateway"  >> /tmp/hosts
+               grep -v -E "\<gateway\>" /etc/hosts > /tmp/hosts
+               echo "$new_routers      gateway"  >> /tmp/hosts
                mv /tmp/hosts /etc/hosts
 
        fi
        if [ $update ]; then
                [ -e "/var/ipfire/red/active" ] || touch /var/ipfire/red/active
-               echo "$new_routers" > /var/ipfire/red/remote-ipaddress
+               echo -n "$new_routers" > /var/ipfire/red/remote-ipaddress
                logger -p local0.info -t dhcpcd.exe[$$] "$interface has been (re)configured with IP=$new_ip_address"
                run_subdir ${rc_base}/init.d/networking/red.up/
                touch /var/ipfire/red/active