[arch-projects] [netcfg] [PATCH 1/2] Allow IPv4 $ADDR be specified as address/netmask
Mantas Mikulėnas
grawity at gmail.com
Sat Dec 8 19:09:10 EST 2012
This matches the syntax used by `ip` itself, and by $ADDR6.
---
src/connections/ethernet | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/connections/ethernet b/src/connections/ethernet
index 487adf8..6a16b66 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -87,9 +87,9 @@ ethernet_up() {
;;
static)
if [[ -n "$ADDR" ]]; then
- [[ -z $NETMASK ]] && NETMASK=24
- report_debug ethernet_up ip addr add "$ADDR/$NETMASK" brd + dev "$INTERFACE"
- if ! ip addr add "$ADDR/$NETMASK" brd + dev "$INTERFACE"; then
+ [[ $ADDR == */* ]] || ADDR+="/${NETMASK:-24}"
+ report_debug ethernet_up ip addr add "$ADDR" brd + dev "$INTERFACE"
+ if ! ip addr add "$ADDR" brd + dev "$INTERFACE"; then
report_iproute "Could not configure interface"
fi
fi
--
1.8.0.1
More information about the arch-projects
mailing list