[openbeosnetteam] about net_server and food for thought

Hi all,

 I've been recently looking at net_server's current architecture and
i have a few suggestions regarding what i see as improvements that
could be done. I would like to gather your comments on my suggestions
so the way to go reflects what the whole developers regard as the best
way.

 1. Instead of instantiating interfaces based on settings, have
net_server watch /dev/net/ for device interfaces and use the available
settings to create the network interface or proceed with the default
(configurable) setting of auto-configuration. As the loopback
interface has no device interface it would have to be configured
statically as it is right now.

 2. Move to an add-on based infrastructure for auto-configuration
(and possibly more, depends on the interface). The available
auto-configuration methods would be registered per domain (IPv4, IPv6,
etc) and would also report some sort of default order (we want
stateful configuration to kick in before stateless configuration).
Each method would have a well-known signature so that it could be
configured (or disabled) per interface ("ipv4/dhcp", "ipv4/zeroconf",
"ipv6/stateless", "ipv6/dhcp", etc).

 As a side point, we also need some way to track the adding and
removal of network interfaces (not device interfaces), the adding and
removal of addresses (some more dynamic network applications depend on
this), etc. Net_server itself requires this capability to a point as
any user may manually remove a network interface.

 We could add yet another interface to the system to track these
events (Linux did Netlink, BSD did AF_ROUTE, etc) but considering that
we have native node monitoring and attributes i was thinking if we
could re-use these to provide the required events. More specifically,
and i'm sure some will consider this blasphemous, but the network
stack could have a filesystem that gets mounted to /net (net_server
could mount it) where several information is published and available
for monitoring. It could look something like this:

 /net/
  /net/socket
  /net/interfaces/
   /net/interfaces/0/
     /net/interfaces/0/name
     /net/interfaces/0/address
     /net/interfaces/0/pcap
   /net/interfaces/1/
     ...

 /net/socket could replace the current /dev/net/stack, while the rest
is somewhat self-explanatory. The pcap file could be used to do packet
captures vs. using SIOCSPACKETCAP. We could (or should) have a dummy
Haiku header for captured packets with the addresses, timestamp, etc.
The network stack would add/remove directories from /net/interfaces
(the directory name is the ifindex) and provide the required events
through node watching.

 There are a couple of short-comings though which i would like to get
comments on. The biggest problem right now is that while Netlink or
AF_ROUTE include the modifications themselves in the event messages
(the address that was removed, the interface index, etc) we have no
way to do that.

 One possibility would be to augment node watching to handle a new
flag requesting the name of the attributes that were changed to be
included in the message. We could then instead of having '0/name' have
'name' as an attribute of 0.

 This is a very initial idea, so please let me read your comments.
   Hugo

Other related posts: