OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man7 / netlink.7
index caf398d..a7c30fc 100644 (file)
@@ -1,12 +1,16 @@
 '\" t
-.\" Don't change the first line, it tells man that tbl is needed.
-.\" This man page is Copyright (c) 1998 by Andi Kleen. Subject to the GPL.
+.\" This man page is Copyright (c) 1998 by Andi Kleen.
+.\"
+.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
+.\" Subject to the GPL.
+.\" %%%LICENSE_END
+.\"
 .\" Based on the original comments from Alexey Kuznetsov
 .\" Modified 2005-12-27 by Hasso Tepper <hasso@estpak.ee>
 .\" $Id: netlink.7,v 1.8 2000/06/22 13:23:00 ak Exp $
-.TH NETLINK  7 2012-04-14 "Linux" "Linux Programmer's Manual"
+.TH NETLINK  7 2015-01-10 "Linux" "Linux Programmer's Manual"
 .SH NAME
-netlink \- Communication between kernel and userspace (AF_NETLINK)
+netlink \- communication between kernel and user space (AF_NETLINK)
 .SH SYNOPSIS
 .nf
 .B #include <asm/types.h>
@@ -17,13 +21,13 @@ netlink \- Communication between kernel and userspace (AF_NETLINK)
 .fi
 .SH DESCRIPTION
 Netlink is used to transfer information between kernel and
-userspace processes.
-It consists of a standard sockets-based interface for userspace
+user-space processes.
+It consists of a standard sockets-based interface for user space
 processes and an internal kernel API for kernel modules.
 The internal kernel interface is not documented in this manual page.
 There is also an obsolete netlink interface
 via netlink character devices; this interface is not documented here
-and is only provided for backward compatibility.
+and is provided only for backward compatibility.
 
 Netlink is a datagram-oriented service.
 Both
@@ -53,7 +57,7 @@ Messages from 1-wire subsystem.
 Reserved for user-mode socket protocols.
 .TP
 .B NETLINK_FIREWALL
-Transport IPv4 packets from netfilter to userspace.
+Transport IPv4 packets from netfilter to user space.
 Used by
 .I ip_queue
 kernel module.
@@ -82,20 +86,20 @@ Auditing.
 .TP
 .B NETLINK_FIB_LOOKUP
 .\" FIXME More details on NETLINK_FIB_LOOKUP needed.
-Access to FIB lookup from userspace.
+Access to FIB lookup from user space.
 .TP
 .B NETLINK_CONNECTOR
 Kernel connector.
 See
 .I Documentation/connector/*
-in the kernel source for further information.
+in the Linux kernel source tree for further information.
 .TP
 .B NETLINK_NETFILTER
 .\" FIXME More details on NETLINK_NETFILTER needed.
 Netfilter subsystem.
 .TP
 .B NETLINK_IP6_FW
-Transport IPv6 packets from netfilter to userspace.
+Transport IPv6 packets from netfilter to user space.
 Used by
 .I ip6_queue
 kernel module.
@@ -105,15 +109,22 @@ DECnet routing messages.
 .TP
 .B NETLINK_KOBJECT_UEVENT
 .\" FIXME More details on NETLINK_KOBJECT_UEVENT needed.
-Kernel messages to userspace.
+Kernel messages to user space.
 .TP
 .B NETLINK_GENERIC
 Generic netlink family for simplified netlink usage.
+.TP
+.BR NETLINK_CRYPTO " (since Linux 3.2)"
+.\" commit a38f7907b926e4c6c7d389ad96cc38cec2e5a9e9
+.\" Author: Steffen Klassert <steffen.klassert@secunet.com>
+Netlink interface to request information about ciphers registered
+with the kernel crypto API as well as allow configuration of the
+kernel crypto API.
 .PP
 Netlink messages consist of a byte stream with one or multiple
 .I nlmsghdr
 headers and associated payload.
-The byte stream should only be accessed with the standard
+The byte stream should be accessed only with the standard
 .B NLMSG_*
 macros.
 See
@@ -139,7 +150,7 @@ struct nlmsghdr {
     __u16 nlmsg_type;   /* Type of message content. */
     __u16 nlmsg_flags;  /* Additional flags. */
     __u32 nlmsg_seq;    /* Sequence number. */
-    __u32 nlmsg_pid;    /* PID of the sending process. */
+    __u32 nlmsg_pid;    /* Sender port ID. */
 };
 .fi
 .in
@@ -169,14 +180,12 @@ appropriate manual pages for that, for example,
 .BR rtnetlink (7)
 for
 .BR NETLINK_ROUTE .
-
-Standard flag bits in
-.I nlmsg_flags
-.br
----------------------------------
 .TS
 tab(:);
+l s
 lB l.
+Standard flag bits in \fInlmsg_flags\fP
+_
 NLM_F_REQUEST:Must be set on all request messages.
 NLM_F_MULTI:T{
 The message is part of a multipart message terminated by
@@ -185,41 +194,45 @@ T}
 NLM_F_ACK:Request for an acknowledgment on success.
 NLM_F_ECHO:Echo this request.
 .TE
-
-Additional flag bits for GET requests
-.br
--------------------------------------
+.sp 1
+.\" No right adjustment for text blocks in tables
 .TS
 tab(:);
+l s
 lB l.
+Additional flag bits for GET requests
+_
 NLM_F_ROOT:Return the complete table instead of a single entry.
 NLM_F_MATCH:T{
 Return all entries matching criteria passed in message content.
 Not implemented yet.
 T}
-.\" FIXME NLM_F_ATOMIC is not used any more?
+.\" FIXME NLM_F_ATOMIC is not used anymore?
 NLM_F_ATOMIC:Return an atomic snapshot of the table.
-NLM_F_DUMP:Convenience macro; equivalent to (NLM_F_ROOT|NLM_F_MATCH).
+NLM_F_DUMP:T{
+Convenience macro; equivalent to
+.br
+(NLM_F_ROOT|NLM_F_MATCH).
+T}
 .TE
-
+.sp 1
 Note that
 .B NLM_F_ATOMIC
 requires the
 .B CAP_NET_ADMIN
 capability or an effective UID of 0.
-
-Additional flag bits for NEW requests
-.br
--------------------------------------
 .TS
 tab(:);
+l s
 lB l.
+Additional flag bits for NEW requests
+_
 NLM_F_REPLACE:Replace existing matching object.
 NLM_F_EXCL:Don't replace if the object already exists.
 NLM_F_CREATE:Create object if it doesn't already exist.
 NLM_F_APPEND:Add to the end of the object list.
 .TE
-
+.sp 1
 .I nlmsg_seq
 and
 .I nlmsg_pid
@@ -262,14 +275,14 @@ A user process should follow this convention too.
 However, reliable transmissions from kernel to user are impossible
 in any case.
 The kernel can't send a netlink message if the socket buffer is full:
-the message will be dropped and the kernel and the userspace process will
+the message will be dropped and the kernel and the user-space process will
 no longer have the same view of kernel state.
 It is up to the application to detect when this happens (via the
 .B ENOBUFS
 error returned by
 .BR recvmsg (2))
 and resynchronize.
-.SS Address Formats
+.SS Address formats
 The
 .I sockaddr_nl
 structure describes a netlink client in user space or in the kernel.
@@ -285,7 +298,7 @@ not equal 0).
 struct sockaddr_nl {
     sa_family_t     nl_family;  /* AF_NETLINK */
     unsigned short  nl_pad;     /* Zero. */
-    pid_t           nl_pid;     /* Process ID. */
+    pid_t           nl_pid;     /* Port ID. */
     __u32           nl_groups;  /* Multicast groups mask. */
 };
 .fi
@@ -294,7 +307,7 @@ struct sockaddr_nl {
 .I nl_pid
 is the unicast address of netlink socket.
 It's always 0 if the destination is in the kernel.
-For a userspace process,
+For a user-space process,
 .I nl_pid
 is usually the PID of the process owning the destination socket.
 However,
@@ -303,7 +316,7 @@ identifies a netlink socket, not a process.
 If a process owns several netlink
 sockets, then
 .I nl_pid
-can only be equal to the process ID for at most one socket.
+can be equal to the process ID only for at most one socket.
 There are two ways to assign
 .I nl_pid
 to a netlink socket.
@@ -341,6 +354,9 @@ or does a
 Only processes with an effective UID of 0 or the
 .B CAP_NET_ADMIN
 capability may send or listen to a netlink multicast group.
+Since Linux 2.6.13,
+.\" commit d629b836d151d43332492651dd841d32e57ebe3b
+messages can't be broadcast to multiple groups.
 Any replies to a message received for a multicast group should be
 sent back to the sending PID and the multicast group.
 Some Linux kernel subsystems may additionally allow other users
@@ -404,17 +420,17 @@ bind(fd, (struct sockaddr *) &sa, sizeof(sa));
 
 The next example demonstrates how to send a netlink message to the
 kernel (pid 0).
-Note that application must take care of message sequence numbers
+Note that the application must take care of message sequence numbers
 in order to reliably track acknowledgements.
 
 .in +4n
 .nf
 struct nlmsghdr *nh;    /* The nlmsghdr with payload to send. */
 struct sockaddr_nl sa;
-struct iovec iov = { (void *) nh, nh\->nlmsg_len };
+struct iovec iov = { nh, nh\->nlmsg_len };
 struct msghdr msg;
 
-msg = { (void *)&sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
+msg = { &sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
 memset(&sa, 0, sizeof(sa));
 sa.nl_family = AF_NETLINK;
 nh\->nlmsg_pid = 0;
@@ -437,7 +453,7 @@ struct sockaddr_nl sa;
 struct msghdr msg;
 struct nlmsghdr *nh;
 
-msg = { (void *)&sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
+msg = { &sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
 len = recvmsg(fd, &msg, 0);
 
 for (nh = (struct nlmsghdr *) buf; NLMSG_OK (nh, len);
@@ -455,16 +471,27 @@ for (nh = (struct nlmsghdr *) buf; NLMSG_OK (nh, len);
 }
 .fi
 .in
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR cmsg (3),
 .BR netlink (3),
 .BR capabilities (7),
 .BR rtnetlink (7)
-.PP
-ftp://ftp.inr.ac.ru/ip-routing/iproute2*
-for information about libnetlink.
 
-http://people.suug.ch/~tgr/libnl/
-for information about libnl.
+.UR ftp://ftp.inr.ac.ru\:/ip-routing\:/iproute2*
+information about libnetlink
+.UE
+
+.UR http://people.suug.ch\:/~tgr\:/libnl/
+information about libnl
+.UE
 
 RFC 3549 "Linux Netlink as an IP Services Protocol"
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.