]> err.no Git - linux-2.6/commitdiff
[IPv6] prefix: Convert RTM_NEWPREFIX notifications to use the new netlink api
authorThomas Graf <tgraf@suug.ch>
Wed, 15 Nov 2006 03:54:19 +0000 (19:54 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:22:45 +0000 (21:22 -0800)
RTM_GETPREFIX is completely unused and is thus removed.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/rtnetlink.h
net/core/rtnetlink.c
net/ipv6/addrconf.c
security/selinux/nlmsgtab.c

index 3a18addaed4ccb7436bffc9cf5fd0666f145d35c..33b3d0ab3a91be7a268954fe085604cf5521b2a4 100644 (file)
@@ -81,8 +81,6 @@ enum {
 
        RTM_NEWPREFIX   = 52,
 #define RTM_NEWPREFIX  RTM_NEWPREFIX
-       RTM_GETPREFIX   = 54,
-#define RTM_GETPREFIX  RTM_GETPREFIX
 
        RTM_GETMULTICAST = 58,
 #define RTM_GETMULTICAST RTM_GETMULTICAST
index 50d6cb40c6e31d899f91d34e0cfdf4e09c7a2da1..0cb4d9e53a0771d6424f3144dc837939acbcca87 100644 (file)
@@ -108,7 +108,6 @@ static const int rtm_min[RTM_NR_FAMILIES] =
        [RTM_FAM(RTM_NEWTCLASS)]    = NLMSG_LENGTH(sizeof(struct tcmsg)),
        [RTM_FAM(RTM_NEWTFILTER)]   = NLMSG_LENGTH(sizeof(struct tcmsg)),
        [RTM_FAM(RTM_NEWACTION)]    = NLMSG_LENGTH(sizeof(struct tcamsg)),
-       [RTM_FAM(RTM_NEWPREFIX)]    = NLMSG_LENGTH(sizeof(struct rtgenmsg)),
        [RTM_FAM(RTM_GETMULTICAST)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)),
        [RTM_FAM(RTM_GETANYCAST)]   = NLMSG_LENGTH(sizeof(struct rtgenmsg)),
 };
index 46cd941d296f7efc9cf9740001931f5b834564a7..052f99eaf2ac90eb275cfac7875b3ef645c939c6 100644 (file)
@@ -3518,16 +3518,18 @@ static inline size_t inet6_prefix_nlmsg_size(void)
 }
 
 static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
-                       struct prefix_info *pinfo, u32 pid, u32 seq, 
-                       int event, unsigned int flags)
+                            struct prefix_info *pinfo, u32 pid, u32 seq,
+                            int event, unsigned int flags)
 {
-       struct prefixmsg        *pmsg;
-       struct nlmsghdr         *nlh;
-       unsigned char           *b = skb->tail;
+       struct prefixmsg *pmsg;
+       struct nlmsghdr *nlh;
        struct prefix_cacheinfo ci;
 
-       nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*pmsg), flags);
-       pmsg = NLMSG_DATA(nlh);
+       nlh = nlmsg_put(skb, pid, seq, event, sizeof(*pmsg), flags);
+       if (nlh == NULL)
+               return -ENOBUFS;
+
+       pmsg = nlmsg_data(nlh);
        pmsg->prefix_family = AF_INET6;
        pmsg->prefix_pad1 = 0;
        pmsg->prefix_pad2 = 0;
@@ -3535,26 +3537,22 @@ static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
        pmsg->prefix_len = pinfo->prefix_len;
        pmsg->prefix_type = pinfo->type;
        pmsg->prefix_pad3 = 0;
-       
        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);
+       NLA_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);
+       NLA_PUT(skb, PREFIX_CACHEINFO, sizeof(ci), &ci);
 
-       nlh->nlmsg_len = skb->tail - b;
-       return skb->len;
+       return nlmsg_end(skb, nlh);
 
-nlmsg_failure:
-rtattr_failure:
-       skb_trim(skb, b - skb->data);
-       return -1;
+nla_put_failure:
+       return nlmsg_cancel(skb, nlh);
 }
 
 static void inet6_prefix_notify(int event, struct inet6_dev *idev, 
index b8f4d25cf33533d15ac51665674fa5dfaaf94bc2..ccfe8755735e13b864b16f56d8880dc93568efb2 100644 (file)
@@ -60,7 +60,6 @@ static struct nlmsg_perm nlmsg_route_perms[] =
        { RTM_DELACTION,        NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
        { RTM_GETACTION,        NETLINK_ROUTE_SOCKET__NLMSG_READ  },
        { RTM_NEWPREFIX,        NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
-       { RTM_GETPREFIX,        NETLINK_ROUTE_SOCKET__NLMSG_READ  },
        { RTM_GETMULTICAST,     NETLINK_ROUTE_SOCKET__NLMSG_READ  },
        { RTM_GETANYCAST,       NETLINK_ROUTE_SOCKET__NLMSG_READ  },
        { RTM_GETNEIGHTBL,      NETLINK_ROUTE_SOCKET__NLMSG_READ  },