Skip to contentSkip to conversation

rtnetlink.3: fix example code, use RTA_LENGTH macro

PATCH In review Simon Paillard 2 participants 2 messages Mar 23, 2012 – Mar 24, 2012 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtnetlink.3: fix example code, use RTA_LENGTH macro

Quoted 1 line

From Kirill Brilliantov, http://bugs.debian.org/655088

---
 man3/rtnetlink.3 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
man3/rtnetlink.3 +1 -1
index 29d7765..ada93e2 100644
@@ -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));
Signature · 6 lines
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to a message not in the archive

Thanks for forwarding this Simon. Applied for man-pages-3.38.

Cheers,

Michael

Quoted 25 lines · Simon Paillard

From Kirill Brilliantov, http://bugs.debian.org/655088
---
 man3/rtnetlink.3 |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
man3/rtnetlink.3 +0 -0
index 29d7765..ada93e2 100644
@@ -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));
--
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html