@@ -7,7 +7,7 @@ ACTION="$1"
77IP_CACHE=" /var/lib/misc/${interface} .cache"
88RESOLV_CONF=" /run/resolvconf/interfaces/${interface} .conf"
99NTPFILE=" /run/chrony/dhcp-sources.d/${interface} .sources"
10- NAME=" /etc/frr/static .d/${interface} -dhcp.conf"
10+ NAME=" /etc/netd/conf .d/${interface} -dhcp.conf"
1111NEXT=" ${NAME} +"
1212
1313[ -n " $broadcast " ] && BROADCAST=" broadcast $broadcast "
@@ -75,14 +75,23 @@ was_option_requested()
7575# client MUST ignore the Router option.
7676set_dhcp_routes ()
7777{
78- echo " ! Generated by udhcpc" > " $NEXT "
78+ echo " # Generated by udhcpc" > " $NEXT "
79+ echo " " >> " $NEXT "
7980 if [ -n " $staticroutes " ]; then
8081 if was_option_requested 121; then
8182 # format: dest1/mask gw1 ... destn/mask gwn
8283 set -- $staticroutes
8384 while [ -n " $1 " -a -n " $2 " ]; do
8485 dbg " adding route $1 via $2 metric $metric tag 100"
85- echo " ip route $1 $2 $metric tag 100" >> " $NEXT "
86+ cat >> " $NEXT " << -EOF
87+ route {
88+ prefix = "$1 "
89+ nexthop = "$2 "
90+ distance = $metric
91+ tag = 100
92+ }
93+
94+ EOF
8695 shift 2
8796 done
8897 else
@@ -91,7 +100,15 @@ set_dhcp_routes()
91100 elif [ -n " $router " ] ; then
92101 if was_option_requested 3; then
93102 for i in $router ; do
94- echo " ip route 0.0.0.0/0 $i $metric tag 100" >> " $NEXT "
103+ cat >> " $NEXT " << -EOF
104+ route {
105+ prefix = "0.0.0.0/0"
106+ nexthop = "$i "
107+ distance = $metric
108+ tag = 100
109+ }
110+
111+ EOF
95112 done
96113 else
97114 log " ignoring unrequested router (option 3)"
@@ -102,7 +119,7 @@ set_dhcp_routes()
102119 cmp -s " $NAME " " $NEXT " && return
103120 mv " $NEXT " " $NAME "
104121
105- initctl -nbq restart staticd
122+ initctl reload netd
106123}
107124
108125clr_dhcp_routes ()
@@ -111,7 +128,7 @@ clr_dhcp_routes()
111128 [ -f " $NAME " ] || return
112129 rm " $NAME "
113130
114- initctl -nbq restart staticd
131+ initctl reload netd
115132}
116133
117134clr_dhcp_addresses ()
0 commit comments