Create an in-kernel API for packet classes

(My open source project – Create an in-kernel API for packet classes – NetBSD) – Anish Babu Muppalaneni

Mentor: Herb Peyerl, NetBSD


  • To create an in-kernel API for “Packet Classes” and for labeling packets with their classes for special treatment by traffic shapers and Network Interface drivers.
  • This API acts as a interface between software implementation of traffic categorizers like PF, IPFilter etc. and both the software and hardware implementation of traffic shapers like ALTQ,ath,rtw,Ethernet etc. In an ideal case, this API makes both traffic categorizer and traffic shaper fully interchangeable.
  • Make PF use the packet-classes API to convert PF tag names—see pf.conf(5) for more about tags—to packet-class tokens, and to label mbufs with the tokens as they exit PF.
  • Make ALTQ extract the packet-class tokens from mbufs and use them to select the packet-scheduling class.


  • A packet categorizer is a software program that categorizes or tags a packet being received or transmitted by kernel. For example, PF uses pf.conf(5) file for reading in rules and adds tags to packets based on those rulesets.ALTQ is a software traffic shaper which is integrated with PF. It allows PF to implement class based Queuing (CBQ) because it can read PF tags.
  • But device driver queues have no idea of what each packet is because they don’t understand PF tags.
  • Now, Packet class API plays. This API provides an interface to device drivers which register the classes that this driver can handle.
  • During the registration part of the driver, a token is generated and this token is used by the traffic categorizer to add to m_bufs.
  • As driver can understand this token now, it uses this tagged m_buf() in scheduling of the packet.

Current Status (June/22/2008)

1) Pseudo Device Driver:

Pseudo-device drivers are parts of the kernel that act like device drivers but do not correspond to any actual hardware in the machine. In order, for the userprogram to interact with kernel, I am writing a pseudo driver, which the user program reads the different packet classes or a driver writes its different classes to that device.

By default, NetBSD comes with various pseudo device drivers. I am citing some of Network related pseudo devices here, where as many others exist for disks, terminals etc..

pseudo-device looploop is the generic loopback device for TCP/IP. If you telnet or FTP to localhost (a.k.a. it will come back at you through this pseudo-device.

pseudo-device etherether is only needed if you have an Ethernet card and includes generic Ethernet protocol code.

pseudo-device ppp numberppp is for kernel-mode PPP (Point-to-Point Protocol) support for dial-up Internet connections. There is also version of PPP implemented as a user application that uses the tun and offers more flexibility and features such as demand dialing.

pseudo-device bpfilter number( Berkeley packet filter) . This pseudo-device allows network interfaces to be placed in promiscuous mode, capturing every packet on a broadcast network (e.g. an ethernet). These packets can be captured to disk and/or examined with the tcpdump(1) program. The number after bpfilter is the number of interfaces that can be examined simultaneously.

Anish Babu


8 Responses to “NetBSD”

  1. Just landed on this place via Google seek. I love it. This situation change my perception and I am obtaining the RSS feeds. Cheers.

  2. outstanding post! great advice, will take on board!

  3. I truly appreciate this post. I have been looking all over for this! Thank goodness I found it on Bing. You have made my day! Thanks again – London Escorts – Elite Connections, Babmaes House, 2 Babmaes St, London, SW1Y 6HD, 020 3011 2943

  4. Thanks for sharing your info. I really appreciate
    your efforts and I am waiting for your further post thank you once again.

  5. Although Tenneco Offshore has operated profitably each year,
    its net liquidation 11 letters income has been to sell
    naked puts and calls with strike prices below and above
    the current share price. Lower prices mean more sales resulting in more profits, which can again
    go back into buying more discounted goods from dollar store merchandise
    suppliers is key to achieve this.

  6. But choosing a most proficient roofing contractor is not easy as you can find many experienced or inexpeeienced Florida roofing
    contractors. It just makes sense to take the time to explore your options annd to bee sure that
    you’re woprking wwith someone who will follow through the process.
    Mosst roofing cotractors suggest planning to
    park in the street until thee project is completed,
    so that there’s no risk of damage to the materials or youhr vehicles.

  7. It’s very easy to find out any matter on web as compared to books, as I found this article at tis web site.

  8. 8 Best Kitchen Knife Sharpening Stone

    Examine the frame to see if there are any noticeable cracks, and look foor huge portions
    with rust. It can be as simple as pre-cooking and bringing a lasagna, complete with garlic bread,
    salad and wine. Aaron Anderson is passionate about writing on ceramic chef’s knife,
    ceramic chef, Kyoceera chef knife and Kyocera Kyotop Damascus knife articles.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: