Stuart Henderson <s...@spacehopper.org> writes:

> On 2015-12-24, Timo Myyrä <timo.my...@wickedbsd.net> wrote:
>
>> Hi,
>>
>> I'm trying to use ifstated to switch between my laptops wireless and wired
>> interface.
>> Currently it works when I don't have cable plugged in but once I plug in
the
>> cable the ifstated starts to switch between wired and wireless states and
won't
>> stay in wired state.
>>
>> So it seems the em0.link.down condition gets triggered in wired state but
why?
>> The dhclient seems to run so the em0 should have IP and so it should be
up.
>
> Kill ifstated and watch 'route -n monitor' when you plug in. Does state
> change more than once e.g. does it go up/down/up during negotiation
> with the switch? If so, you may need a sleep before re-checking link state.
>
> As it stands, I don't think this ifstated.conf is doing anything that
> you can't do just by running a dhclient on each interface all the time,
> dhclient already tracks link state itself, multiple priority routes
> work fine, and you aren't doing anything to alleviate the problem
> I mentioned in the other thread that does exist with that setup.

I'll look into the route stuff to see if I find the culprit.

I was operating under assumption that continual scanning of wireless networks
would drain more power. I'm using the bob beck's wireless scripts which
periodicly tries to associate with AP. When running both interfaces with
dhclient the wireless interface would try to scan and associate with AP even
if
I had ethernet cable attached.
Though I've already made the first mistake by going with assumption and not
actually measuring the power use the wireless would have.

I could probably tweak the wifinwid script a bit to skip AP scanning when em0
has carrier present.

But I'm testing the dhclient setup but it doesn't seem to work correctly. Once
I connect
ethernet cable I lose connectivity. Seems dhclient notices the em0 is up and
polls address for the interface and sets the routes:

$ ifconfig
...
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr 3c:97:0e:60:8d:ca
        priority: 0
        groups: egress
        media: Ethernet autoselect (100baseTX full-duplex)
        status: active
        inet 192.168.0.105 netmask 0xffffff00 broadcast 192.168.0.255
iwn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr 60:67:20:f8:17:f4
        priority: 4
        groups: wlan
        media: IEEE802.11 autoselect (HT-MCS7 mode 11n)
        status: active
        ieee80211: nwid TW-EAV510v4A4A3 chan 11 bssid 00:1e:ab:0a:a4:a4 -28dBm
wpakey <not displayed> wpaprotos wpa1,wpa2 wpaakms psk wpaciphers tkip,ccmp
wpagroupcipher tkip
        inet 192.168.0.106 netmask 0xffffff00 broadcast 192.168.0.255
...

$ route -n show
Routing tables

Internet:
Destination        Gateway            Flags   Refs      Use   Mtu  Prio Iface
default            192.168.0.254      UGS        0        1     -     8 em0
default            192.168.0.254      UGS        2        7     -    12 iwn0
127.0.0.1          127.0.0.1          UHl        0        0 32768     1 lo0
192.168.0/24       192.168.0.106      UCP        1        2     -     4 iwn0
192.168.0/24       192.168.0.105      UCP        0        0     -     4 em0
192.168.0.105      3c:97:0e:60:8d:ca  UHLl       0        2     -     1 em0
192.168.0.106      60:67:20:f8:17:f4  UHLl       0       40     -     1 iwn0
192.168.0.254      link#2             UHLc       0        2     -     4 iwn0
192.168.0.255      192.168.0.106      UHPb       0        0     -     1 iwn0
192.168.0.255      192.168.0.105      UHPb       0        0     -     1 em0

Timo

Reply via email to