(usagi-users 03578) [Fwd: [PATCH] Fix RTNLGRP definitions in rtnetlink.h] (fwd)

Miika Komu <[email protected]>
Newsgroups gmane.linux.ipv6.usagi.users
Message-ID <[email protected]>
-------- Original Message --------
Subject: [PATCH] Fix RTNLGRP definitions in rtnetlink.h
Date: Mon, 19 Dec 2005 13:20:08 +0200
From: Kristian Slavov <[email protected]>
To: Kernel Netdev Mailing List <[email protected]>

Hi,

I reported a problem and gave hints to the solution, but nobody seemed to
react. So I prepared a patch against 2.6.14.4.

Tested on 2.6.14.4 with "ip monitor addr" and with the program attached,
while adding and removing IPv6 address. Both programs didn't receive any
messages.
Tested 2.6.14.4 + this patch, and both programs received add and remove
messages.

Signed-off-by: Kristian Slavov <[email protected]>

Cheers,
-- 
Krisu


-- 
Krisu
rtnetlink.patch (text/plain, 880 B)
diff -Naur linux-2.6.14.4/include/linux/rtnetlink.h linux-2.6.14.4-patched/include/linux/rtnetlink.h
--- linux-2.6.14.4/include/linux/rtnetlink.h	2005-12-15 01:50:41.000000000 +0200
+++ linux-2.6.14.4-patched/include/linux/rtnetlink.h	2005-12-19 12:30:04.000000000 +0200
@@ -866,6 +866,7 @@
 #define	RTNLGRP_IPV4_MROUTE	RTNLGRP_IPV4_MROUTE
 	RTNLGRP_IPV4_ROUTE,
 #define RTNLGRP_IPV4_ROUTE	RTNLGRP_IPV4_ROUTE
+	RTNLGRP_NOP1,
 	RTNLGRP_IPV6_IFADDR,
 #define RTNLGRP_IPV6_IFADDR	RTNLGRP_IPV6_IFADDR
 	RTNLGRP_IPV6_MROUTE,
@@ -876,8 +877,11 @@
 #define RTNLGRP_IPV6_IFINFO	RTNLGRP_IPV6_IFINFO
 	RTNLGRP_DECnet_IFADDR,
 #define RTNLGRP_DECnet_IFADDR	RTNLGRP_DECnet_IFADDR
+	RTNLGRP_NOP2,
 	RTNLGRP_DECnet_ROUTE,
 #define RTNLGRP_DECnet_ROUTE	RTNLGRP_DECnet_ROUTE
+	RTNLGRP_NOP3,
+	RTNLGRP_NOP4,
 	RTNLGRP_IPV6_PREFIX,
 #define RTNLGRP_IPV6_PREFIX	RTNLGRP_IPV6_PREFIX
 	__RTNLGRP_MAX
PoC.c (text/x-csrc, 882 B)
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <linux/rtnetlink.h>
#include <errno.h>
#include <string.h>

#define MLEN 1024

int main()
{
	struct sockaddr_nl nlserver;
        size_t z;
        char *buffer;
	int rtsock, k;

	buffer = malloc(MLEN);
        if (!buffer)
                return 0;

	memset(buffer, 0, MLEN);
	memset(&nlserver, 0, sizeof(nlserver));

	nlserver.nl_family = AF_NETLINK;
	nlserver.nl_groups = RTMGRP_IPV6_IFADDR;

	rtsock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
        if (rtsock < 0)
                return 0;

	k = bind(rtsock, (struct sockaddr *)&nlserver, sizeof(nlserver));
	if (k < 0)
                return 0;

        z = sizeof(nlserver);
	k = recvfrom(rtsock, buffer, MLEN, 0, 
		     (struct sockaddr *)&nlserver, &z);
	printf("recvfrom() = %d, errno = %d\n",k,errno);
		
	close(rtsock);
        return 1;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.