Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
rpcb_clnt.c File Reference
#include <linux/module.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/un.h>
#include <linux/in.h>
#include <linux/in6.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/nsproxy.h>
#include <net/ipv6.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/sched.h>
#include <linux/sunrpc/xprtsock.h>
#include "netns.h"

Go to the source code of this file.

Data Structures

struct  rpcbind_args
 
struct  rpcb_info
 

Macros

#define RPCBIND_SOCK_PATHNAME   "/var/run/rpcbind.sock"
 
#define RPCBIND_PROGRAM   (100000u)
 
#define RPCBIND_PORT   (111u)
 
#define RPCBVERS_2   (2u)
 
#define RPCBVERS_3   (3u)
 
#define RPCBVERS_4   (4u)
 
#define RPCB_OWNER_STRING   "0"
 
#define RPCB_MAXOWNERLEN   sizeof(RPCB_OWNER_STRING)
 
#define RPCB_program_sz   (1)
 
#define RPCB_version_sz   (1)
 
#define RPCB_protocol_sz   (1)
 
#define RPCB_port_sz   (1)
 
#define RPCB_boolean_sz   (1)
 
#define RPCB_netid_sz   (1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN))
 
#define RPCB_addr_sz   (1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN))
 
#define RPCB_ownerstring_sz   (1 + XDR_QUADLEN(RPCB_MAXOWNERLEN))
 
#define RPCB_mappingargs_sz
 
#define RPCB_getaddrargs_sz
 
#define RPCB_getportres_sz   RPCB_port_sz
 
#define RPCB_setres_sz   RPCB_boolean_sz
 
#define RPCB_getaddrres_sz   RPCB_addr_sz
 

Enumerations

enum  {
  RPCBPROC_NULL, RPCBPROC_SET, RPCBPROC_UNSET, RPCBPROC_GETPORT,
  RPCBPROC_GETADDR = 3, RPCBPROC_DUMP, RPCBPROC_CALLIT, RPCBPROC_BCAST = 5,
  RPCBPROC_GETTIME, RPCBPROC_UADDR2TADDR, RPCBPROC_TADDR2UADDR, RPCBPROC_GETVERSADDR,
  RPCBPROC_INDIRECT, RPCBPROC_GETADDRLIST, RPCBPROC_GETSTAT
}
 

Functions

void rpcb_put_local (struct net *net)
 
int rpcb_create_local (struct net *net)
 
int rpcb_register (struct net *net, u32 prog, u32 vers, int prot, unsigned short port)
 
int rpcb_v4_register (struct net *net, const u32 program, const u32 version, const struct sockaddr *address, const char *netid)
 
void rpcb_getport_async (struct rpc_task *task)
 
 EXPORT_SYMBOL_GPL (rpcb_getport_async)
 

Macro Definition Documentation

#define RPCB_addr_sz   (1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN))

Definition at line 92 of file rpcb_clnt.c.

#define RPCB_boolean_sz   (1)

Definition at line 89 of file rpcb_clnt.c.

#define RPCB_getaddrargs_sz
Value:
RPCB_netid_sz + RPCB_addr_sz + \
RPCB_ownerstring_sz)

Definition at line 100 of file rpcb_clnt.c.

#define RPCB_getaddrres_sz   RPCB_addr_sz

Definition at line 111 of file rpcb_clnt.c.

#define RPCB_getportres_sz   RPCB_port_sz

Definition at line 104 of file rpcb_clnt.c.

#define RPCB_mappingargs_sz
Value:
RPCB_protocol_sz + RPCB_port_sz)

Definition at line 98 of file rpcb_clnt.c.

#define RPCB_MAXOWNERLEN   sizeof(RPCB_OWNER_STRING)

Definition at line 80 of file rpcb_clnt.c.

#define RPCB_netid_sz   (1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN))

Definition at line 91 of file rpcb_clnt.c.

#define RPCB_OWNER_STRING   "0"

Definition at line 79 of file rpcb_clnt.c.

#define RPCB_ownerstring_sz   (1 + XDR_QUADLEN(RPCB_MAXOWNERLEN))

Definition at line 93 of file rpcb_clnt.c.

#define RPCB_port_sz   (1)

Definition at line 88 of file rpcb_clnt.c.

#define RPCB_program_sz   (1)

Definition at line 85 of file rpcb_clnt.c.

#define RPCB_protocol_sz   (1)

Definition at line 87 of file rpcb_clnt.c.

#define RPCB_setres_sz   RPCB_boolean_sz

Definition at line 105 of file rpcb_clnt.c.

#define RPCB_version_sz   (1)

Definition at line 86 of file rpcb_clnt.c.

#define RPCBIND_PORT   (111u)

Definition at line 42 of file rpcb_clnt.c.

#define RPCBIND_PROGRAM   (100000u)

Definition at line 41 of file rpcb_clnt.c.

#define RPCBIND_SOCK_PATHNAME   "/var/run/rpcbind.sock"

Definition at line 39 of file rpcb_clnt.c.

#define RPCBVERS_2   (2u)

Definition at line 44 of file rpcb_clnt.c.

#define RPCBVERS_3   (3u)

Definition at line 45 of file rpcb_clnt.c.

#define RPCBVERS_4   (4u)

Definition at line 46 of file rpcb_clnt.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
RPCBPROC_NULL 
RPCBPROC_SET 
RPCBPROC_UNSET 
RPCBPROC_GETPORT 
RPCBPROC_GETADDR 
RPCBPROC_DUMP 
RPCBPROC_CALLIT 
RPCBPROC_BCAST 
RPCBPROC_GETTIME 
RPCBPROC_UADDR2TADDR 
RPCBPROC_TADDR2UADDR 
RPCBPROC_GETVERSADDR 
RPCBPROC_INDIRECT 
RPCBPROC_GETADDRLIST 
RPCBPROC_GETSTAT 

Definition at line 48 of file rpcb_clnt.c.

Function Documentation

EXPORT_SYMBOL_GPL ( rpcb_getport_async  )
int rpcb_create_local ( struct net net)

Definition at line 328 of file rpcb_clnt.c.

void rpcb_getport_async ( struct rpc_task task)

rpcb_getport_async - obtain the port for a given RPC service on a given host : task that is waiting for portmapper request

This one can be called for an ongoing RPC request, and can be used in an async (rpciod) context.

Definition at line 647 of file rpcb_clnt.c.

void rpcb_put_local ( struct net net)

Definition at line 178 of file rpcb_clnt.c.

int rpcb_register ( struct net net,
u32  prog,
u32  vers,
int  prot,
unsigned short  port 
)

rpcb_register - set or unset a port registration with the local rpcbind svc : target network namespace : RPC program number to bind : RPC version number to bind : transport protocol to register : port value to register

Returns zero if the registration request was dispatched successfully and the rpcbind daemon returned success. Otherwise, returns an errno value that reflects the nature of the error (request could not be dispatched, timed out, or rpcbind returned an error).

RPC services invoke this function to advertise their contact information via the system's rpcbind daemon. RPC services invoke this function once for each [program, version, transport] tuple they wish to advertise.

Callers may also unregister RPC services that are no longer available by setting the passed-in port to zero. This removes all registered transports for [program, version] from the local rpcbind database.

This function uses rpcbind protocol version 2 to contact the local rpcbind daemon.

Registration works over both AF_INET and AF_INET6, and services registered via this function are advertised as available for any address. If the local rpcbind daemon is listening on AF_INET6, services registered via this function will be advertised on IN6ADDR_ANY (ie available for all AF_INET and AF_INET6 addresses).

Definition at line 430 of file rpcb_clnt.c.

int rpcb_v4_register ( struct net net,
const u32  program,
const u32  version,
const struct sockaddr address,
const char netid 
)

rpcb_v4_register - set or unset a port registration with the local rpcbind : target network namespace : RPC program number of service to (un)register

Version
: RPC version number of service to (un)register : address family, IP address, and port to (un)register : netid of transport protocol to (un)register

Returns zero if the registration request was dispatched successfully and the rpcbind daemon returned success. Otherwise, returns an errno value that reflects the nature of the error (request could not be dispatched, timed out, or rpcbind returned an error).

RPC services invoke this function to advertise their contact information via the system's rpcbind daemon. RPC services invoke this function once for each [program, version, address, netid] tuple they wish to advertise.

Callers may also unregister RPC services that are registered at a specific address by setting the port number in to zero. They may unregister all registered protocol families at once for a service by passing a NULL argument. If is "" then all netids for [program, version, address] are unregistered.

This function uses rpcbind protocol version 4 to contact the local rpcbind daemon. The local rpcbind daemon must support version 4 of the rpcbind protocol in order for these functions to register a service successfully.

Supported netids include "udp" and "tcp" for UDP and TCP over IPv4, and "udp6" and "tcp6" for UDP and TCP over IPv6, respectively.

The contents of determine the address family and the port to be registered. The usual practice is to pass INADDR_ANY as the raw address, but specifying a non-zero address is also supported by this API if the caller wishes to advertise an RPC service on a specific network interface.

Note that passing in INADDR_ANY does not create the same service registration as IN6ADDR_ANY. The former advertises an RPC service on any IPv4 address, but not on IPv6. The latter advertises the service on all IPv4 and IPv6 addresses.

Definition at line 569 of file rpcb_clnt.c.