]> Pileus Git - ~andy/linux/commitdiff
ipmr/ip6mr: report origin of mfc entry into rtnl msg
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Tue, 4 Dec 2012 01:13:38 +0000 (01:13 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Dec 2012 18:08:11 +0000 (13:08 -0500)
A mfc entry can be static or not (added via the mroute_sk socket). The patch
reports MFC_STATIC flag into rtm_protocol by setting rtm_protocol to
RTPROT_STATIC or RTPROT_MROUTED.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/rtnetlink.h
net/ipv4/ipmr.c
net/ipv6/ip6mr.c

index 80abe27dc2a7cb2f1fea6547d8e08ba5de23abda..33d29cea37eaa80e2e89b52ad59ee69ea74a4cfc 100644 (file)
@@ -227,6 +227,7 @@ enum {
 #define RTPROT_XORP    14      /* XORP */
 #define RTPROT_NTK     15      /* Netsukuku */
 #define RTPROT_DHCP    16      /* DHCP client */
+#define RTPROT_MROUTED 17      /* Multicast daemon */
 
 /* rtm_scope
 
index c5617d646b93956b0df1400ca1dad7f2336ba8e0..91782a7634c2e95edd7eae496e188b3c8cf233a9 100644 (file)
@@ -2169,7 +2169,10 @@ static int ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb,
                goto nla_put_failure;
        rtm->rtm_type     = RTN_MULTICAST;
        rtm->rtm_scope    = RT_SCOPE_UNIVERSE;
-       rtm->rtm_protocol = RTPROT_UNSPEC;
+       if (c->mfc_flags & MFC_STATIC)
+               rtm->rtm_protocol = RTPROT_STATIC;
+       else
+               rtm->rtm_protocol = RTPROT_MROUTED;
        rtm->rtm_flags    = 0;
 
        if (nla_put_be32(skb, RTA_SRC, c->mfc_origin) ||
index 4220a7b93386bd88fec4f80e0409429c057c8ff4..d51b91122866b1f5a53321a11331f3a69f7bc199 100644 (file)
@@ -2249,7 +2249,10 @@ static int ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb,
        if (nla_put_u32(skb, RTA_TABLE, mrt->id))
                goto nla_put_failure;
        rtm->rtm_scope    = RT_SCOPE_UNIVERSE;
-       rtm->rtm_protocol = RTPROT_UNSPEC;
+       if (c->mfc_flags & MFC_STATIC)
+               rtm->rtm_protocol = RTPROT_STATIC;
+       else
+               rtm->rtm_protocol = RTPROT_MROUTED;
        rtm->rtm_flags    = 0;
 
        if (nla_put(skb, RTA_SRC, 16, &c->mf6c_origin) ||