Subject: Re: bin/33923: slattach(8) can't attach sl(4) interface
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Christos Zoulas <christos@zoulas.com>
List: tech-net
Date: 07/08/2006 23:53:55
On Jul 9, 12:27pm, tsutsui@ceres.dti.ne.jp (Izumi Tsutsui) wrote:
-- Subject: Re: bin/33923: slattach(8) can't attach sl(4) interface

| 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.

Yes, it is ok. There is also the xferunit trick where you can take possession
of ppp unit from another process, but this is not needed. I think that
the list traversal/allocation code can be shared, and then we can call
the post-initialization code.

christos