Ticket #6435: udhcpc_script_prevent_staticroutes_to_myself.patch

File udhcpc_script_prevent_staticroutes_to_myself.patch, 694 bytes (added by devel@…, 5 years ago)

Skip routes via the router itself (otherwise the router can't communicate into its LAN)

  • usr/share/udhcpc/default.script

    diff -ruN orig/usr/share/udhcpc/default.script new/usr/share/udhcpc/default.script
    old new  
    1616        local type 
    1717        while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do 
    1818                [ ${1##*/} -eq 32 ] && type=host || type=net 
    19                 echo "udhcpc: adding route for $type $1 via $2" 
    20                 route add -$type "$1" gw "$2" dev "$interface" 
     19                if [ "$2" = "$ip" ]; then 
     20                        echo "udhcpc: skipping route via myself" 
     21                else 
     22                        echo "udhcpc: adding route for $type $1 via $2" 
     23                        route add -$type "$1" gw "$2" dev "$interface" 
     24                fi 
    2125                max=$(($max-1)) 
    2226                shift 2 
    2327        done