netlink: make nlmsg_end() and genlmsg_end() void
[deliverable/linux.git] / net / ipv4 / fib_semantics.c
index f99f41bd15b83072d7a67cd452a29ce550e0593e..265cb72b7c1b633aa1c431487dbda9898a22d930 100644 (file)
@@ -360,7 +360,8 @@ static inline size_t fib_nlmsg_size(struct fib_info *fi)
                         + nla_total_size(4) /* RTA_TABLE */
                         + nla_total_size(4) /* RTA_DST */
                         + nla_total_size(4) /* RTA_PRIORITY */
-                        + nla_total_size(4); /* RTA_PREFSRC */
+                        + nla_total_size(4) /* RTA_PREFSRC */
+                        + nla_total_size(TCP_CA_NAME_MAX); /* RTAX_CC_ALGO */
 
        /* space for nested metrics */
        payload += nla_total_size((RTAX_MAX * nla_total_size(4)));
@@ -859,7 +860,16 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
 
                                if (type > RTAX_MAX)
                                        goto err_inval;
-                               val = nla_get_u32(nla);
+                               if (type == RTAX_CC_ALGO) {
+                                       char tmp[TCP_CA_NAME_MAX];
+
+                                       nla_strlcpy(tmp, nla, sizeof(tmp));
+                                       val = tcp_ca_get_key_by_name(tmp);
+                                       if (val == TCP_CA_UNSPEC)
+                                               goto err_inval;
+                               } else {
+                                       val = nla_get_u32(nla);
+                               }
                                if (type == RTAX_ADVMSS && val > 65535 - 40)
                                        val = 65535 - 40;
                                if (type == RTAX_MTU && val > 65535 - 15)
@@ -1081,7 +1091,8 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
                nla_nest_end(skb, mp);
        }
 #endif
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
This page took 0.025447 seconds and 5 git commands to generate.