• Chuck Lever's avatar
    SUNRPC: Register both netids for AF_INET6 servers · 2c7eb0b2
    Chuck Lever authored
    TI-RPC is a user-space library of RPC functions that replaces ONC RPC
    and allows RPC to operate in the new world of IPv6.
    
    TI-RPC combines the concept of a transport protocol (UDP and TCP)
    and a protocol family (PF_INET and PF_INET6) into a single identifier
    called a "netid."  For example, "udp" means UDP over IPv4, and "udp6"
    means UDP over IPv6.
    
    For rpcbind, then, the RPC service tuple that is registered and
    advertised is:
    
      [RPC program, RPC version, service address and port, netid]
    
    instead of
    
      [RPC program, RPC version, port, protocol]
    
    Service address is typically ANYADDR, but can be a specific address
    of one of the interfaces on a multi-homed host.  The third item in
    the new tuple is expressed as a universal address.
    
    The current Linux rpcbind implementation registers a netid for both
    protocol families when RPCB_SET is done for just the PF_INET6 version
    of the netid (ie udp6 or tcp6).  So registering "udp6" causes a
    registration for "udp" to appear automatically as well.
    
    We've recently determined that this is incorrect behavior.  In the
    TI-RPC world, "udp6" is not meant to imply that the registered RPC
    service handles requests from AF_INET as well, even if the listener
    socket does address mapping.  "udp" and "udp6" are entirely separate
    capabilities, and must be registered separately.
    
    The Linux kernel, unlike TI-RPC, leverages address mapping to allow a
    single listener socket to handle requests for both AF_INET and AF_INET6.
    This is still OK, but the kernel currently assumes registering "udp6"
    will cover "udp" as well.  It registers only "udp6" for it's AF_INET6
    services, even though they handle both AF_INET and AF_INET6 on the same
    port.
    
    So svc_register() actually needs to register both "udp" and "udp6"
    explicitly (and likewise for TCP).  Until rpcbind is fixed, the
    kernel can ignore the return code for the second RPCB_SET call.
    
    Please merge this with commit 15231312:
    
        SUNRPC: Support IPv6 when registering kernel RPC services
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    Cc: Olaf Kirch <okir@suse.de>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
    2c7eb0b2
svc.c 28.5 KB