]> git.ipfire.org Git - people/ms/network.git/commitdiff
Merge remote-tracking branch 'ms/isdn'
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 17 May 2012 15:30:26 +0000 (15:30 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 17 May 2012 15:30:26 +0000 (15:30 +0000)
1  2 
functions.ipv4

diff --cc functions.ipv4
index 1220d491883729c30a8b67e095da09ad05153933,65cdcf7370315aac06761da89303051e2a366ab6..dff33e39abcb3592790a838c45bf7078c8aa091d
@@@ -74,33 -80,20 +80,50 @@@ function ipv4_get_netaddress() 
        return ${EXIT_OK}
  }
  
 +function ipv4_get_prefix() {
 +      local address=${1}
 +      local broadcast=${2}
 +
 +      assert isset address
 +      assert isset broadcast
 +
 +      local PREFIX
 +      eval $(ipcalc --prefix ${address} ${broadcast})
 +      assert isset PREFIX
 +
 +      echo "${PREFIX}"
 +      return ${EXIT_OK}
 +}
 +
 +function ipv4_flush_device() {
 +      #
 +      # Flushes all routes, addresses from the device
 +      # and clears the ARP cache.
 +      #
 +
 +      local device=${1}
 +      assert isset device
 +
 +      ip -4 addr flush dev ${device} >/dev/null 2>&1
 +      ip -4 route flush dev ${device} >/dev/null 2>&1
 +      ip -4 neigh flush dev ${device} >/dev/null 2>&1
 +
 +      return 0
++
+ function ipv4_prefix2netmask() {
+       local prefix=${1}
+       shift
+       assert isinteger prefix
+       # XXX this function is a stub
+       case "${prefix}" in
+               24)
+                       echo "255.255.255.0"
+                       ;;
+               *)
+                       assert false NOT IMPLEMENTED
+                       ;;
+       esac
  }