summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2010-02-21 12:53:23 +0100
committerJames Rayner <james@archlinux.org>2010-02-21 12:53:23 +0100
commit3ef5489578b849d3632cbd858245e0f18b5fe8dd (patch)
tree496980fb0febe74977be622400ec17c2477dcb7f
parent1b3a2e870c5619ad3a6c2ca5c7f30ccf37c8d422 (diff)
downloadnetctl-3ef5489578b849d3632cbd858245e0f18b5fe8dd.tar.gz
netctl-3ef5489578b849d3632cbd858245e0f18b5fe8dd.tar.xz
Add adjustable netmask to IP='static'
-rw-r--r--docs/ethernet2
-rw-r--r--src/connections/ethernet5
2 files changed, 5 insertions, 2 deletions
diff --git a/docs/ethernet b/docs/ethernet
index a128697..5df810a 100644
--- a/docs/ethernet
+++ b/docs/ethernet
@@ -16,6 +16,8 @@ ADDR (requires IP of 'static')
: A single IP address to configure a static IP. For example:
GATEWAY (requires IP of 'static')
: Set specified gateway
+NETMASK (requires IP of 'static')
+: Set specified netmask. Defaults to 24
IPCFG
: Array of arguments to pass to 'ip'. The power of this options is that it allows both simple and complicated routing configurations, within the framework of netcfg.
IFOPTS (deprecated, requires IP of 'static')
diff --git a/src/connections/ethernet b/src/connections/ethernet
index 8e51cf9..36f6b93 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -71,8 +71,9 @@ ethernet_up() {
;;
static)
if [[ -n "$ADDR" ]]; then
- report_debug ethernet_iproute_up ip addr add "$ADDR/24" brd + dev "$INTERFACE"
- if ! ip addr add "$ADDR/24" brd + dev "$INTERFACE"; then
+ [[ -z $NETMASK ]] && NETMASK=24
+ report_debug ethernet_iproute_up ip addr add "$ADDR/$NETMASK" brd + dev "$INTERFACE"
+ if ! ip addr add "$ADDR/$NETMASK" brd + dev "$INTERFACE"; then
report_iproute "Could not configure interface"
fi
fi