/[baselayout]/trunk/net-scripts/net.modules.d/iproute2
Gentoo

Diff of /trunk/net-scripts/net.modules.d/iproute2

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 871 Revision 872
118# void iproute2_get_address(char *interface) 118# void iproute2_get_address(char *interface)
119# 119#
120# Fetch the address retrieved by DHCP. If successful, echoes the 120# Fetch the address retrieved by DHCP. If successful, echoes the
121# address on stdout, otherwise echoes nothing. 121# address on stdout, otherwise echoes nothing.
122iproute2_get_address() { 122iproute2_get_address() {
123 ip -family inet addr show $1 2>${devnull} | sed -ne 's/.*inet \([^ ]*\)\/.*/\1/p' 123 ip -family inet addr show $1 2>${devnull} | sed -ne 's/.*inet \([^ ]*\).*/\1/p'
124} 124}
125 125
126# void iproute2_get_mac_address(char *interface) 126# void iproute2_get_mac_address(char *interface)
127# 127#
128# Fetch the mac address assingned to the network card 128# Fetch the mac address assingned to the network card
233 # If the address already exists then the following command 233 # If the address already exists then the following command
234 # will fail. Catch the failure and be graceful 234 # will fail. Catch the failure and be graceful
235 x=$( ip addr add dev ${iface} ${config[@]} 2>&1 ) 235 x=$( ip addr add dev ${iface} ${config[@]} 2>&1 )
236 case "${x}" in 236 case "${x}" in
237 'RTNETLINK answers: File exists'|'') 237 'RTNETLINK answers: File exists'|'')
238 eend 0
239 return 0 238 return 0
240 ;; 239 ;;
241 *) 240 *)
242 printf '%s\n' "${x}" >&2 241 printf '%s\n' "${x}" >&2
243 eend 1
244 return 1 242 return 1
245 esac 243 esac
246} 244}
247 245
248# bool iproute2_post_start(char *interface) 246# bool iproute2_post_start(char *interface)
285 done 283 done
286 eoutdent 284 eoutdent
287 285
288 return 0 286 return 0
289} 287}
288
289# void iproute2_default_route(char* gateway_ip)
290#
291# Force default route to the specified gateway, optionaly on
292# the given interface
293iproute2_default_route() {
294 ip route change default via $1 metric 0 2>/dev/null \
295 || ip route add default via $1 metric 0 2>/dev/null
296}

Legend:
Removed from v.871  
changed lines
  Added in v.872

  ViewVC Help
Powered by ViewVC 1.1.20