From: Shirley Ma <mashirle@us.ibm.com>
To: "David S. Miller" <davem@redhat.com>
Cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, xma@us.ibm.com
Subject: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
Date: Wed, 14 Jan 2004 15:52:51 -0800 [thread overview]
Message-ID: <200401141552.51424.mashirle@us.ibm.com> (raw)
In-Reply-To: <20031205145700.120e9e68.davem@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 137 bytes --]
Once receiving a router advertisement message,
a netlink notification event will be created.
This patch is against linux-2.6.1.
[-- Attachment #2: linux-2.6.1-ipv6mib8.patch --]
[-- Type: text/x-diff, Size: 4412 bytes --]
diff -urN linux-2.6.1/include/linux/rtnetlink.h linux-2.6.1-ipv6mib8/include/linux/rtnetlink.h
--- linux-2.6.1/include/linux/rtnetlink.h 2004-01-08 22:59:55.000000000 -0800
+++ linux-2.6.1-ipv6mib8/include/linux/rtnetlink.h 2004-01-13 10:45:20.000000000 -0800
@@ -44,7 +44,10 @@
#define RTM_DELTFILTER (RTM_BASE+29)
#define RTM_GETTFILTER (RTM_BASE+30)
-#define RTM_MAX (RTM_BASE+31)
+#define RTM_NEWRA (RTM_BASE+32)
+#define RTM_GETRA (RTM_BASE+34)
+
+#define RTM_MAX (RTM_BASE+35)
/*
Generic structure for encapsulation of optional route information.
@@ -441,6 +444,38 @@
};
/*****************************************************************
+ * Route Advertisement specific messages.
+ * ******/
+
+/* struct iframsg
+ * passes router advertisement specific information
+ */
+
+struct iframsg
+{
+ unsigned char ifra_family;
+ unsigned ifra_flags;
+ int ifra_index;
+};
+
+enum
+{
+ IFRA_UNSPEC,
+ IFRA_LMTU,
+ IFRA_CACHEINFO
+};
+
+/* max_adver_interval, min_adver_interval should be gotten from user level */
+struct ifra_cacheinfo {
+ __u32 hop_limit;
+ __u32 lifetime;
+ __u32 reachable_time;
+ __u32 retrans_time;
+};
+
+#define IFRA_MAX IFRA_CACHEINFO
+
+/*****************************************************************
* Link layer specific messages.
****/
@@ -615,6 +650,8 @@
#define RTMGRP_DECnet_IFADDR 0x1000
#define RTMGRP_DECnet_ROUTE 0x4000
+#define RTMGRP_IPV6_IFRA 0x10000
+
/* End of information exported to user level */
#ifdef __KERNEL__
diff -urN linux-2.6.1/include/net/ndisc.h linux-2.6.1-ipv6mib8/include/net/ndisc.h
--- linux-2.6.1/include/net/ndisc.h 2004-01-08 22:59:55.000000000 -0800
+++ linux-2.6.1-ipv6mib8/include/net/ndisc.h 2004-01-13 10:45:20.000000000 -0800
@@ -98,6 +98,10 @@
extern void igmp6_cleanup(void);
+extern void inet6_ifra_notify(int event,
+ struct inet6_dev *idev,
+ struct ra_msg *ra_msg);
+
static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, struct in6_addr *addr)
{
diff -urN linux-2.6.1/net/ipv6/addrconf.c linux-2.6.1-ipv6mib8/net/ipv6/addrconf.c
--- linux-2.6.1/net/ipv6/addrconf.c 2004-01-08 23:00:03.000000000 -0800
+++ linux-2.6.1-ipv6mib8/net/ipv6/addrconf.c 2004-01-13 10:45:20.000000000 -0800
@@ -2802,6 +2802,62 @@
return skb->len;
}
+static int inet6_fill_ifra(struct sk_buff *skb, struct inet6_dev *idev,
+ struct ra_msg *ra_msg, u32 pid, u32 seq, int event)
+{
+ struct iframsg *ifra;
+ struct nlmsghdr *nlh;
+ unsigned char *b = skb->tail;
+ __u32 mtu = idev->dev->mtu;
+ struct ifra_cacheinfo ci;
+
+ nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*ifra));
+
+ if (pid)
+ nlh->nlmsg_flags |= NLM_F_MULTI;
+
+ ifra = NLMSG_DATA(nlh);
+ ifra->ifra_family = AF_INET6;
+ ifra->ifra_index = idev->dev->ifindex;
+ ifra->ifra_flags = idev->if_flags;
+
+ RTA_PUT(skb, IFRA_LMTU, sizeof(mtu), &mtu);
+
+ ci.hop_limit = ra_msg->icmph.icmp6_hop_limit;
+ ci.lifetime = ntohs(ra_msg->icmph.icmp6_rt_lifetime);
+ ci.reachable_time = ntohl(ra_msg->reachable_time);
+ ci.retrans_time = ntohl(ra_msg->retrans_timer);
+ RTA_PUT(skb, IFRA_CACHEINFO, sizeof(ci), &ci);
+
+ nlh->nlmsg_len = skb->tail - b;
+ return skb->len;
+
+nlmsg_failure:
+rtattr_failure:
+ skb_trim(skb, b - skb->data);
+ return -1;
+}
+
+void inet6_ifra_notify(int event, struct inet6_dev *idev,
+ struct ra_msg *ra_msg)
+{
+ struct sk_buff *skb;
+ int size = NLMSG_SPACE(sizeof(struct iframsg)+128);
+
+ skb = alloc_skb(size, GFP_ATOMIC);
+ if (!skb) {
+ netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFRA, ENOBUFS);
+ return;
+ }
+ if (inet6_fill_ifra(skb, idev, ra_msg, 0, 0, event) < 0) {
+ kfree_skb(skb);
+ netlink_set_err(rtnl, 0, RTMGRP_IPV6_IFRA, EINVAL);
+ return;
+ }
+ NETLINK_CB(skb).dst_groups = RTMGRP_IPV6_IFRA;
+ netlink_broadcast(rtnl, skb, 0, RTMGRP_IPV6_IFRA, GFP_ATOMIC);
+}
+
static struct rtnetlink_link inet6_rtnetlink_table[RTM_MAX - RTM_BASE + 1] = {
[RTM_GETLINK - RTM_BASE] = { .dumpit = inet6_dump_ifinfo, },
[RTM_NEWADDR - RTM_BASE] = { .doit = inet6_rtm_newaddr, },
diff -urN linux-2.6.1/net/ipv6/ndisc.c linux-2.6.1-ipv6mib8/net/ipv6/ndisc.c
--- linux-2.6.1/net/ipv6/ndisc.c 2004-01-08 22:59:44.000000000 -0800
+++ linux-2.6.1-ipv6mib8/net/ipv6/ndisc.c 2004-01-13 10:45:20.000000000 -0800
@@ -1190,6 +1190,7 @@
out:
if (rt)
dst_release(&rt->u.dst);
+ inet6_ifra_notify(RTM_NEWRA, in6_dev, ra_msg);
in6_dev_put(in6_dev);
}
next prev parent reply other threads:[~2004-01-14 23:52 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-20 0:21 IPv6 MIB:ipv6PrefixTable implementation Shirley Ma
2003-12-02 12:40 ` kuznet
2003-12-05 20:14 ` [PATCH]snmp6 64-bit counter support in proc.c Shirley Ma
2003-12-05 20:31 ` David S. Miller
2004-01-14 22:52 ` Shirley Ma
2004-01-15 8:57 ` David S. Miller
2003-12-05 21:51 ` [PATCH] IPv6 MIB:ipv6Prefix netlink notification Shirley Ma
2003-12-05 22:57 ` David S. Miller
2004-01-14 22:54 ` Shirley Ma
2004-01-15 8:58 ` David S. Miller
2004-01-14 23:52 ` Shirley Ma [this message]
2004-01-15 8:52 ` [PATCH] IPv6 MIB:ipv6RouterAdvert " David S. Miller
2004-01-15 9:10 ` YOSHIFUJI Hideaki / 吉藤英明
2004-01-15 0:21 ` [PATCH] IPv6 MIB:ipv6inetNetToMediaTable Shirley Ma
2004-01-15 8:48 ` David S. Miller
2004-01-15 9:04 ` YOSHIFUJI Hideaki / 吉藤英明
2004-01-15 0:22 ` [PATCH] IPv6 MIB:ipv6DefaultRouterTable Shirley Ma
2004-01-15 9:03 ` YOSHIFUJI Hideaki / 吉藤英明
-- strict thread matches above, loose matches on Subject: below --
2004-01-15 22:31 [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification Shirley Ma
2004-01-15 23:04 ` Shirley Ma
2004-01-15 23:04 ` David S. Miller
2004-01-16 1:37 ` YOSHIFUJI Hideaki / 吉藤英明
2004-01-16 18:38 Shirley Ma
2004-01-16 19:17 ` YOSHIFUJI Hideaki / 吉藤英明
2004-01-16 19:41 Shirley Ma
2004-01-16 20:08 ` David S. Miller
2004-01-16 20:23 ` YOSHIFUJI Hideaki / 吉藤英明
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=200401141552.51424.mashirle@us.ibm.com \
--to=mashirle@us.ibm.com \
--cc=davem@redhat.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@oss.sgi.com \
--cc=xma@us.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).