Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: net/
Date: Wed, 21 Dec 2011 08:11:15
Message-Id: e5eb062f050d96a70f72ee78f431f774c98b24e2.robbat2@gentoo
1 commit: e5eb062f050d96a70f72ee78f431f774c98b24e2
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 21 07:44:53 2011 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 21 08:02:53 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=e5eb062f
7
8 net/iproute2: iproute2 flag handling
9
10 Several of the optional flags were not being handled correctly, they
11 were being passed as values only, without the keyword before them.
12 Affected keywords: anycast, label, scope, valid_lft, preferred_lft
13
14 Also change the handling of keywords to a common setup now, making
15 broadcast and peer strings the same as the above keywords.
16
17 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
18
19 ---
20 net/iproute2.sh | 16 ++++++++++------
21 1 files changed, 10 insertions(+), 6 deletions(-)
22
23 diff --git a/net/iproute2.sh b/net/iproute2.sh
24 index c8f670c..c3bb9c8 100644
25 --- a/net/iproute2.sh
26 +++ b/net/iproute2.sh
27 @@ -113,31 +113,35 @@ _add_address()
28
29 local address netmask broadcast peer anycast label scope
30 local valid_lft preferred_lft home nodad
31 + local confflaglist
32 address="$1" ; shift
33 while [ -n "$*" ]; do
34 case "$1" in
35 netmask)
36 netmask="/$(_netmask2cidr "$2")" ; shift ; shift ;;
37 broadcast|brd)
38 - broadcast="broadcast $2" ; shift ; shift ;;
39 + broadcast="$2" ; shift ; shift ;;
40 pointopoint|pointtopoint|peer)
41 - peer="peer $2" ; shift ; shift ;;
42 + peer="$2" ; shift ; shift ;;
43 anycast|label|scope|valid_lft|preferred_lft)
44 eval "$1=$2" ; shift ; shift ;;
45 home|nodad)
46 - eval "$1=$1" ; shift ;;
47 + # FIXME: If we need to reorder these, this will take more code
48 + confflaglist="${confflaglist} $1" ; shift ;;
49 esac
50 done
51
52 # Always scope lo addresses as host unless specified otherwise
53 if [ "${IFACE}" = "lo" ]; then
54 - [ -z "$scope" ] && scope="scope host"
55 + [ -z "$scope" ] && scope="host"
56 fi
57
58 # figure out the broadcast address if it is not specified
59 - [ -z "$broadcast" ] && broadcast="broadcast +"
60 + # FIXME: I'm not sure if this should be set if we are passing a peer arg
61 + [ -z "$broadcast" ] && broadcast="+"
62
63 - set -- "${address}${netmask}" $peer $broadcast $anycast $label $scope dev "${IFACE}" $valid_lft $preferred_lft $home $nodad
64 + # This must appear on a single line, continuations cannot be used
65 + set -- "${address}${netmask}" ${peer:+peer} ${peer} ${broadcast:+broadcast} ${broadcast} ${anycast:+anycast} ${anycast} ${label:+label} ${label} ${scope:+scope} ${scope} dev "${IFACE}" ${valid_lft:+valid_lft} $valid_lft ${preferred_lft:+preferred_lft} $preferred_lft $confflaglist
66 veinfo ip addr add "$@"
67 ip addr add "$@"
68 }