diff options
Diffstat (limited to 'man7/netlink.7')
-rw-r--r-- | man7/netlink.7 | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/man7/netlink.7 b/man7/netlink.7 index 90c0100f6..4d6cdbc2c 100644 --- a/man7/netlink.7 +++ b/man7/netlink.7 @@ -6,7 +6,7 @@ .\" 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 2023-02-05 "Linux man-pages 6.03" +.TH netlink 7 2023-07-30 "Linux man-pages 6.05.01" .SH NAME netlink \- communication between kernel and user space (AF_NETLINK) .SH SYNOPSIS @@ -218,8 +218,6 @@ appropriate manual pages for that, for example, .BR rtnetlink (7) for .BR NETLINK_ROUTE . -.nh -.ad l .TS tab(:); l s @@ -240,11 +238,7 @@ NLM_F_ECHO:T{ Echo this request. T} .TE -.ad -.hy .\" No right adjustment for text blocks in tables -.nh -.ad l .TS tab(:); l s @@ -266,8 +260,6 @@ Convenience macro; equivalent to (NLM_F_ROOT|NLM_F_MATCH). T} .TE -.ad -.hy .\" FIXME NLM_F_ATOMIC is not used anymore? .PP Note that @@ -275,8 +267,6 @@ Note that requires the .B CAP_NET_ADMIN capability or an effective UID of 0. -.nh -.ad l .TS tab(:); l s @@ -296,8 +286,6 @@ NLM_F_APPEND:T{ Add to the end of the object list. T} .TE -.ad -.hy .PP .I nlmsg_seq and @@ -538,11 +526,11 @@ netlink socket which will listen to the .in +4n .EX struct sockaddr_nl sa; - +\& memset(&sa, 0, sizeof(sa)); sa.nl_family = AF_NETLINK; sa.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR; - +\& fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); bind(fd, (struct sockaddr *) &sa, sizeof(sa)); .EE @@ -559,7 +547,7 @@ struct nlmsghdr *nh; /* The nlmsghdr with payload to send */ struct sockaddr_nl sa; struct iovec iov = { nh, nh\->nlmsg_len }; struct msghdr msg; - +\& msg = { &sa, sizeof(sa), &iov, 1, NULL, 0, 0 }; memset(&sa, 0, sizeof(sa)); sa.nl_family = AF_NETLINK; @@ -567,7 +555,7 @@ nh\->nlmsg_pid = 0; nh\->nlmsg_seq = ++sequence_number; /* Request an ack from kernel by setting NLM_F_ACK */ nh\->nlmsg_flags |= NLM_F_ACK; - +\& sendmsg(fd, &msg, 0); .EE .in @@ -584,20 +572,20 @@ struct iovec iov = { buf, sizeof(buf) }; struct sockaddr_nl sa; struct msghdr msg; struct nlmsghdr *nh; - +\& msg = { &sa, sizeof(sa), &iov, 1, NULL, 0, 0 }; len = recvmsg(fd, &msg, 0); - +\& for (nh = (struct nlmsghdr *) buf; NLMSG_OK (nh, len); nh = NLMSG_NEXT (nh, len)) { /* The end of multipart message */ if (nh\->nlmsg_type == NLMSG_DONE) return; - +\& if (nh\->nlmsg_type == NLMSG_ERROR) /* Do some error handling */ ... - +\& /* Continue with parsing payload */ ... } |