mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Németh Tamás" <nt1277@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Netlink and raw packet inconsistencies or obsolete man pages?
Date: Wed, 28 Mar 2012 11:17:14 +0200	[thread overview]
Message-ID: <1605053.5clz4a2OYL@netadmin.sopron.nyme.hu> (raw)

man 7 netlink states that:

"Only processes with an effective UID of 0 or the CAP_NET_ADMIN capability may 
send or listen to a netlink multicast group."

In addition man 7 capabilities states that:

"CAP_NET_RAW
	Use RAW and PACKET sockets."

Despite these statements I was able to run the followinng code without getting 
any access denied type error messages:

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

int filedes;
struct sockaddr_nl nladdr={AF_NETLINK,0,0,0};

int main(int argc, char *argv[], char *envp[])
{
        nladdr.nl_pid=getpid();
        filedes=socket(AF_NETLINK, SOCK_RAW, NETLINK_KOBJECT_UEVENT);
        bind(filedes,(struct sockaddr*)&nladdr,sizeof(nladdr));
        close(filedes);
}
################################

 Sorry for not testing if I can actually send or receive raw multicast netlink 
packages, this is because I'm not a programmer actually. The code above could 
be run without any problem on openSUSE 12.1's tandard kernel and on a vanilla 
2.6.32.49. Is it a bug or is it intentional (and then man pages are outdated)? 
In the latter case what does protect the udev subsystem. for example?

Regards,

Tamas Nemeth
IT sysadmin
University of West Hungary

                 reply	other threads:[~2012-03-28  9:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1605053.5clz4a2OYL@netadmin.sopron.nyme.hu \
    --to=nt1277@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®