Discussion:
stop ifnet ioctl (ab)use in the kernel, step 1
(too old to reply)
David Young
2011-03-11 03:20:31 UTC
Permalink
The network protocols and some drivers use ioctls to manipulate
ifnet flags, to add/delete multicast addresses, and to initialize
ifaddrs. I'd like to stop that before I tackle some problems with
ioctl synchronization. The first step is to replace calls to
ifp->if_ioctl(SIOCINITIFADDR|SIOCSIFFLAGS|SIOCADDMULTI|SIOSDELMULTI)
with calls to some new routines, if_flags_set(), if_mcast_op(), and
if_addr_init(). The new routines either call driver-provided routines
or fall back to if_ioctl. See the attached patch.

This patch isn't ready to commit, but please let me know if you have
any objections to the general approach before I continue.

Notice that I have provisionally deleted SIOCSIFDSTADDR cases from a lot
of drivers, because we can ordinarily rely on SIOCINITIFADDR to do the
same checks that SIOCSIFDSTADDR will do.

Dave
--
David Young OJC Technologies
***@ojctech.com Urbana, IL * (217) 344-0444 x24
der Mouse
2011-03-11 17:13:48 UTC
Permalink
The network protocols and some drivers use ioctls to manipulate ifnet
flags, to add/delete multicast addresses, and to initialize ifaddrs.
I'd like to stop that before I tackle some [other stuff].
Why?

What is the perceived need being addressed here? Do you just find
if()_ioctl ugly compared to adding more function pointers to struct
ifnet? Is the if_ioctl() way actually causing some trouble somewhere?
Something else?

/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML ***@rodents-montreal.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
David Young
2011-03-11 17:32:33 UTC
Permalink
Post by der Mouse
The network protocols and some drivers use ioctls to manipulate ifnet
flags, to add/delete multicast addresses, and to initialize ifaddrs.
I'd like to stop that before I tackle some [other stuff].
Why?
What is the perceived need being addressed here? Do you just find
if()_ioctl ugly compared to adding more function pointers to struct
ifnet? Is the if_ioctl() way actually causing some trouble somewhere?
Something else?
Good questions.

The if_ioctl() way leads to recursion that makes synchronizing ioctls a
worse PITA than it needs to be.

The if_ioctl() way requires lines of code that marshal arguments into an
ifreq (say) and then cast them to (void *). It's more error-prone and a
lot less type-safe than it could be.

Dave
--
David Young OJC Technologies
***@ojctech.com Urbana, IL * (217) 344-0444 x24

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...