network/ifup.sh: handle $dns1 and $dns2 from "ip=" settings

master
Harald Hoyer 2014-01-30 17:12:24 +01:00
parent e95e48c6ee
commit 1982098e00
2 changed files with 19 additions and 9 deletions

View File

@ -472,6 +472,13 @@ cannot be used in conjunction with the **ifname** argument for the
same <interface>.
=====================

**ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__[:[__<dns1>__][:__<dns2>__]]::
explicit network configuration. If you want do define a IPv6 address, put it
in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
times. __<peer>__ is optional and is the address of the remote endpoint
for pointopoint interfaces and it may be followed by a slash and a decimal
number, encoding the network prefix length.

**ifname=**__<interface>__:__<MAC>__::
Assign network device name <interface> (ie "bootnet") to the NIC with
MAC <MAC>.

View File

@ -264,18 +264,15 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
ip link set "$vlanname" up
fi

# setup nameserver
namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf

# No ip lines default to dhcp
ip=$(getarg ip)

if [ -z "$ip" ]; then
namesrv=$(getargs nameserver)
for s in $namesrv; do
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done

if [ "$netroot" = "dhcp6" ]; then
do_dhcp -6
else
@ -307,8 +304,14 @@ for p in $(getargs ip=); do
[ "$use_bridge" != 'true' ] && \
[ "$use_vlan" != 'true' ] && continue

# setup nameserver
namesrv="$dns1 $dns2 $(getargs nameserver)"
for s in $namesrv; do
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done

# Store config for later use
for i in ip srv gw mask hostname macaddr; do
for i in ip srv gw mask hostname macaddr dns1 dns2; do
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
done > /tmp/net.$netif.override