* Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
@ 2004-01-15 22:31 Shirley Ma
2004-01-15 23:04 ` Shirley Ma
2004-01-16 1:37 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 2 replies; 12+ messages in thread
From: Shirley Ma @ 2004-01-15 22:31 UTC (permalink / raw)
To: David S. Miller; +Cc: mashirle, kuznet, netdev
[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]
This patch is going to be used by SNMP for ipv6RouterAdvert Table. I will
remove this Micro, and resubmit the patch.
Thanks
Shirley Ma
IBM Linux Technology Center
15300 SW Koll Parkway
Beaverton, OR 97006-6063
Phone: (503) 578-7638
FAX: (503) 578-3228
"David S. Miller" <davem@redhat.com> on 01/15/2004 12:52:52 AM
To: mashirle@us.ltcfwd.linux.ibm.com
cc: kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, Shirley
Ma/Beaverton/IBM@IBMUS
Subject: Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
On Wed, 14 Jan 2004 15:52:51 -0800
Shirley Ma <mashirle@us.ibm.com> wrote:
> Once receiving a router advertisement message,
> a netlink notification event will be created.
>
> This patch is against linux-2.6.1.
This patch looks fine, except I can't see how RTM_GETRA is used anywhere.
Even if it will be used by some future change, please remove it until that
later change is made.
So please either show where RTM_GETRA is used or regenerate the patch with
that macro definition removed.
Thanks.
[-- Attachment #2: Type: text/html, Size: 1386 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
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 / 吉藤英明
1 sibling, 1 reply; 12+ messages in thread
From: Shirley Ma @ 2004-01-15 23:04 UTC (permalink / raw)
To: Shirley Ma, David S. Miller; +Cc: kuznet, netdev
[-- Attachment #1: Type: text/plain, Size: 202 bytes --]
> So please either show where RTM_GETRA is used or regenerate the patch with
> that macro definition removed.
This is the new patch for 2.6.1.
Thanks
Shirley Ma
IBM Linux Technology Center
[-- Attachment #2: linux-2.6.1-ipv6mib8.patch --]
[-- Type: text/x-diff, Size: 4378 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-15 14:39:49.000000000 -0800
@@ -44,7 +44,9 @@
#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_MAX (RTM_BASE+35)
/*
Generic structure for encapsulation of optional route information.
@@ -441,6 +443,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 +649,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);
}
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
2004-01-15 23:04 ` Shirley Ma
@ 2004-01-15 23:04 ` David S. Miller
0 siblings, 0 replies; 12+ messages in thread
From: David S. Miller @ 2004-01-15 23:04 UTC (permalink / raw)
To: Shirley Ma; +Cc: xma, kuznet, netdev
On Thu, 15 Jan 2004 15:04:26 -0800
Shirley Ma <mashirle@us.ibm.com> wrote:
> > So please either show where RTM_GETRA is used or regenerate the patch with
> > that macro definition removed.
>
> This is the new patch for 2.6.1.
Thanks Shirley, I'm applying this.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
2004-01-15 22:31 [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification Shirley Ma
2004-01-15 23:04 ` Shirley Ma
@ 2004-01-16 1:37 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 0 replies; 12+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-01-16 1:37 UTC (permalink / raw)
To: davem, xma; +Cc: mashirle, kuznet, netdev, yoshfuji
In article <OFB4F51C5A.FC479F2C-ON87256E1C.007B64B8@us.ibm.com> (at Thu, 15 Jan 2004 14:31:47 -0800), Shirley Ma <xma@us.ibm.com> says:
> This patch is going to be used by SNMP for ipv6RouterAdvert Table. I will
> remove this Micro, and resubmit the patch.
This patch is conceptually wrong.
I think you're misunderstanding the darft.
ipv6RouterAdvertTable contains information used to create router
advertisements on router. Not on host.
Patch should be rejected.
>From draft-ietf-ipv6-rfc2011-update-05.txt:
--- cut here
3.2.9. Router Advertisement Table
This table contains the non-routing information that an IPv6 router
would use in constructing a router advertisement message. It does not
contain information about the prefixes or other routing specific
information that the router might advertise. The router should acquire
such information from either the routing tables or from some routing
table specific MIB.
This table is only required for IPv6 router entities.
--- cut here
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
@ 2004-01-16 19:41 Shirley Ma
2004-01-16 20:08 ` David S. Miller
2004-01-16 20:23 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 2 replies; 12+ messages in thread
From: Shirley Ma @ 2004-01-16 19:41 UTC (permalink / raw)
To: YOSHIFUJI Hideaki / 吉藤英明
Cc: davem, mashirle, kuznet, netdev, yoshfuji
[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]
Yes. radvd should provide all these information. But radvd doesn't support
this right now. I talked to someone who is patching SNMP to support new IP
MIBs, he said it's better to support this through netlink, since netlink
supports all other MIBs. Does netlink support user-user communication?
Anyway I will talk to radvd maintainers to ask them to support this if you
think this netlink notification is not needed.
Thanks
Shirley Ma
IBM Linux Technology Center
15300 SW Koll Parkway
Beaverton, OR 97006-6063
Phone: (503) 578-7638
FAX: (503) 578-3228
YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>@oss.sgi.com on
01/16/2004 11:17:25 AM
Sent by: netdev-bounce@oss.sgi.com
To: Shirley Ma/Beaverton/IBM@IBMUS
cc: davem@redhat.com, mashirle@us.ltcfwd.linux.ibm.com,
kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, yoshfuji@linux-ipv6.org
Subject: Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
In article <OFDFE3736C.20FD7F98-ON87256E1D.00662F80@us.ibm.com> (at Fri, 16
Jan 2004 10:38:49 -0800), Shirley Ma <xma@us.ibm.com> says:
> But the patch is still needed for the Router, so it should be put in
> ndisc_router_discovery() when it's determined as a router. Are you OK
with
> that?
I don't understand why it is needed.
radvd is respoinsible for those information.
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
[-- Attachment #2: Type: text/html, Size: 1846 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
2004-01-16 19:41 Shirley Ma
@ 2004-01-16 20:08 ` David S. Miller
2004-01-16 20:23 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 0 replies; 12+ messages in thread
From: David S. Miller @ 2004-01-16 20:08 UTC (permalink / raw)
To: Shirley Ma; +Cc: yoshfuji, mashirle, kuznet, netdev
On Fri, 16 Jan 2004 11:41:59 -0800
Shirley Ma <xma@us.ibm.com> wrote:
> Does netlink support user-user communication?
Yes, it does.
One thing I want people to keep in mind in these discussions, while I understand
the concerns being addressed and discussed, I think it would be somewhat rediculious
for one to be required to go to multiple places just to put a complete ipv6 mib together.
For example, a bunch of procfs files, some netlink stuff, and some status files emitted
by some userlevel daemon. This is the situation I'd like to see avoided.
It looks like we can push all of this stuff over netlink, which would be ideal.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
2004-01-16 19:41 Shirley Ma
2004-01-16 20:08 ` David S. Miller
@ 2004-01-16 20:23 ` YOSHIFUJI Hideaki / 吉藤英明
1 sibling, 0 replies; 12+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-01-16 20:23 UTC (permalink / raw)
To: xma; +Cc: davem, mashirle, kuznet, netdev, yoshfuji
In article <OF6E7E4DFA.6824D151-ON87256E1D.006A89B5@us.ibm.com> (at Fri, 16 Jan 2004 11:41:59 -0800), Shirley Ma <xma@us.ibm.com> says:
> Yes. radvd should provide all these information. But radvd doesn't support
> this right now. I talked to someone who is patching SNMP to support new IP
> MIBs, he said it's better to support this through netlink, since netlink
> supports all other MIBs. Does netlink support user-user communication?
Yes, netlink is one option and is possibly a good candidate.
I believe netlink supports user-user communication and
rtadvd can use it to provide information to other entities.
> Anyway I will talk to radvd maintainers to ask them to support this if you
> think this netlink notification is not needed.
I do not think netlink RA notification is required in kernel.
What you (or the radvd maintainer) need to do is to
allocate some constants and structures for the message.
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
@ 2004-01-16 18:38 Shirley Ma
2004-01-16 19:17 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 1 reply; 12+ messages in thread
From: Shirley Ma @ 2004-01-16 18:38 UTC (permalink / raw)
To: David S. Miller
Cc: YOSHIFUJI Hideaki / _$B5HF#1QL@, mashirle, kuznet, netdev,
yoshfuji
[-- Attachment #1: Type: text/plain, Size: 1151 bytes --]
Thank Yoshfuji to point out.
But the patch is still needed for the Router, so it should be put in
ndisc_router_discovery() when it's determined as a router. Are you OK with
that?
Thanks
Shirley Ma
IBM Linux Technology Center
15300 SW Koll Parkway
Beaverton, OR 97006-6063
Phone: (503) 578-7638
FAX: (503) 578-3228
"David S. Miller" <davem@redhat.com> on 01/16/2004 02:01:34 AM
To: "YOSHIFUJI Hideaki / _$B5HF#1QL@" <yoshfuji@linux-ipv6.org>
cc: Shirley Ma/Beaverton/IBM@IBMUS, mashirle@us.ltcfwd.linux.ibm.com,
kuznet@ms2.inr.ac.ru, netdev@oss.sgi.com, yoshfuji@linux-ipv6.org
Subject: Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
On Fri, 16 Jan 2004 10:37:10 +0900 (JST)
YOSHIFUJI Hideaki / _$B5HF#1QL@ <yoshfuji@linux-ipv6.org> wrote:
> In article <OFB4F51C5A.FC479F2C-ON87256E1C.007B64B8@us.ibm.com> (at Thu,
15 Jan 2004 14:31:47 -0800), Shirley Ma <xma@us.ibm.com> says:
>
> > This patch is going to be used by SNMP for ipv6RouterAdvert Table. I
will
> > remove this Micro, and resubmit the patch.
>
> This patch is conceptually wrong.
Ok, since this is controversial I'll back it out of my tree.
[-- Attachment #2: Type: text/html, Size: 1537 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
2004-01-16 18:38 Shirley Ma
@ 2004-01-16 19:17 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 0 replies; 12+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-01-16 19:17 UTC (permalink / raw)
To: xma; +Cc: davem, mashirle, kuznet, netdev, yoshfuji
In article <OFDFE3736C.20FD7F98-ON87256E1D.00662F80@us.ibm.com> (at Fri, 16 Jan 2004 10:38:49 -0800), Shirley Ma <xma@us.ibm.com> says:
> But the patch is still needed for the Router, so it should be put in
> ndisc_router_discovery() when it's determined as a router. Are you OK with
> that?
I don't understand why it is needed.
radvd is respoinsible for those information.
--
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
^ permalink raw reply [flat|nested] 12+ messages in thread
* IPv6 MIB:ipv6PrefixTable implementation
@ 2003-11-20 0:21 Shirley Ma
2003-12-05 21:51 ` [PATCH] IPv6 MIB:ipv6Prefix netlink notification Shirley Ma
0 siblings, 1 reply; 12+ messages in thread
From: Shirley Ma @ 2003-11-20 0:21 UTC (permalink / raw)
To: kuznet, netdev; +Cc: xma
Hi, Alexy,
A while ago, we had a discussion about IPv6 Prefix Table implementation.
I agree with you it's not necessary to process offlink prefix.
In each ipv6PrefixTable, there are 9 objects, which are Ifindex, Type, Prefix,
Length, Origin(addrconf, manually, dhcp, others), OnLinkFlag, AutonomoueFlag,
AdvPreferredLiftTime and ValidLifeTime.
As we know, the routing table has all on-link prefix routes. But only Prefix,
Length, Ifindex are saved in routing table, the rest objects info are not saved
anywhere.
One implementation detail question, do you think I need to save all the other
Prefix Objects: Type, Origin(addrconf, manually, dhcp, others), OnLinkFlag,
AutonomoueFlag, AdvPreferredLiftTime and ValidLifeTime in routing table also?
If so, sounds like I add a big structure in each prefix route entry in the routing table.
Thanks
Shirley Ma
IBM Linux Technology Center
=======================
List: linux-netdev
Subject: Re: [Issues] Implementation for IPv6 MIB:ipv6PrefixTable
From: kuznet () ms2 ! inr ! ac ! ru
Date: 2003-10-24 17:59:27
Hello!
> First, do you think it's a good idea to save all prefix objects in routing
> table?
Those which are on-link, of course.
> Second, where is the best location for the off-link prefix, on-link flag 0
> prefix to be saved?
Do you really think off-link prefixes are to be saved? Prefix in use is onlink
by defintion, so just return 1 in these bit and ignore off-link prefixes
completely, they are meaningless, are not they?
> Third, do you think it's a good idea to implement a prefix table/per
> interface in the kernel?
Well, if SNMP is going to be used as a tool to snoop ndisc promiscuously
(which seems to be the case if it shows inforrmation about offlink prefixes),
then it is definitely not a kernel task.
Alexey
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] IPv6 MIB:ipv6Prefix netlink notification
2003-11-20 0:21 IPv6 MIB:ipv6PrefixTable implementation Shirley Ma
@ 2003-12-05 21:51 ` Shirley Ma
2003-12-05 22:57 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Shirley Ma @ 2003-12-05 21:51 UTC (permalink / raw)
To: kuznet, netdev; +Cc: xma
[-- Attachment #1: Type: text/plain, Size: 224 bytes --]
Once receiving a router advertisement message for prefix info,
a netlink notification event will be created.
This patch has been tested against linux-2.6.0-test11.
Thanks
Shirley Ma
IBM Linux Technology Center
[-- Attachment #2: linux-2.6.0-test11-ipv6mib3.patch --]
[-- Type: text/x-diff, Size: 4590 bytes --]
diff -urN linux-2.6.0-test11/include/linux/rtnetlink.h linux-2.6.0-test11-ipv6mib3/include/linux/rtnetlink.h
--- linux-2.6.0-test11/include/linux/rtnetlink.h 2003-11-26 12:45:11.000000000 -0800
+++ linux-2.6.0-test11-ipv6mib3/include/linux/rtnetlink.h 2003-12-05 12:20:11.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_NEWPREFIX (RTM_BASE+36)
+#define RTM_GETPREFIX (RTM_BASE+38)
+
+#define RTM_MAX (RTM_BASE+39)
/*
Generic structure for encapsulation of optional route information.
@@ -458,6 +461,34 @@
unsigned ifi_change; /* IFF_* change mask */
};
+/********************************************************************
+ * prefix information
+ ****/
+
+struct prefixmsg
+{
+ unsigned char prefix_family;
+ int prefix_ifindex;
+ unsigned char prefix_type;
+ unsigned char prefix_len;
+ unsigned char prefix_flags;
+};
+
+enum
+{
+ PREFIX_UNSPEC,
+ PREFIX_ADDRESS,
+ PREFIX_CACHEINFO,
+};
+
+#define PREFIX_MAX PREFIX_CACHEINFO
+
+struct prefix_cacheinfo
+{
+ __u32 preferred_time;
+ __u32 valid_time;
+};
+
/* The struct should be in sync with struct net_device_stats */
struct rtnl_link_stats
{
@@ -614,6 +645,8 @@
#define RTMGRP_DECnet_IFADDR 0x1000
#define RTMGRP_DECnet_ROUTE 0x4000
+#define RTMGRP_IPV6_PREFIX 0x20000
+
/* End of information exported to user level */
#ifdef __KERNEL__
diff -urN linux-2.6.0-test11/include/net/if_inet6.h linux-2.6.0-test11-ipv6mib3/include/net/if_inet6.h
--- linux-2.6.0-test11/include/net/if_inet6.h 2003-11-26 12:45:45.000000000 -0800
+++ linux-2.6.0-test11-ipv6mib3/include/net/if_inet6.h 2003-12-05 12:20:11.000000000 -0800
@@ -25,6 +25,10 @@
#define IF_RA_RCVD 0x20
#define IF_RS_SENT 0x10
+/* prefix flags */
+#define IF_PREFIX_ONLINK 0x01
+#define IF_PREFIX_AUTOCONF 0x02
+
#ifdef __KERNEL__
struct inet6_ifaddr
diff -urN linux-2.6.0-test11/net/ipv6/addrconf.c linux-2.6.0-test11-ipv6mib3/net/ipv6/addrconf.c
--- linux-2.6.0-test11/net/ipv6/addrconf.c 2003-11-26 12:45:37.000000000 -0800
+++ linux-2.6.0-test11-ipv6mib3/net/ipv6/addrconf.c 2003-12-05 12:21:59.000000000 -0800
@@ -138,6 +138,8 @@
static void addrconf_rs_timer(unsigned long data);
static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
+static void inet6_prefix_notify(int event, struct inet6_dev *idev,
+ struct prefix_info *pinfo);
static int ipv6_chk_same_addr(const struct in6_addr *addr, struct net_device *dev);
static struct notifier_block *inet6addr_chain;
@@ -1491,6 +1493,7 @@
addrconf_verify(0);
}
}
+ inet6_prefix_notify(RTM_NEWPREFIX, in6_dev, pinfo);
in6_dev_put(in6_dev);
}
@@ -2751,6 +2754,66 @@
return skb->len;
}
+static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
+ struct prefix_info *pinfo, u32 pid, u32 seq, int event)
+{
+ struct prefixmsg *pmsg;
+ struct nlmsghdr *nlh;
+ unsigned char *b = skb->tail;
+ struct prefix_cacheinfo ci;
+
+ nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*pmsg));
+
+ if (pid)
+ nlh->nlmsg_flags |= NLM_F_MULTI;
+
+ pmsg = NLMSG_DATA(nlh);
+ pmsg->prefix_family = AF_INET6;
+ pmsg->prefix_ifindex = idev->dev->ifindex;
+ pmsg->prefix_len = pinfo->prefix_len;
+ pmsg->prefix_type = pinfo->type;
+
+ pmsg->prefix_flags = 0;
+ if (pinfo->onlink)
+ pmsg->prefix_flags |= IF_PREFIX_ONLINK;
+ if (pinfo->autoconf)
+ pmsg->prefix_flags |= IF_PREFIX_AUTOCONF;
+
+ RTA_PUT(skb, PREFIX_ADDRESS, sizeof(pinfo->prefix), &pinfo->prefix);
+
+ ci.preferred_time = ntohl(pinfo->prefered);
+ ci.valid_time = ntohl(pinfo->valid);
+ RTA_PUT(skb, PREFIX_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;
+}
+
+static void inet6_prefix_notify(int event, struct inet6_dev *idev,
+ struct prefix_info *pinfo)
+{
+ struct sk_buff *skb;
+ int size = NLMSG_SPACE(sizeof(struct prefixmsg)+128);
+
+ skb = alloc_skb(size, GFP_ATOMIC);
+ if (!skb) {
+ netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, ENOBUFS);
+ return;
+ }
+ if (inet6_fill_prefix(skb, idev, pinfo, 0, 0, event) < 0) {
+ kfree_skb(skb);
+ netlink_set_err(rtnl, 0, RTMGRP_IPV6_PREFIX, EINVAL);
+ return;
+ }
+ NETLINK_CB(skb).dst_groups = RTMGRP_IPV6_PREFIX;
+ netlink_broadcast(rtnl, skb, 0, RTMGRP_IPV6_PREFIX, 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, },
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] IPv6 MIB:ipv6Prefix netlink notification
2003-12-05 21:51 ` [PATCH] IPv6 MIB:ipv6Prefix netlink notification Shirley Ma
@ 2003-12-05 22:57 ` David S. Miller
2004-01-14 23:52 ` [PATCH] IPv6 MIB:ipv6RouterAdvert " Shirley Ma
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2003-12-05 22:57 UTC (permalink / raw)
To: Shirley Ma; +Cc: kuznet, netdev, xma
On Fri, 5 Dec 2003 13:51:47 -0800
Shirley Ma <mashirle@us.ibm.com> wrote:
> Once receiving a router advertisement message for prefix info,
> a netlink notification event will be created.
>
> This patch has been tested against linux-2.6.0-test11.
Let's queue this up for 2.6.1, please resend it after 2.6.0 is
released.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
2003-12-05 22:57 ` David S. Miller
@ 2004-01-14 23:52 ` Shirley Ma
2004-01-15 8:52 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Shirley Ma @ 2004-01-14 23:52 UTC (permalink / raw)
To: David S. Miller; +Cc: kuznet, netdev, xma
[-- 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);
}
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
2004-01-14 23:52 ` [PATCH] IPv6 MIB:ipv6RouterAdvert " Shirley Ma
@ 2004-01-15 8:52 ` David S. Miller
2004-01-15 9:10 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2004-01-15 8:52 UTC (permalink / raw)
To: Shirley Ma; +Cc: kuznet, netdev, xma
On Wed, 14 Jan 2004 15:52:51 -0800
Shirley Ma <mashirle@us.ibm.com> wrote:
> Once receiving a router advertisement message,
> a netlink notification event will be created.
>
> This patch is against linux-2.6.1.
This patch looks fine, except I can't see how RTM_GETRA is used anywhere.
Even if it will be used by some future change, please remove it until that
later change is made.
So please either show where RTM_GETRA is used or regenerate the patch with
that macro definition removed.
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] IPv6 MIB:ipv6RouterAdvert netlink notification
2004-01-15 8:52 ` David S. Miller
@ 2004-01-15 9:10 ` YOSHIFUJI Hideaki / 吉藤英明
0 siblings, 0 replies; 12+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2004-01-15 9:10 UTC (permalink / raw)
To: mashirle; +Cc: kuznet, netdev, xma, davem
In article <20040115005252.6e6f1d81.davem@redhat.com> (at Thu, 15 Jan 2004 00:52:52 -0800), "David S. Miller" <davem@redhat.com> says:
> > Once receiving a router advertisement message,
> > a netlink notification event will be created.
> >
> > This patch is against linux-2.6.1.
>
> This patch looks fine, except I can't see how RTM_GETRA is used anywhere.
> Even if it will be used by some future change, please remove it until that
> later change is made.
Hmm, why do we need this? What kind of usage?
I think you can do this in user space by opening raw socket.
--yoshfuji
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2004-01-16 20:23 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 / 吉藤英明
-- strict thread matches above, loose matches on Subject: below --
2004-01-16 19:41 Shirley Ma
2004-01-16 20:08 ` David S. Miller
2004-01-16 20:23 ` YOSHIFUJI Hideaki / 吉藤英明
2004-01-16 18:38 Shirley Ma
2004-01-16 19:17 ` YOSHIFUJI Hideaki / 吉藤英明
2003-11-20 0:21 IPv6 MIB:ipv6PrefixTable implementation Shirley Ma
2003-12-05 21:51 ` [PATCH] IPv6 MIB:ipv6Prefix netlink notification Shirley Ma
2003-12-05 22:57 ` David S. Miller
2004-01-14 23:52 ` [PATCH] IPv6 MIB:ipv6RouterAdvert " Shirley Ma
2004-01-15 8:52 ` David S. Miller
2004-01-15 9:10 ` YOSHIFUJI Hideaki / 吉藤英明
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).