• Tom Parkin's avatar
    ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls · 4cf476ce
    Tom Parkin authored
    This new ioctl pair allows two ppp channels to be bridged together:
    frames arriving in one channel are transmitted in the other channel
    and vice versa.
    
    The practical use for this is primarily to support the L2TP Access
    Concentrator use-case.  The end-user session is presented as a ppp
    channel (typically PPPoE, although it could be e.g. PPPoA, or even PPP
    over a serial link) and is switched into a PPPoL2TP session for
    transmission to the LNS.  At the LNS the PPP session is terminated in
    the ISP's network.
    
    When a PPP channel is bridged to another it takes a reference on the
    other's struct ppp_file.  This reference is dropped when the channels
    are unbridged, which can occur either explicitly on userspace calling
    the PPPIOCUNBRIDGECHAN ioctl, or implicitly when either channel in the
    bridge is unregistered.
    
    In order to implement the channel bridge, struct channel is extended
    with a new field, 'bridge', which points to the other struct channel
    making up the bridge.
    
    This pointer is RCU protected to avoid adding another lock to the data
    path.
    
    To guard against concurrent writes to the pointer, the existing struct
    channel lock 'upl' coverage is extended rather than adding a new lock.
    
    The 'upl' lock is used to protect the existing unit pointer.  Since the
    bridge effectively replaces the unit (they're mutually exclusive for a
    channel) it makes coding easier to use the same lock to cover them
    both.
    Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    4cf476ce
ppp_generic.c 83.8 KB