Added support for changing mellanox mlx4 devices to ethernet to use them as 10g
[bootimage-initfs.git] / etc / ifup.udhcp.sh
1 #!/bin/ash
2
3 [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
4
5 RESOLV_CONF="/etc/resolv.conf"
6 [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
7 [ -n "$subnet" ] && NETMASK="netmask $subnet"
8
9 case "$1" in
10         deconfig)
11                 /sbin/ifconfig $interface 0.0.0.0
12                 ;;
13
14         renew|bound)
15                 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
16
17                 if [ -n "$router" ] ; then
18                         while /sbin/route del default gw 0.0.0.0 dev $interface ; do
19                                 :
20                         done
21
22                         for i in $router ; do
23                                 /sbin/route add default gw $i dev $interface
24                         done
25                 fi
26
27                 echo -n > $RESOLV_CONF
28                 [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
29                 for i in $dns ; do
30                         echo adding dns $i
31                         echo nameserver $i >> $RESOLV_CONF
32                 done
33                 ;;
34 esac
35
36 echo "NET_INTERFACE=$interface"         > /tmp/network.dhcp
37 echo "NET_IPADDR=$ip"                   >> /tmp/network.dhcp
38 echo "NET_SUBNET=$subnet"               >> /tmp/network.dhcp
39 echo "NET_BROADCAST=$broadcast"         >> /tmp/network.dhcp
40 echo "NET_ROUTER=$router"               >> /tmp/network.dhcp
41
42 MAC=`/sbin/ifconfig $interface | grep HWaddr | cut -d ' ' -f 11 | tr [A-H] [a-h]`
43 echo "NET_MACADDR=$MAC"                 >> /tmp/network.dhcp
44
45
46 exit 0