[Swan-dev] Fwd: Re: libreswan 3.9rc1 Release Candidate: please test!
D. Hugh Redelmeier
hugh at mimosa.com
Sat Jul 5 03:17:26 EEST 2014
| From: Ruben Laban <r.laban+lists at ism.nl>
...
| diff --git a/programs/_stackmanager/_stackmanager.in
| b/programs/_stackmanager/_stackmanager.in
| index 6c2a98f..0ad1066 100644
| --- a/programs/_stackmanager/_stackmanager.in
| +++ b/programs/_stackmanager/_stackmanager.in
| @@ -367,7 +367,6 @@ startklips() {
| if ($1 == "inet")
| sub(" [^ ]+:[^ ]+"," ",$0)
| sub("/.*","",$2)
| - sub("dynamic","",$7)
| for (i = 2; i < NF; i++) {
| if ($i == "brd" || $i == "peer" || $i == "secondary")
| i++
|
...
| Second hunk: the sub() makes it that NF becomes 7, breaking the for() loop
| after it. Another option is to replace that line with sub("dynamic","",$0).
sub("dynamic","",$0)
can be written more simply as
sub("dynamic","")
| I don't think it's needed at all, as the first line of the awk stuff already
| excludes dynamic IP addresses.
No, it excludes dynamic in the "inet6" case. But we're may be in the
"inet" case. (The indentation of the awk script is misleading.)
I don't really know what is the expected output of
ip addr show def ${phys}
so I don't really understand this awk script.
Here it is, properly indented (I think):
ip addr show dev ${phys} | \
awk '$1 == "inet" || ($1 == "inet6" && !/ dynamic/) {
cmd = "ip addr add"
if ($1 == "inet")
sub(" [^ ]+:[^ ]+"," ")
sub("/.*","",$2)
sub("dynamic","")
for (i = 2; i < NF; i++) {
if ($i == "brd" || $i == "peer" || $i == "secondary")
i++
else
cmd = cmd " " $i
}
if ($NF != phys)
cmd = cmd " " $NF
cmd = cmd " dev " virt ">/dev/null 2>/dev/null"
system(cmd)
}' phys=${phys} virt=${virt}
Indentation got mucked up in d5a917623ce2fb58ca254dd9013c7c7a5532aa70.
I've checked this into my git tree.
More information about the Swan-dev
mailing list