1
0
This repository has been archived on 2025-01-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Anderson Luiz Alves 0464e230c1 stock 103961
2017-07-30 16:48:04 -03:00

57 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
# /etc/bewan/scripts/ip-up-dhcp
# called when DHCP client gets an IP address
# setparam is already included by calling script
# Environnement variables:
# IFNAME: interface name
# IPADDR: IP address
# SMASK: subnet mask
# BCAST: broadcast address
# ROUTERS: gateways
# SERVERS: DNS servers
# DHCPSRV: DHCP server
# DOMAIN: Domain name
# ZEROCONF: zeroconf specific command if exists
main_ip_up_dhcp() {
base_log "$SCRIPTD/ip-up-dhcp $IFNAME $IPADDR/$SMASK" debug
touch "$INTFD/$IFNAME/dhcp-up"
local SMASK_ARG=''; [ "$SMASK" != '' ] && SMASK_ARG="netmask $SMASK"
local BCAST_ARG=''; [ "$BCAST" != '' ] && BCAST_ARG="broadcast $BCAST"
# LAN network interface is up
# DHCP client is up on LAN side
if [ -f "$INTFD/$IFNAME/lanid" ]; then
local LANID=`cat $INTFD/$IFNAME/lanid`
local SERVERS=''
local overrideDNS
eval overrideDNS=\${'LANDevice_'$LANID'_DNSOverrideAllowed':-0}
if [ $overrideDNS -eq 1 ]; then
eval SERVERS=\${'LANDevice_'$LANID'_DNSServers':-}
fi
ifconfig $IFNAME $IPADDR $SMASK_ARG $BCAST_ARG
base_call_scripts 'ip-up-lan'
# DHCP client is up on WAN side
elif [ -f "$INTFD/$IFNAME/wanid" ]; then
local WANID=`cat $INTFD/$IFNAME/wanid`
local MTU=`cat $WAND/$WANID/ip/mtu`
ifconfig $IFNAME $IPADDR $SMASK_ARG $BCAST_ARG mtu $MTU
local IPREMOTE=''
base_call_scripts 'ip-up'
fi
# Executes zeroconf specific command:
# Adds second ip adress doing "ip add ...")
if [ "${ZEROCONF:-}" != '' ]; then
$ZEROCONF
fi
}
main_ip_up_dhcp