Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I wait for a USB Ethernet adapter to appear to configure

1 view
Skip to first unread message

Masachika ISHIZUKA

unread,
May 17, 2018, 10:35:39 PM5/17/18
to
Hi.

I use a nootbook machine.
As this machine has no internal nic, I use a USB ethernet adapter(ue0).
I want to configure lagg0 of ue0 and iwm0, but I must wait to start
/etc/rc.d/netif until appearing the ue0.
I'm using patched netif as follows, but I must keep it whenever
'mergemaster -Ui' is run.
Is there a more elegant way?
--
Masachika ISHIZUKA
add-to-rc.conf
netif.diff

Eugene Grosbein

unread,
May 17, 2018, 11:12:43 PM5/17/18
to
Yes. In fact, you do not need to wait but "hook" on the event of ue0 creation.
We have several ways to do that and simpliest one for network interface is
using /etc/start_if.ue0 script like this:

#!/bin/sh

ifconfig ue0 up
ifconfig lagg0 addm ue0
# EOF


_______________________________________________
freebsd...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hacke...@freebsd.org"

Eugene Grosbein

unread,
May 17, 2018, 11:13:31 PM5/17/18
to
18.05.2018 10:08, Eugene Grosbein wrote:

>> I use a nootbook machine.
>> As this machine has no internal nic, I use a USB ethernet adapter(ue0).
>> I want to configure lagg0 of ue0 and iwm0, but I must wait to start
>> /etc/rc.d/netif until appearing the ue0.
>> I'm using patched netif as follows, but I must keep it whenever
>> 'mergemaster -Ui' is run.
>> Is there a more elegant way?
>
> Yes. In fact, you do not need to wait but "hook" on the event of ue0 creation.
> We have several ways to do that and simpliest one for network interface is
> using /etc/start_if.ue0 script like this:
>
> #!/bin/sh
>
> ifconfig ue0 up
> ifconfig lagg0 addm ue0

Sorry, this should be "ifconfig lagg0 laggport ue0"

Masachika ISHIZUKA

unread,
May 18, 2018, 2:50:46 AM5/18/18
to
>>> I use a nootbook machine.
>>> As this machine has no internal nic, I use a USB ethernet adapter(ue0).
>>> I want to configure lagg0 of ue0 and iwm0, but I must wait to start
>>> /etc/rc.d/netif until appearing the ue0.
>>> I'm using patched netif as follows, but I must keep it whenever
>>> 'mergemaster -Ui' is run.
>>> Is there a more elegant way?
>>
>> Yes. In fact, you do not need to wait but "hook" on the event of ue0 creation.
>> We have several ways to do that and simpliest one for network interface is
>> using /etc/start_if.ue0 script like this:
>>
>> #!/bin/sh
>>
>> ifconfig ue0 up
>> ifconfig lagg0 addm ue0
>
> Sorry, this should be "ifconfig lagg0 laggport ue0"

Thank you, Eugene.

I wrote /etc/start_if.ue0 on 12-current r333704 as follows

% cat /etc/start_if.ue0
#!/bin/sh

ifconfig ue0 ether xx:xx:xx:xx:xx:xx up # set iwm0's mac address
ifconfig lagg0 -laggport wlan0 laggport ue0 laggport wlan0
/etc/rc.d/wpa_supplicant start wlan0

Now, it works well.
Thank you very much.
--
Masachika ISHIZUKA

Freddie Cash

unread,
May 18, 2018, 1:23:18 PM5/18/18
to
On Thu, May 17, 2018 at 7:30 PM, Masachika ISHIZUKA <i...@amail.plala.or.jp>
wrote:

​Your situation is pretty much the entire reason for the existence of
​/etc/rc.d/netwait Read through the comments in that script for more
information. And the comments in /etc/defaults/rc.conf for netwait.

Something along these lines in /etc/rc.conf is what you want (along with
your normal ifconfig_* and wpa_* entries):

netwait_if="ue0 iwm0"

That will cause the boot process to pause and wait for those two interfaces
to appear before continuing on with the network configuration.

There are various other netwait_* configuration entries that can used as
well.

--
Freddie Cash
fjw...@gmail.com

Masachika ISHIZUKA

unread,
May 18, 2018, 8:09:20 PM5/18/18
to
>> As this machine has no internal nic, I use a USB ethernet adapter(ue0).
>> I want to configure lagg0 of ue0 and iwm0, but I must wait to start
>> /etc/rc.d/netif until appearing the ue0.
>> I'm using patched netif as follows, but I must keep it whenever
>> 'mergemaster -Ui' is run.
>> Is there a more elegant way?
>>
> ​Your situation is pretty much the entire reason for the existence of
> ​/etc/rc.d/netwait Read through the comments in that script for more
> information. And the comments in /etc/defaults/rc.conf for netwait.
>
> Something along these lines in /etc/rc.conf is what you want (along with
> your normal ifconfig_* and wpa_* entries):
>
> netwait_if="ue0 iwm0"
>
> That will cause the boot process to pause and wait for those two interfaces
> to appear before continuing on with the network configuration.
>
> There are various other netwait_* configuration entries that can used as
> well.

Thank you for reply, Freddie.

'lagg0' is created in 'netif', but 'netwait' is invoked after 'netif',
so 'netwait' is not suitable to this case. My patched 'netif' of first
mail is created referring to 'netwait'.
--
Masachika ISHIZUKA
0 new messages