Am I stupid or there's a bug with routing?
This is what I've found when I was trying to switch from the internal
wireless card in my laptop to an external usb wireless adapter...
The system is:
# dmesg | head -n 2
OpenBSD 5.0-current (GENERIC.MP) #2: Fri Sep 30 13:33:44 CEST 2011
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
And ral0 is the mini-pci wireless card in my laptop:
ral0 at pci2 dev 0 function 0 "Ralink RT2890" rev 0x00: apic 2 int 17, address
00:0d:f0:7d:ba:64
ral0: MAC/BBP RT2860 (rev 0x0102), RF RT2820 (MIMO 2T3R)
# ifconfig ral0 nwid homewlan wpa wpakey <not displayed> up
# dhclient ral0
DHCPREQUEST on ral0 to 255.255.255.255 port 67
DHCPACK from 192.168.2.1 (00:22:6b:e2:e1:61)
bound to 192.168.2.102 -- renewal in 43200 seconds.
# ping -c 5 www.undeadly.org
PING www.undeadly.org (193.109.122.60): 56 data bytes
64 bytes from 193.109.122.60: icmp_seq=0 ttl=244 time=89.307 ms
64 bytes from 193.109.122.60: icmp_seq=1 ttl=244 time=88.787 ms
64 bytes from 193.109.122.60: icmp_seq=2 ttl=244 time=88.743 ms
64 bytes from 193.109.122.60: icmp_seq=3 ttl=244 time=89.016 ms
64 bytes from 193.109.122.60: icmp_seq=4 ttl=244 time=88.311 ms
--- www.undeadly.org ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 88.311/88.832/89.307/0.500 ms
# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33152
priority: 0
groups: lo
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet 127.0.0.1 netmask 0xff000000
bge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
lladdr 00:1c:23:36:a8:89
priority: 0
media: Ethernet autoselect (none)
status: no carrier
enc0: flags=0<>
priority: 0
groups: enc
status: active
ral0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
lladdr 00:0d:f0:7d:ba:64
priority: 4
groups: wlan egress
media: IEEE802.11 autoselect (OFDM54 mode 11g)
status: active
ieee80211: nwid homewlan chan 11 bssid 00:22:6b:e2:e1:62 78dB wpakey
<not displayed> wpaprotos wpa2 wpaakms psk wpaciphers ccmp wpagroupcipher ccmp
inet6 fe80::20d:f0ff:fe7d:ba64%ral0 prefixlen 64 scopeid 0x5
inet 192.168.2.102 netmask 0xffffff00 broadcast 192.168.2.255
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33152
priority: 0
groups: pflog
# netstat -nrf inet
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Prio Iface
default 192.168.2.1 UGS 0 12 - 12 ral0
127/8 127.0.0.1 UGRS 0 0 33152 8 lo0
127.0.0.1 127.0.0.1 UH 2 34 33152 4 lo0
192.168.2/24 link#5 UC 1 0 - 4 ral0
192.168.2.1 00:22:6b:e2:e1:61 UHLc 1 10 - 4 ral0
192.168.2.102 127.0.0.1 UGHS 0 0 33152 8 lo0
224/4 link#5 UCS 0 0 - 12 ral0
Ok?
Now I bring the interface down:
# ifconfig ral0 down
# ifconfig ral0 -bssid -chan media autoselect nwid "" -nwkey -wpa -wpakey
# route -n flush
default 192.168.2.1 done
127/0 127.0.0.1 done
192.168.2.1 00:22:6b:e2:e1:61 done
192.168.2.102 127.0.0.1 done
::/128 ::1 done
::/128 ::1 done
::127.0.0.0/128 ::1 done
::224.0.0.0/128 ::1 done
::255.0.0.0/128 ::1 done
::ffff:0.0.0.0/128 ::1 done
2002::/128 ::1 done
2002:7f00::/128 ::1 done
2002:e000::/128 ::1 done
2002:ff00::/128 ::1 done
fe80::/128 ::1 done
fe80::1%lo0 link#3 done
fe80::20d:f0ff:fe7d: 00:0d:f0:7d:ba:64 done
fec0::/128 ::1 done
ff01::/128 ::1 done
ff02::/128 ::1 done
# route -n delete -net 192.168.2/24
delete net 192.168.2/24
# netstat -nrf inet
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Prio Iface
127.0.0.1 127.0.0.1 UH 0 34 33152 4 lo0
...And now I plug a new usb wireless adapter in:
rum0 at uhub1 port 1 "Cisco-Linksys Compact Wireless-G USB Adapter" rev
2.00/0.01 addr 2
rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, address 00:18:39:1a:19:a9
Same as before:
# ifconfig rum0 nwid homewlan wpa wpakey <not displayed> up
# dhclient rum0
DHCPREQUEST on rum0 to 255.255.255.255 port 67
DHCPACK from 192.168.2.1 (00:22:6b:e2:e1:61)
bound to 192.168.2.103 -- renewal in 43200 seconds.
# ping -c 5 www.undeadly.org
ping: unknown host: www.undeadly.org
Uhm... WTF?
# netstat -nrf inet
Routing tables
Internet:
Destination Gateway Flags Refs Use Mtu Prio Iface
default 192.168.2.1 GS 1 11 - 12 ral0
127.0.0.1 127.0.0.1 UH 1 34 33152 4 lo0
192.168.2.103 127.0.0.1 UGHS 0 0 33152 8 lo0
Isn't this strange?
cheers,
David