Subject: Re: bin/33923: slattach(8) can't attach sl(4) interface
To: None <christos@zoulas.com>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: tech-net
Date: 07/09/2006 12:27:18
christos@zoulas.com wrote:

> | According to sys/net/if_sl.c:slopen() and sys/kern/tty.c:ttioctl()
> | (which just calls slopen() vir struct linesw), slopen() just
> | looks up all sl interfaces (by list or array) and uses the first
> | available one.
> | 
> | There is no way to pass/return an unit number via struct linesw without
> | API changes?
> 
> Yes, and it should allocate one if one is not available, the same way ppp
> does.

Hmm, I agree it's better to allocate one if no interface is available,
as done by sys/net/ppp_tty.c:pppopen().

> There is a way to attach to a specific unit (again look at the ppp code).

sys/net/if_ppp.c:ppp_create() can take a unit number arg, but pppalloc()
(which is called from pppopen()) always specifies -1 (i.e. any unit)
so I don't think we can specify a interface unit number in that case.
If it's okay, automatic creation code should be trivial, as you said.
---
Izumi Tsutsui