Skip to contentSkip to conversation

bug in default interface number computation

PATCH In review Guillaume Rousse 2 participants 3 messages Dec 18, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bug in default interface number computation

As previously explained, the network-bridge script tries to automatically find the default network interface number with the following ligne:
vifnum=${vifnum:-$(ip route list | awk '/^default / { print $NF }' | sed 's/^[^0-9]*//')}

However, this fails on mandriva, because the parsed line is:
default via 193.55.250.126 dev eth0 metric 10

Attached patch fix this issue.

BTW, that's the second time I'm sending it, I've had no answer sofar. If
this is not the recommanded way to declare problems and send correction
patches, just tell me.

tools/examples/network-bridge +1 -1
diff -Naur xen-3.0.3_0-src/tools/examples/network-bridge xen-3.0.3_0-src.fix_network_bridge/tools/examples/network-bridge
@@ -59,7 +59,7 @@
 findCommand "$@"
 evalVariables "$@"
 
-vifnum=${vifnum:-$(ip route list | awk '/^default / { print $NF }' | sed 's/^[^0-9]*//')}
++vifnum=${vifnum:-$(ip route list 0.0.0.0/0 | sed 's/.*dev[^0-9]\+\([0-9]\+\).*$/\1/')}
 vifnum=${vifnum:-0}
 bridge=${bridge:-xenbr${vifnum}}
 netdev=${netdev:-eth${vifnum}}

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 6 lines · Guillaume Rousse

As previously explained, the network-bridge script tries to automatically find the default network interface number with the following ligne:
vifnum=${vifnum:-$(ip route list | awk '/^default / { print $NF }' | sed 's/^[^0-9]*//')}

Quoted 8 lines

However, this fails on mandriva, because the parsed line is:
default via 193.55.250.126 dev eth0 metric 10

Attached patch fix this issue.

BTW, that's the second time I'm sending it, I've had no answer sofar. If
this is not the recommanded way to declare problems and send correction
patches, just tell me.

Sorry about missing it the first time. Your patch looks fine to me -- if you could just resend it with a Signed-off-by line, I'll put it in.

Ewan.

Quoted 17 lines

diff -Naur xen-3.0.3_0-src/tools/examples/network-bridge xen-3.0.3_0-src.fix_network_bridge/tools/examples/network-bridge

tools/examples/network-bridge +1 -1
@@ -59,7 +59,7 @@
 findCommand "$@"
 evalVariables "$@"
 
-vifnum=${vifnum:-$(ip route list | awk '/^default / { print $NF }' | sed 's/^[^0-9]*//')}
++vifnum=${vifnum:-$(ip route list 0.0.0.0/0 | sed 's/.*dev[^0-9]\+\([0-9]\+\).*$/\1/')}
 vifnum=${vifnum:-0}
 bridge=${bridge:-xenbr${vifnum}}
 netdev=${netdev:-eth${vifnum}}

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 11 lines · Ewan Mellor
Quoted 9 lines · Guillaume Rousse

As previously explained, the network-bridge script tries to automatically find the default network interface number with the following ligne:
vifnum=${vifnum:-$(ip route list | awk '/^default / { print $NF }' | sed 's/^[^0-9]*//')}

However, this fails on mandriva, because the parsed line is:
default via 193.55.250.126 dev eth0 metric 10

Quoted 8 lines
Quoted 5 lines

Attached patch fix this issue.

BTW, that's the second time I'm sending it, I've had no answer sofar. If
this is not the recommanded way to declare problems and send correction
patches, just tell me.

Sorry about missing it the first time. Your patch looks fine to me -- if you could just resend it with a Signed-off-by line, I'll put it in.

If I understand correctly, I just have to add this line, right ?

tools/examples/network-bridge +1 -1
diff -Naur xen-3.0.3_0-src/tools/examples/network-bridge xen-3.0.3_0-src.fix_network_bridge/tools/examples/network-bridge
@@ -59,7 +59,7 @@
 findCommand "$@"
 evalVariables "$@"
 
-vifnum=${vifnum:-$(ip route list | awk '/^default / { print $NF }' | sed 's/^[^0-9]*//')}
++vifnum=${vifnum:-$(ip route list 0.0.0.0/0 | sed 's/.*dev[^0-9]\+\([0-9]\+\).*$/\1/')}
 vifnum=${vifnum:-0}
 bridge=${bridge:-xenbr${vifnum}}
 netdev=${netdev:-eth${vifnum}}

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel