Fix getting default gateway (#16)
This fix a nasty bug that only occurs when you have a mac address that is composed of all zeroes (at least 2) before having a non numeric character (A-F)
This commit is contained in:
parent
182e92c55e
commit
c164d4bb41
1 changed files with 2 additions and 2 deletions
4
vps2arch
4
vps2arch
|
@ -190,10 +190,10 @@ configure_network() {
|
|||
local gateway dev ip
|
||||
|
||||
read -r dev gateway <<-EOF
|
||||
$(awk '$2 == 00000000 { ip = strtonum(sprintf("0x%s", $3));
|
||||
$(awk '$2 == "00000000" { ip = strtonum(sprintf("0x%s", $3));
|
||||
printf ("%s\t%d.%d.%d.%d", $1,
|
||||
rshift(and(ip,0x000000ff),00), rshift(and(ip,0x0000ff00),08),
|
||||
rshift(and(ip,0x00ff0000),16), rshift(and(ip,0xff000000),24)) }' < /proc/net/route)
|
||||
rshift(and(ip,0x00ff0000),16), rshift(and(ip,0xff000000),24)) ; exit }' < /proc/net/route)
|
||||
EOF
|
||||
|
||||
set -- $(ip addr show dev "$dev" | awk '($1 == "inet") { print $2 }')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue