mirror of https://github.com/mkerrisk/man-pages
rtnetlink.3: Fix example code, rta_len assignment should use RTA_LENGTH()
See also http://bugs.debian.org/655088 Reported-by: Sergei Zhirikov <sfzhi@yahoo.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
be02e49f7c
commit
79fdc31353
|
@ -4,7 +4,7 @@
|
|||
.\" and in case of nontrivial modification author and date
|
||||
.\" of the modification is added to the header.
|
||||
.\" $Id: rtnetlink.3,v 1.2 1999/05/18 10:35:10 freitag Exp $
|
||||
.TH RTNETLINK 3 2010-01-11 "GNU" "Linux Programmer's Manual"
|
||||
.TH RTNETLINK 3 2012-03-24 "GNU" "Linux Programmer's Manual"
|
||||
.SH NAME
|
||||
rtnetlink \- macros to manipulate rtnetlink messages
|
||||
.SH SYNOPSIS
|
||||
|
@ -109,7 +109,7 @@ Creating a rtnetlink message to set the MTU of a device:
|
|||
rta = (struct rtattr *)(((char *) &req) +
|
||||
NLMSG_ALIGN(req.nh.nlmsg_len));
|
||||
rta\->rta_type = IFLA_MTU;
|
||||
rta\->rta_len = sizeof(unsigned int);
|
||||
rta\->rta_len = RTA_LENGTH(sizeof(unsigned int));
|
||||
req.n.nlmsg_len = NLMSG_ALIGN(req.nh.nlmsg_len) +
|
||||
RTA_LENGTH(sizeof(mtu));
|
||||
memcpy(RTA_DATA(rta), &mtu, sizeof(mtu));
|
||||
|
|
Loading…
Reference in New Issue