'renewal time'에 해당되는 글 1

  1. 2009.01.02 [BugFix] Continually renews IP regardless of nothing to change
It was terrible to me to be disconnected my internet environment every one hour. 

I installed OpenWRT to my router(ASUS 500W) because I want to use it variously. 

But it had a bug of the DHCP client(udhcpc) which is a part of buzybox package.

This renews my IP every renewal time(In case of KT, the renewal time is ONE hour(3600 secs.)) despite that my dynamic IP was not changed. 

It causes 2 problems. 
  • To occur errors of the messenger because of disconnecting my network shortly. 
  • To increase  the temporary file(/var/state/network).
I was modified my udhcpc script(/usr/share/udhcpc/default.script) temporarily. 

Today I found the bugfix of it. It was released 5 months ago but it was not included the main firmware version(kamikaze 7.09). 

You can fix this just to replace the script(/usr/share/udhcpc/default.script).

#!/bin/sh
[ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1
. /etc/functions.sh
include /lib/network

RESOLV_CONF="/tmp/resolv.conf.auto"

hotplug_event() {
        [ ifup = "$1" ] && {
                uci set "/var/state/network.$iface.ipaddr=$ip"
                uci set "/var/state/network.$iface.netmask=${subnet:-255.255.255.0}"
                uci set "/var/state/network.$iface.dnsdomain=$domain"
                uci set "/var/state/network.$iface.dns=$dns"
                uci set "/var/state/network.$iface.gateway=$router"
        }
        env -i ACTION="$1" INTERFACE="$iface" DEVICE="$ifname" PROTO=dhcp /sbin/hotplug-call iface
}


# Find corresponding OpenWRT interface for ifname (=$interface)
# $ifname, $iface are set
find_interface() {
        local ifc proto
       
        scan_interfaces
       
        for ifc in $interfaces; do
                config_get ifname $ifc ifname
                [ "$ifname" = "$interface" ] || continue
               
                config_get proto $ifc proto
                [ "$proto" = "dhcp" ] && iface="$ifc" && break
        done
}                                                                                       
config_load /var/state/network
find_interface
case "$1" in
        deconfig)
                ifconfig $iface 0.0.0.0
                hotplug_event ifdown
        ;;
        renew|bound)
                is_change=
               
                [ `CONFIG_GET "$IFACE" IPADDR` != "$IP" ] && {
                        IFCONFIG $INTERFACE $IP \
                        NETMASK ${SUBNET:-255.255.255.0} \
                        BROADCAST ${BROADCAST:-+}
               
                        IS_CHANGE=1
               
                }
                [ `CONFIG_GET "$IFACE" ROUTER` != "$ROUTER" ] && [ -N "$ROUTER" ] && {
                        FOR I IN $ROUTER ; DO
                                ECHO "ADDING ROUTER $I"
                                ROUTE ADD DEFAULT GW $I DEV $INTERFACE
                                VALID="$VALID|$I"
                        DONE
                        ECHO "DELETING OLD ROUTES"
                        $(route -n | awk '/^0.0.0.0\W{9}('$valid')\W/ {next} /^0.0.0.0/ {print "route del -net "$1" gw "$2";"}')
                       
                        is_change=1
                }       
                       
                config_get static_dns $iface dns
                [ -n "$static_dns" ] && dns="$static_dns"
                                                                               
                [ `config_get "$iface" dns` != "$dns" ] && [ -n "$dns" ] && {
                        echo -n > "${RESOLV_CONF}.tmp"
                        ${domain:+echo search $domain} >> "${RESOLV_CONF}.tmp"
                        for i in $dns ; do
                                echo "adding dns $i"
                                echo "nameserver $i" >> "${RESOLV_CONF}.tmp"
                        done
                        mv "${RESOLV_CONF}.tmp" "$RESOLV_CONF"
                       
                        is_change=1
                }
               
                [ "$is_change" ] && hotplug_event ifup
              
                # user rules
                [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user "$1"
        ;;
esac
exit 0

신고
이전 1 다음

티스토리 툴바