From: Shirley Ma <mashirle@us.ibm.com>
To: "Shirley Ma" <xma@us.ibm.com>,
"YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
Cc: davem@redhat.com, netdev@oss.sgi.com,
"Hideaki YOSHIFUJI" <yoshfuji@cerberus.hongo.wide.ad.jp>,
yoshfuji@linux-ipv6.org
Subject: Re: [PATCH]dump interface IPv6 multicast/anycast addresses through netlink
Date: Thu, 1 Apr 2004 10:28:12 -0800 [thread overview]
Message-ID: <200404011028.13048.mashirle@us.ibm.com> (raw)
In-Reply-To: <OF8F6A9EBE.82E160C6-ON87256E69.001BB337-88256E69.001D33A3@us.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 118 bytes --]
Here is the new patch. It has been tested against linux 2.6.4 kernel.
Thanks
Shirley Ma
IBM Linux Technology Center
[-- Attachment #2: linux-2.6.4-ipv6mib.patch.new1 --]
[-- Type: text/x-diff, Size: 5499 bytes --]
diff -urN linux-2.6.4/include/linux/rtnetlink.h linux-2.6.4-ipv6mib/include/linux/rtnetlink.h
--- linux-2.6.4/include/linux/rtnetlink.h 2004-03-10 18:55:42.000000000 -0800
+++ linux-2.6.4-ipv6mib/include/linux/rtnetlink.h 2004-04-01 09:18:16.165353048 -0800
@@ -47,7 +47,11 @@
#define RTM_NEWPREFIX (RTM_BASE+36)
#define RTM_GETPREFIX (RTM_BASE+38)
-#define RTM_MAX (RTM_BASE+39)
+#define RTM_GETMULTICAST (RTM_BASE+42)
+
+#define RTM_GETANYCAST (RTM_BASE+46)
+
+#define RTM_MAX (RTM_BASE+47)
/*
Generic structure for encapsulation of optional route information.
@@ -340,7 +344,8 @@
IFA_LABEL,
IFA_BROADCAST,
IFA_ANYCAST,
- IFA_CACHEINFO
+ IFA_CACHEINFO,
+ IFA_MULTICAST
};
#define IFA_MAX IFA_CACHEINFO
diff -urN linux-2.6.4/net/ipv6/addrconf.c linux-2.6.4-ipv6mib/net/ipv6/addrconf.c
--- linux-2.6.4/net/ipv6/addrconf.c 2004-03-10 18:55:44.000000000 -0800
+++ linux-2.6.4-ipv6mib/net/ipv6/addrconf.c 2004-04-01 09:56:16.340713704 -0800
@@ -2571,7 +2571,7 @@
if (ipv6_addr_scope(&ifmca->mca_addr)&IFA_SITE)
ifm->ifa_scope = RT_SCOPE_SITE;
ifm->ifa_index = ifmca->idev->dev->ifindex;
- RTA_PUT(skb, IFA_ADDRESS, 16, &ifmca->mca_addr);
+ RTA_PUT(skb, IFA_MULTICAST, 16, &ifmca->mca_addr);
ci.cstamp = (__u32)(TIME_DELTA(ifmca->mca_cstamp, INITIAL_JIFFIES) / HZ
* 100 + TIME_DELTA(ifmca->mca_cstamp, INITIAL_JIFFIES) % HZ
* 100 / HZ);
@@ -2608,7 +2608,7 @@
if (ipv6_addr_scope(&ifaca->aca_addr)&IFA_SITE)
ifm->ifa_scope = RT_SCOPE_SITE;
ifm->ifa_index = ifaca->aca_idev->dev->ifindex;
- RTA_PUT(skb, IFA_ADDRESS, 16, &ifaca->aca_addr);
+ RTA_PUT(skb, IFA_ANYCAST, 16, &ifaca->aca_addr);
ci.cstamp = (__u32)(TIME_DELTA(ifaca->aca_cstamp, INITIAL_JIFFIES) / HZ
* 100 + TIME_DELTA(ifaca->aca_cstamp, INITIAL_JIFFIES) % HZ
* 100 / HZ);
@@ -2627,7 +2627,14 @@
return -1;
}
-static int inet6_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
+enum addr_type_t
+{
+ UNICAST_ADDR,
+ MULTICAST_ADDR,
+ ANYCAST_ADDR,
+};
+static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
+ enum addr_type_t type)
{
int idx, ip_idx;
int s_idx, s_ip_idx;
@@ -2651,28 +2658,58 @@
if ((idev = in6_dev_get(dev)) == NULL)
continue;
read_lock_bh(&idev->lock);
- /* unicast address */
- for (ifa = idev->addr_list; ifa;
- ifa = ifa->if_next, ip_idx++) {
- if (ip_idx < s_ip_idx)
- continue;
- if ((err = inet6_fill_ifaddr(skb, ifa,
- NETLINK_CB(cb->skb).pid,
- cb->nlh->nlmsg_seq, RTM_NEWADDR)) <= 0)
- goto done;
- }
- /* temp addr */
+ switch (type) {
+ case UNICAST_ADDR:
+ /* unicast address */
+ for (ifa = idev->addr_list; ifa;
+ ifa = ifa->if_next, ip_idx++) {
+ if (ip_idx < s_ip_idx)
+ continue;
+ if ((err = inet6_fill_ifaddr(skb, ifa,
+ NETLINK_CB(cb->skb).pid,
+ cb->nlh->nlmsg_seq, RTM_NEWADDR)) <= 0)
+ goto done;
+ }
+ /* temp addr */
#ifdef CONFIG_IPV6_PRIVACY
- for (ifa = idev->tempaddr_list; ifa;
- ifa = ifa->tmp_next, ip_idx++) {
- if (ip_idx < s_ip_idx)
- continue;
- if ((err = inet6_fill_ifaddr(skb, ifa,
- NETLINK_CB(cb->skb).pid,
- cb->nlh->nlmsg_seq, RTM_NEWADDR)) <= 0)
- goto done;
- }
+ for (ifa = idev->tempaddr_list; ifa;
+ ifa = ifa->tmp_next, ip_idx++) {
+ if (ip_idx < s_ip_idx)
+ continue;
+ if ((err = inet6_fill_ifaddr(skb, ifa,
+ NETLINK_CB(cb->skb).pid,
+ cb->nlh->nlmsg_seq, RTM_NEWADDR)) <= 0)
+ goto done;
+ }
#endif
+ break;
+ case MULTICAST_ADDR:
+ /* multicast address */
+ for (ifmca = idev->mc_list; ifmca;
+ ifmca = ifmca->next, ip_idx++) {
+ if (ip_idx < s_ip_idx)
+ continue;
+ if ((err = inet6_fill_ifmcaddr(skb, ifmca,
+ NETLINK_CB(cb->skb).pid,
+ cb->nlh->nlmsg_seq, RTM_GETMULTICAST)) <= 0)
+ goto done;
+ }
+ break;
+ case ANYCAST_ADDR:
+ /* anycast address */
+ for (ifaca = idev->ac_list; ifaca;
+ ifaca = ifaca->aca_next, ip_idx++) {
+ if (ip_idx < s_ip_idx)
+ continue;
+ if ((err = inet6_fill_ifacaddr(skb, ifaca,
+ NETLINK_CB(cb->skb).pid,
+ cb->nlh->nlmsg_seq, RTM_GETANYCAST)) <= 0)
+ goto done;
+ }
+ break;
+ default:
+ break;
+ }
read_unlock_bh(&idev->lock);
in6_dev_put(idev);
}
@@ -2687,6 +2724,25 @@
return skb->len;
}
+static int inet6_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
+{
+ enum addr_type_t type = UNICAST_ADDR;
+ return inet6_dump_addr(skb, cb, type);
+}
+
+static int inet6_dump_ifmcaddr(struct sk_buff *skb, struct netlink_callback *cb)
+{
+ enum addr_type_t type = MULTICAST_ADDR;
+ return inet6_dump_addr(skb, cb, type);
+}
+
+
+static int inet6_dump_ifacaddr(struct sk_buff *skb, struct netlink_callback *cb)
+{
+ enum addr_type_t type = ANYCAST_ADDR;
+ return inet6_dump_addr(skb, cb, type);
+}
+
static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
{
struct sk_buff *skb;
@@ -2911,6 +2967,8 @@
[RTM_NEWADDR - RTM_BASE] = { .doit = inet6_rtm_newaddr, },
[RTM_DELADDR - RTM_BASE] = { .doit = inet6_rtm_deladdr, },
[RTM_GETADDR - RTM_BASE] = { .dumpit = inet6_dump_ifaddr, },
+ [RTM_GETMULTICAST - RTM_BASE] = { .dumpit = inet6_dump_ifmcaddr, },
+ [RTM_GETANYCAST - RTM_BASE] = { .dumpit = inet6_dump_ifacaddr, },
[RTM_NEWROUTE - RTM_BASE] = { .doit = inet6_rtm_newroute, },
[RTM_DELROUTE - RTM_BASE] = { .doit = inet6_rtm_delroute, },
[RTM_GETROUTE - RTM_BASE] = { .doit = inet6_rtm_getroute,
next prev parent reply other threads:[~2004-04-01 18:28 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-17 19:30 [PATCH]dump interface IPv6 multicast/anycast addresses through netlink Shirley Ma
2004-03-19 6:06 ` David S. Miller
2004-03-19 6:52 ` YOSHIFUJI Hideaki / 吉藤英明
2004-03-19 6:55 ` YOSHIFUJI Hideaki / 吉藤英明
2004-03-19 7:16 ` Shirley Ma
2004-03-19 7:32 ` David S. Miller
2004-03-19 8:03 ` Shirley Ma
2004-03-31 18:07 ` Shirley Ma
2004-04-01 4:50 ` YOSHIFUJI Hideaki / 吉藤英明
2004-04-01 5:18 ` Shirley Ma
2004-04-01 18:28 ` Shirley Ma [this message]
2004-04-03 22:45 ` David S. Miller
2004-04-05 20:51 ` Shirley Ma
2004-04-05 21:42 ` David S. Miller
2004-04-06 0:11 ` Fix IPv6 MIBs counters in 2.6.5 kernel Shirley Ma
2004-04-09 23:27 ` David S. Miller
2004-03-31 21:26 ` [PATCH]Add IPv6 MIBs counters in MLD (mcast.c) Shirley Ma
2004-04-03 22:30 ` David S. Miller
2004-05-26 20:10 ` [PATCH]Add new IPv6 MIBs counters support through netlink Shirley Ma
2004-05-26 20:22 ` David S. Miller
2004-05-26 20:42 ` Shirley Ma
2004-05-26 20:44 ` David S. Miller
2004-05-26 23:08 ` YOSHIFUJI Hideaki / 吉藤英明
2004-05-26 23:22 ` YOSHIFUJI Hideaki / 吉藤英明
2004-05-26 23:22 ` David S. Miller
2004-05-26 23:34 ` Shirley Ma
2004-05-26 23:32 ` Shirley Ma
2004-05-26 23:58 ` YOSHIFUJI Hideaki / 吉藤英明
2004-05-27 0:01 ` David S. Miller
2004-06-09 23:00 ` [PATCH] dst allocation problem in ndisc Shirley Ma
2004-06-10 2:12 ` YOSHIFUJI Hideaki / 吉藤英明
2004-06-10 20:05 ` Shirley Ma
2004-06-10 20:46 ` Shirley Ma
2004-06-11 5:08 ` David S. Miller
2004-06-09 23:29 ` [PATCH] some condition check error in ipsec v6 Shirley Ma
2004-06-10 1:48 ` YOSHIFUJI Hideaki / 吉藤英明
2004-06-11 5:11 ` David S. Miller
2004-05-26 20:19 ` [PATCH] pmtu check conditions error in IPv6 Shirley Ma
2004-05-26 20:24 ` David S. Miller
2004-05-26 20:50 ` [PATCH] IFA_MAX sets wrong in rtnetlink.h Shirley Ma
2004-05-26 20:56 ` David S. Miller
2004-05-28 4:48 ` YOSHIFUJI Hideaki / 吉藤英明
2004-05-28 5:07 ` David S. Miller
2004-05-28 5:12 ` YOSHIFUJI Hideaki / 吉藤英明
2004-05-28 9:25 ` YOSHIFUJI Hideaki / 吉藤英明
2004-05-29 19:36 ` David S. Miller
2004-05-28 9:27 ` 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=200404011028.13048.mashirle@us.ibm.com \
--to=mashirle@us.ibm.com \
--cc=davem@redhat.com \
--cc=netdev@oss.sgi.com \
--cc=xma@us.ibm.com \
--cc=yoshfuji@cerberus.hongo.wide.ad.jp \
--cc=yoshfuji@linux-ipv6.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.