[JNPR] Network stack as a module (RFC)

Steve Kiernan stevek at juniper.net
Fri Nov 15 22:22:44 UTC 2013

This is a follow up to the request sent back in January titled "Proposal for changes to network device drivers and network stack".

In order to make it easier to review, we will be submitting pieces to be contributed in logical blocks.

Please review the following patch and provide feedback:

The details of this patch are as follows (and what is suggested for the commit log):

Add a NETSTACK option to facilitate separating network stack pieces from the
rest of the OS core. This is the first step towards having the network stack
as a module.

In order to be able to build without the NETSTACK option enabled, the following
changes are also required and included with this commit:

* Add 'optional netstack' to source files that should be considered part of the
  network stack, including drivers
* Dynamically register the setfib syscall
  - this eliminates the need of an #Ifdef NETSTACK in kern/syscalls.master and
    will be necessary when the network stack is a module
* Add #ifdef NETSTACK for the following sections of kernel:
  In linprocfs - the proc/net nodes
  In the Linuxulator - linux_ioctl_socket and callers
  In SVR4 compat layer - STREAMS support, socket ioctls, and networking related
      system calls (getmsg, putmsg, recv, send, sendto)
  In kern/sys_socket.c - interface/routing/protocol specific ioctls are no
      longer called in the default case when NETSTACK is not defined, return
      ENXIO in that case
  In kern/uipc_socket.c - SO_SETFIB socket option
  In kern/vfs_init.c - vfs_checkexp should not be set to vfs_stdcheckexp when
      NETSTACK is not defined
  In kern/vfs_mount.c - all export-related code
  In usb device driver - USB_HAVE_PF needs to be defined to 0 in the case of
      no NETSTACK option

Please note that these NETSTACK checks above will end up being removed as
pieces of the network stack as a module functionality are added.

To verify building without the NETSTACK option, the LINT-NONETSTACK kernel
has been added to makeLINT.mk

Stephen J. Kiernan
Juniper Networks, Inc.

More information about the freebsd-net mailing list