kern/63317: make ng_ether(4) support "lower" and "orphans"simultaneously

Gleb Smirnoff glebius at cell.sick.ru
Wed Apr 28 02:20:17 PDT 2004


The following reply was made to PR kern/63317; it has been noted by GNATS.

From: Gleb Smirnoff <glebius at cell.sick.ru>
To: Archie Cobbs <archie at dellroad.org>
Cc: Maxim Konovalov <maxim at macomnet.ru>,
	bzeeb-lists at lists.zabbadoz.net, FreeBSD-gnats-submit at FreeBSD.ORG
Subject: Re: kern/63317: make ng_ether(4) support "lower" and "orphans"simultaneously
Date: Wed, 28 Apr 2004 13:13:41 +0400

 On Mon, Apr 26, 2004 at 04:49:48PM -0500, Archie Cobbs wrote:
 A> To preserve the existing behavior, the node would need to duplicate
 A> the orphanable packets and send them to BOTH connected hooks.
 
 I have spent some time drawing relationship between if_ethersubr.c and
 ng_ether.c. Now, I have pointed out, that new node will preserve
 an old behavior in case of 'lower' or 'orphans' connected one at a
 time.
 
 In case of both 'lower' and 'orphans' hooks connected, the node
 will write ALL packets to 'lower', and no packets to 'orphans'.
 This may seem useless. However, packets received on 'upper' will
 travel to upper protocol stack, and those unrecognized will return
 on 'orphans'.
 
 This is useful when someone needs to sniff IP traffic into netgraph
 and use some "orphan" etherproto on the same interface. For example
 I use it for serving PPPoE, and counting raw IP traffic on the same
 interface. In this case a ng_tee node is put on top of ng_ether,
 connecting its 'lower' and 'upper' together.
 
 And you get IP traffic on tee's hooks, and orphaned packet on 'orphans'.
 
 Here is some ASCII art:
 
      ether stack    .     ng_ether                     .   netgraph
                     .                                  .
                     .                                  .
    ether_input()    . ,-- ng_ether_rcvdata() <------------ 'upper' -<--,
             |\      ./                                 .                \ ng_tee
             | \     /                                  .                /
             |  '---/----> ng_ether_input() --------------> 'lower' -->-`
             |     / .                                  .
             |    /  .                                  .
             |   /   .                                  .
             v  v    .                                  .
       ether_demux()-----> ng_ether_input_orphan() -------> 'orphans'
             |       .                                  .
             v
           upper
           stacks
 
 -- 
 Totus tuus, Glebius.
 GLEBIUS-RIPN GLEB-RIPE


More information about the freebsd-bugs mailing list