1 ########################################################################
4 # Description : DHCP Client Script
6 # Authors : Arne Fitzenreiter - arne_f@ipfire.org
12 ########################################################################
18 eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
19 eval $(/usr/local/bin/readhash /var/ipfire/dns/settings)
23 set | grep "^new_" | sed "s|^new_||g" | \
24 sort > /var/ipfire/dhcpc/dhcpcd-$interface.info
26 #Check if this was the Red device...
27 if [ ! "$interface" == "$RED_DEV" ]; then
31 # Only if RED_TYPE=DHCP update /var/ipfire/red
32 if [ "$RED_TYPE" == "DHCP" ]; then
34 #Check if we have to restart the services at update
35 [ ! -e "/var/ipfire/red/active" ] && update=1;
36 if [ "$old_domain_name_service" != "$new_domain_name_service" ]; then
39 if [ "$old_ip_address" != "$new_ip_address" ]; then
42 if [ "$old_routers" != "$new_routers" ]; then
47 if [ -n "$DNS0" ] && [ -n "$DNS1" ]; then
48 logger -p local0.info -t dhcpcd.exe[$$] "Overwritting DNS-Server addresses with ${DNS0},${DNS1}"
49 echo -n ${DNS0} > /var/ipfire/red/dns1
50 echo -n ${DNS1} > /var/ipfire/red/dns2
52 echo -n `/etc/rc.d/helper/getdnsfromdhcpc.pl 1` > /var/ipfire/red/dns1
53 echo -n `/etc/rc.d/helper/getdnsfromdhcpc.pl 2` > /var/ipfire/red/dns2
57 echo -n "$new_ip_address" > /var/ipfire/red/local-ipaddress
60 grep -v -E "\<gateway\>" /etc/hosts > /tmp/hosts
61 echo "$new_routers gateway" >> /tmp/hosts
62 mv /tmp/hosts /etc/hosts
66 [ -e "/var/ipfire/red/active" ] || touch /var/ipfire/red/active
67 echo -n "$new_routers" > /var/ipfire/red/remote-ipaddress
68 logger -p local0.info -t dhcpcd.exe[$$] "$interface has been (re)configured with IP=$new_ip_address"
69 run_subdir ${rc_base}/init.d/networking/red.up/
70 touch /var/ipfire/red/active
76 set | grep "^new_" | sed "s|^new_||g" | \
77 sort > /var/ipfire/dhcpc/dhcpcd-$interface.info
79 # Only if RED_TYPE=DHCP update /var/ipfire/red
80 if [ "$RED_TYPE" == "DHCP" ]; then
81 logger -p local0.info -t dhcpcd.exe[$$] "${interface} has been brought down"
82 rm -f /var/ipfire/red/active
83 run_subdir ${rc_base}/init.d/networking/red.down/
88 BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) dhcpcd_up;;
89 PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) dhcpcd_down;;