Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"
HP & Linux

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Glossary
MoreInfo
Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
FAQ
Copyright Info
Terms of Use
Privacy Info
Disclaimer
WorkBoard
Thanks
Donations
Advertising
Masthead / Impressum
Your Account

Communication
Feedback
Forums
Private Messages
Surveys

Features
HOWTOs
News Archive
Submit News
Topics
User Articles
Web Links

Google
Google


The Web
linux-tutorial.info

Who's Online
There are currently, 299 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

  

netlink




SYNOPSIS

       #include <asm/types.h>
       #include <sys/socket.h>
       #include <linux/netlink.h>

       netlink_socket = socket(PF_NETLINK, socket_type, netlink_family);


DESCRIPTION

       Netlink is used to  transfer  information  between  kernel
       modules  and user space processes.  It consists of a stan­
       dard sockets based interface for  user  processes  and  an
       internal  kernel API for kernel modules. The internal ker­
       nel interface is not documented in  this  man  page.  Also
       there is an obsolete netlink interface via netlink charac­
       ter devices, this interface is not documented here and  is
       only provided for backwards compatibility.

       Netlink is a datagram oriented service.  Both SOCK_RAW and
       SOCK_DGRAM are valid values for socket_type;  however  the
       netlink protocol does not distinguish between datagram and
       raw sockets.

       netlink_family selects the kernel module or netlink  group
       to communicate with.  The currently assigned netlink fami­
       lies are:

       NETLINK_ROUTE
              Receives routing updates and may be used to  modify
              the IPv4 routing table (see rtnetlink(7)).

       NETLINK_FIREWALL
              Receives packets sent by the IPv4 firewall code.

       NETLINK_ARPD
              For managing the arp table in user space.

       NETLINK_ROUTE6
              Receives and sends IPv6 routing table updates.

       NETLINK_IP6_FW
              to  receive  packets  that failed the IPv6 firewall
              checks (currently not implemented).

       NETLINK_TAPBASE...NETLINK_TAPBASE+15
              are the instances of the ethertap device.  Ethertap
              is  a  pseudo  network tunnel device that allows an
              ethernet driver to be simulated from user space.

       NETLINK_SKIP
              Reserved for ENskip.

       acknowledgement from the receiver by setting the NLM_F_ACK
       flag.  An acknowledgment is an NLMSG_ERROR packet with the
       error field set to 0.  The application must generate  acks
       for received messages itself.  The kernel tries to send an
       NLMSG_ERROR message for every failed packet.  A user  pro­
       cess should follow this convention too.

       Each  netlink  family  has  a  set of 32 multicast groups.
       When bind(2) is called on the socket, the nl_groups  field
       in  the  sockaddr_nl  should  be  set  to a bitmask of the
       groups which it wishes to listen to.   The  default  value
       for this field is zero which means that no multicasts will
       be received.  A socket may multicast messages  to  any  of
       the  multicast groups by setting nl_groups to a bitmask of
       the groups it wishes to send to when it  calls  sendmsg(2)
       or does a connect(2).  Only users with an effective uid of
       0 or the CAP_NET_ADMIN capability may send or listen to  a
       netlink   multicast  group.   Any  replies  to  a  message
       received for a multicast group should be sent back to  the
       sending pid and the multicast group.

              struct nlmsghdr
              {
                  __u32    nlmsg_len;  /* Length of message including header */
                  __u16    nlmsg_type; /* Message content */
                  __u16    nlmsg_flags;/* Additional flags */
                  __u32    nlmsg_seq;  /* Sequence number */
                  __u32    nlmsg_pid;  /* PID of the process that opened the socket */
              };

              struct nlmsgerr
              {
                  int      error;      /* negative errno or 0 for acks. */
                  struct nlmsghdr msg; /* message header that caused the error */
              };

       After  each  nlmsghdr the payload follows.  nlmsg_type can
       be one of the standard message types:  NLMSG_NOOP  message
       is to be ignored, NLMSG_ERROR the message signals an error
       and the payload contains a nlmsgerr structure,  NLMSG_DONE
       message terminates a multipart message,

       A netlink family usually specifies more message types, see
       the appropriate man pages for that, e.g.  rtnetlink(7) for
       NETLINK_ROUTE.

       Standard Flag bits in nlmsg_flags
       NLM_F_REQUEST   set on all request messages
       NLM_F_MULTI     the message is part of a multipart mes­
                       sage terminated by NLMSG_DONE
       NLM_F_ACK       reply with an acknowledgment on success

       Note that NLM_F_ATOMIC  requires  CAP_NET_ADMIN  or  super
       user rights.


ADDRESS FORMATS

       The  sockaddr_nl  structure  describes a netlink client in
       user space or in the kernel.  A sockaddr_nl can be  either
       unicast  (only send to one peer) or send to netlink groups
       (nl_groups not equal 0).

              struct sockaddr_nl
              {
                  sa_family_t nl_family;    /* AF_NETLINK */
                  unsigned short nl_pad;    /* zero */
                  pid_t       nl_pid;       /* process pid */
                  __u32       nl_groups;    /* multicast groups mask */
              };

       nl_pid is the pid of the process  owning  the  destination
       socket,  or  0  if  the  destination  is  in  the  kernel.
       nl_groups is a  bitmask  with  every  bit  representing  a
       netlink group number.


BUGS

       This man page is not complete.


NOTES

       It  is often better to use netlink via libnetlink than via
       the low level kernel interface.


VERSIONS

       The socket interface to netlink is a new feature of  Linux
       2.2

       Linux  2.0 supported a more primitive device based netlink
       interface (which is still  available  as  a  compatibility
       option). This obsolete interface is not described here.


SEE ALSO

       cmsg(3), rtnetlink(7), netlink(3)

       ftp://ftp.inr.ac.ru/ip-routing/iproute2* for libnetlink

Linux Man Page              1999-04-27                 NETLINK(7)
  
Help us cut cost by not downloading the whole site!
Use of automated download sofware ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and therefore is expressedly prohibited. For more details on this, take a look here

Login
Nickname

Password

Security Code
Security Code
Type Security Code


Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!


Amazon Wish List

Did You Know?
You can help in many different ways.


Friends



Tell a Friend About Us

Bookmark and Share



Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.08 Seconds