Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
rtnetlink(3)
Edit
PageHistory
Diff
Info
LikePages
RTNETLINK !!!RTNETLINK NAME SYNOPSIS DESCRIPTION EXAMPLE BUGS SEE ALSO ---- !!NAME rtnetlink - Macros to manipuate rtnetlink messages !!SYNOPSIS __#include __ #include __ #include __ #include __ __rtnetlink_socket = socket(PF_NETLINK, int__ ''socket_type''__, NETLINK_ROUTE); int RTA_OK(struct rtattr *rta, int rtabuflen); void *RTA_DATA(struct rtattr *rta); unsigned int RTA_PAYLOAD(struct rtattr *rta); struct rtattr *RTA_NEXT(struct rtattr *rta, unsigned int rtabuflen); unsigned int RTA_LENGTH(unsigned int length); unsigned int RTA_SPACE(unsigned int length);__ !!DESCRIPTION All rtnetlink(7) messages consist of a netlink(7) message header and appended attributes. The attributes should be only manipulated using the macros provided here. __RTA_OK(__''rta''__,__ ''attrlen''__)__ returns true if ''rta'' points to a valid routing attribute; ''attrlen'' is the running length of the attribute buffer. When not true then you must assume there are no more attributes in the message, even if ''attrlen'' is non-zero.__ RTA_DATA(__''rta''__)__ returns a pointer to the start of this attribute's data.__ RTA_PAYLOAD(__''rta''__)__ returns the length of this attribute's data.__ RTA_NEXT(__''rta''__,__ ''attrlen''__)__ gets the next attribute after ''rta''. Calling this macro will update ''attrlen''. You should use __RTA_OK__ to check for the validity of the returned pointer.__ RTA_LENGTH(__''len''__)__ returns the length which is required for ''len'' bytes of data plus the header.__ RTA_SPACE(__''len''__)__ returns the amount of space which will be needed in the message with ''len'' bytes of data. !!EXAMPLE Creating a rtnetlink message to set a MTU of a device. struct { struct nlmsghdr nh; struct ifinfomsg if; char attrbuf[[512]; } req; struct rtattr *rta; unsigned int mtu = 1000; int rtnetlink_sk = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); memset( !!BUGS This manual page is lacking and incomplete. !!SEE ALSO rtnetlink(7), netlink(7), netlink(3) ----
3 pages link to
rtnetlink(3)
:
LinuxNetlinkSockets
Man3r
rtnetlink(7)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.