.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | #include <linux/types.h> |
---|
2 | 3 | #include <linux/skbuff.h> |
---|
3 | 4 | #include <linux/socket.h> |
---|
.. | .. |
---|
22 | 23 | #if IS_ENABLED(CONFIG_IPV6) |
---|
23 | 24 | #include <net/ipv6.h> |
---|
24 | 25 | #endif |
---|
25 | | -#include <net/addrconf.h> |
---|
26 | | -#include <net/nexthop.h> |
---|
| 26 | +#include <net/ipv6_stubs.h> |
---|
| 27 | +#include <net/rtnh.h> |
---|
27 | 28 | #include "internal.h" |
---|
28 | 29 | |
---|
29 | 30 | /* max memory we will use for mpls_route */ |
---|
.. | .. |
---|
36 | 37 | |
---|
37 | 38 | #define MPLS_NEIGH_TABLE_UNSPEC (NEIGH_LINK_TABLE + 1) |
---|
38 | 39 | |
---|
39 | | -static int zero = 0; |
---|
40 | | -static int one = 1; |
---|
41 | 40 | static int label_limit = (1 << 20) - 1; |
---|
42 | 41 | static int ttl_max = 255; |
---|
43 | 42 | |
---|
.. | .. |
---|
1079 | 1078 | |
---|
1080 | 1079 | p = per_cpu_ptr(mdev->stats, i); |
---|
1081 | 1080 | do { |
---|
1082 | | - start = u64_stats_fetch_begin(&p->syncp); |
---|
| 1081 | + start = u64_stats_fetch_begin_irq(&p->syncp); |
---|
1083 | 1082 | local = p->stats; |
---|
1084 | | - } while (u64_stats_fetch_retry(&p->syncp, start)); |
---|
| 1083 | + } while (u64_stats_fetch_retry_irq(&p->syncp, start)); |
---|
1085 | 1084 | |
---|
1086 | 1085 | stats->rx_packets += local.rx_packets; |
---|
1087 | 1086 | stats->rx_bytes += local.rx_bytes; |
---|
.. | .. |
---|
1208 | 1207 | [NETCONFA_IFINDEX] = { .len = sizeof(int) }, |
---|
1209 | 1208 | }; |
---|
1210 | 1209 | |
---|
| 1210 | +static int mpls_netconf_valid_get_req(struct sk_buff *skb, |
---|
| 1211 | + const struct nlmsghdr *nlh, |
---|
| 1212 | + struct nlattr **tb, |
---|
| 1213 | + struct netlink_ext_ack *extack) |
---|
| 1214 | +{ |
---|
| 1215 | + int i, err; |
---|
| 1216 | + |
---|
| 1217 | + if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(struct netconfmsg))) { |
---|
| 1218 | + NL_SET_ERR_MSG_MOD(extack, |
---|
| 1219 | + "Invalid header for netconf get request"); |
---|
| 1220 | + return -EINVAL; |
---|
| 1221 | + } |
---|
| 1222 | + |
---|
| 1223 | + if (!netlink_strict_get_check(skb)) |
---|
| 1224 | + return nlmsg_parse_deprecated(nlh, sizeof(struct netconfmsg), |
---|
| 1225 | + tb, NETCONFA_MAX, |
---|
| 1226 | + devconf_mpls_policy, extack); |
---|
| 1227 | + |
---|
| 1228 | + err = nlmsg_parse_deprecated_strict(nlh, sizeof(struct netconfmsg), |
---|
| 1229 | + tb, NETCONFA_MAX, |
---|
| 1230 | + devconf_mpls_policy, extack); |
---|
| 1231 | + if (err) |
---|
| 1232 | + return err; |
---|
| 1233 | + |
---|
| 1234 | + for (i = 0; i <= NETCONFA_MAX; i++) { |
---|
| 1235 | + if (!tb[i]) |
---|
| 1236 | + continue; |
---|
| 1237 | + |
---|
| 1238 | + switch (i) { |
---|
| 1239 | + case NETCONFA_IFINDEX: |
---|
| 1240 | + break; |
---|
| 1241 | + default: |
---|
| 1242 | + NL_SET_ERR_MSG_MOD(extack, "Unsupported attribute in netconf get request"); |
---|
| 1243 | + return -EINVAL; |
---|
| 1244 | + } |
---|
| 1245 | + } |
---|
| 1246 | + |
---|
| 1247 | + return 0; |
---|
| 1248 | +} |
---|
| 1249 | + |
---|
1211 | 1250 | static int mpls_netconf_get_devconf(struct sk_buff *in_skb, |
---|
1212 | 1251 | struct nlmsghdr *nlh, |
---|
1213 | 1252 | struct netlink_ext_ack *extack) |
---|
1214 | 1253 | { |
---|
1215 | 1254 | struct net *net = sock_net(in_skb->sk); |
---|
1216 | 1255 | struct nlattr *tb[NETCONFA_MAX + 1]; |
---|
1217 | | - struct netconfmsg *ncm; |
---|
1218 | 1256 | struct net_device *dev; |
---|
1219 | 1257 | struct mpls_dev *mdev; |
---|
1220 | 1258 | struct sk_buff *skb; |
---|
1221 | 1259 | int ifindex; |
---|
1222 | 1260 | int err; |
---|
1223 | 1261 | |
---|
1224 | | - err = nlmsg_parse(nlh, sizeof(*ncm), tb, NETCONFA_MAX, |
---|
1225 | | - devconf_mpls_policy, NULL); |
---|
| 1262 | + err = mpls_netconf_valid_get_req(in_skb, nlh, tb, extack); |
---|
1226 | 1263 | if (err < 0) |
---|
1227 | 1264 | goto errout; |
---|
1228 | 1265 | |
---|
.. | .. |
---|
1262 | 1299 | static int mpls_netconf_dump_devconf(struct sk_buff *skb, |
---|
1263 | 1300 | struct netlink_callback *cb) |
---|
1264 | 1301 | { |
---|
| 1302 | + const struct nlmsghdr *nlh = cb->nlh; |
---|
1265 | 1303 | struct net *net = sock_net(skb->sk); |
---|
1266 | 1304 | struct hlist_head *head; |
---|
1267 | 1305 | struct net_device *dev; |
---|
1268 | 1306 | struct mpls_dev *mdev; |
---|
1269 | 1307 | int idx, s_idx; |
---|
1270 | 1308 | int h, s_h; |
---|
| 1309 | + |
---|
| 1310 | + if (cb->strict_check) { |
---|
| 1311 | + struct netlink_ext_ack *extack = cb->extack; |
---|
| 1312 | + struct netconfmsg *ncm; |
---|
| 1313 | + |
---|
| 1314 | + if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*ncm))) { |
---|
| 1315 | + NL_SET_ERR_MSG_MOD(extack, "Invalid header for netconf dump request"); |
---|
| 1316 | + return -EINVAL; |
---|
| 1317 | + } |
---|
| 1318 | + |
---|
| 1319 | + if (nlmsg_attrlen(nlh, sizeof(*ncm))) { |
---|
| 1320 | + NL_SET_ERR_MSG_MOD(extack, "Invalid data after header in netconf dump request"); |
---|
| 1321 | + return -EINVAL; |
---|
| 1322 | + } |
---|
| 1323 | + } |
---|
1271 | 1324 | |
---|
1272 | 1325 | s_h = cb->args[0]; |
---|
1273 | 1326 | s_idx = idx = cb->args[1]; |
---|
.. | .. |
---|
1285 | 1338 | goto cont; |
---|
1286 | 1339 | if (mpls_netconf_fill_devconf(skb, mdev, |
---|
1287 | 1340 | NETLINK_CB(cb->skb).portid, |
---|
1288 | | - cb->nlh->nlmsg_seq, |
---|
| 1341 | + nlh->nlmsg_seq, |
---|
1289 | 1342 | RTM_NEWNETCONF, |
---|
1290 | 1343 | NLM_F_MULTI, |
---|
1291 | 1344 | NETCONFA_ALL) < 0) { |
---|
.. | .. |
---|
1309 | 1362 | (&((struct mpls_dev *)0)->field) |
---|
1310 | 1363 | |
---|
1311 | 1364 | static int mpls_conf_proc(struct ctl_table *ctl, int write, |
---|
1312 | | - void __user *buffer, |
---|
1313 | | - size_t *lenp, loff_t *ppos) |
---|
| 1365 | + void *buffer, size_t *lenp, loff_t *ppos) |
---|
1314 | 1366 | { |
---|
1315 | 1367 | int oval = *(int *)ctl->data; |
---|
1316 | 1368 | int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |
---|
.. | .. |
---|
1375 | 1427 | free: |
---|
1376 | 1428 | kfree(table); |
---|
1377 | 1429 | out: |
---|
| 1430 | + mdev->sysctl = NULL; |
---|
1378 | 1431 | return -ENOBUFS; |
---|
1379 | 1432 | } |
---|
1380 | 1433 | |
---|
.. | .. |
---|
1383 | 1436 | { |
---|
1384 | 1437 | struct net *net = dev_net(dev); |
---|
1385 | 1438 | struct ctl_table *table; |
---|
| 1439 | + |
---|
| 1440 | + if (!mdev->sysctl) |
---|
| 1441 | + return; |
---|
1386 | 1442 | |
---|
1387 | 1443 | table = mdev->sysctl->ctl_table_arg; |
---|
1388 | 1444 | unregister_net_sysctl_table(mdev->sysctl); |
---|
.. | .. |
---|
1494 | 1550 | case NETDEV_DOWN: |
---|
1495 | 1551 | case NETDEV_UNREGISTER: |
---|
1496 | 1552 | nh_flags |= RTNH_F_DEAD; |
---|
1497 | | - /* fall through */ |
---|
| 1553 | + fallthrough; |
---|
1498 | 1554 | case NETDEV_CHANGE: |
---|
1499 | 1555 | nh_flags |= RTNH_F_LINKDOWN; |
---|
1500 | 1556 | break; |
---|
.. | .. |
---|
1561 | 1617 | unsigned int flags; |
---|
1562 | 1618 | |
---|
1563 | 1619 | if (event == NETDEV_REGISTER) { |
---|
| 1620 | + mdev = mpls_add_dev(dev); |
---|
| 1621 | + if (IS_ERR(mdev)) |
---|
| 1622 | + return notifier_from_errno(PTR_ERR(mdev)); |
---|
1564 | 1623 | |
---|
1565 | | - /* For now just support Ethernet, IPGRE, IP6GRE, SIT and |
---|
1566 | | - * IPIP devices |
---|
1567 | | - */ |
---|
1568 | | - if (dev->type == ARPHRD_ETHER || |
---|
1569 | | - dev->type == ARPHRD_LOOPBACK || |
---|
1570 | | - dev->type == ARPHRD_IPGRE || |
---|
1571 | | - dev->type == ARPHRD_IP6GRE || |
---|
1572 | | - dev->type == ARPHRD_SIT || |
---|
1573 | | - dev->type == ARPHRD_TUNNEL) { |
---|
1574 | | - mdev = mpls_add_dev(dev); |
---|
1575 | | - if (IS_ERR(mdev)) |
---|
1576 | | - return notifier_from_errno(PTR_ERR(mdev)); |
---|
1577 | | - } |
---|
1578 | 1624 | return NOTIFY_OK; |
---|
1579 | 1625 | } |
---|
1580 | 1626 | |
---|
.. | .. |
---|
1771 | 1817 | int index; |
---|
1772 | 1818 | int err; |
---|
1773 | 1819 | |
---|
1774 | | - err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_mpls_policy, |
---|
1775 | | - extack); |
---|
| 1820 | + err = nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, |
---|
| 1821 | + rtm_mpls_policy, extack); |
---|
1776 | 1822 | if (err < 0) |
---|
1777 | 1823 | goto errout; |
---|
1778 | 1824 | |
---|
.. | .. |
---|
2000 | 2046 | u8 linkdown = 0; |
---|
2001 | 2047 | u8 dead = 0; |
---|
2002 | 2048 | |
---|
2003 | | - mp = nla_nest_start(skb, RTA_MULTIPATH); |
---|
| 2049 | + mp = nla_nest_start_noflag(skb, RTA_MULTIPATH); |
---|
2004 | 2050 | if (!mp) |
---|
2005 | 2051 | goto nla_put_failure; |
---|
2006 | 2052 | |
---|
.. | .. |
---|
2053 | 2099 | return -EMSGSIZE; |
---|
2054 | 2100 | } |
---|
2055 | 2101 | |
---|
| 2102 | +#if IS_ENABLED(CONFIG_INET) |
---|
| 2103 | +static int mpls_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh, |
---|
| 2104 | + struct fib_dump_filter *filter, |
---|
| 2105 | + struct netlink_callback *cb) |
---|
| 2106 | +{ |
---|
| 2107 | + return ip_valid_fib_dump_req(net, nlh, filter, cb); |
---|
| 2108 | +} |
---|
| 2109 | +#else |
---|
| 2110 | +static int mpls_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh, |
---|
| 2111 | + struct fib_dump_filter *filter, |
---|
| 2112 | + struct netlink_callback *cb) |
---|
| 2113 | +{ |
---|
| 2114 | + struct netlink_ext_ack *extack = cb->extack; |
---|
| 2115 | + struct nlattr *tb[RTA_MAX + 1]; |
---|
| 2116 | + struct rtmsg *rtm; |
---|
| 2117 | + int err, i; |
---|
| 2118 | + |
---|
| 2119 | + if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*rtm))) { |
---|
| 2120 | + NL_SET_ERR_MSG_MOD(extack, "Invalid header for FIB dump request"); |
---|
| 2121 | + return -EINVAL; |
---|
| 2122 | + } |
---|
| 2123 | + |
---|
| 2124 | + rtm = nlmsg_data(nlh); |
---|
| 2125 | + if (rtm->rtm_dst_len || rtm->rtm_src_len || rtm->rtm_tos || |
---|
| 2126 | + rtm->rtm_table || rtm->rtm_scope || rtm->rtm_type || |
---|
| 2127 | + rtm->rtm_flags) { |
---|
| 2128 | + NL_SET_ERR_MSG_MOD(extack, "Invalid values in header for FIB dump request"); |
---|
| 2129 | + return -EINVAL; |
---|
| 2130 | + } |
---|
| 2131 | + |
---|
| 2132 | + if (rtm->rtm_protocol) { |
---|
| 2133 | + filter->protocol = rtm->rtm_protocol; |
---|
| 2134 | + filter->filter_set = 1; |
---|
| 2135 | + cb->answer_flags = NLM_F_DUMP_FILTERED; |
---|
| 2136 | + } |
---|
| 2137 | + |
---|
| 2138 | + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, |
---|
| 2139 | + rtm_mpls_policy, extack); |
---|
| 2140 | + if (err < 0) |
---|
| 2141 | + return err; |
---|
| 2142 | + |
---|
| 2143 | + for (i = 0; i <= RTA_MAX; ++i) { |
---|
| 2144 | + int ifindex; |
---|
| 2145 | + |
---|
| 2146 | + if (i == RTA_OIF) { |
---|
| 2147 | + ifindex = nla_get_u32(tb[i]); |
---|
| 2148 | + filter->dev = __dev_get_by_index(net, ifindex); |
---|
| 2149 | + if (!filter->dev) |
---|
| 2150 | + return -ENODEV; |
---|
| 2151 | + filter->filter_set = 1; |
---|
| 2152 | + } else if (tb[i]) { |
---|
| 2153 | + NL_SET_ERR_MSG_MOD(extack, "Unsupported attribute in dump request"); |
---|
| 2154 | + return -EINVAL; |
---|
| 2155 | + } |
---|
| 2156 | + } |
---|
| 2157 | + |
---|
| 2158 | + return 0; |
---|
| 2159 | +} |
---|
| 2160 | +#endif |
---|
| 2161 | + |
---|
| 2162 | +static bool mpls_rt_uses_dev(struct mpls_route *rt, |
---|
| 2163 | + const struct net_device *dev) |
---|
| 2164 | +{ |
---|
| 2165 | + struct net_device *nh_dev; |
---|
| 2166 | + |
---|
| 2167 | + if (rt->rt_nhn == 1) { |
---|
| 2168 | + struct mpls_nh *nh = rt->rt_nh; |
---|
| 2169 | + |
---|
| 2170 | + nh_dev = rtnl_dereference(nh->nh_dev); |
---|
| 2171 | + if (dev == nh_dev) |
---|
| 2172 | + return true; |
---|
| 2173 | + } else { |
---|
| 2174 | + for_nexthops(rt) { |
---|
| 2175 | + nh_dev = rtnl_dereference(nh->nh_dev); |
---|
| 2176 | + if (nh_dev == dev) |
---|
| 2177 | + return true; |
---|
| 2178 | + } endfor_nexthops(rt); |
---|
| 2179 | + } |
---|
| 2180 | + |
---|
| 2181 | + return false; |
---|
| 2182 | +} |
---|
| 2183 | + |
---|
2056 | 2184 | static int mpls_dump_routes(struct sk_buff *skb, struct netlink_callback *cb) |
---|
2057 | 2185 | { |
---|
| 2186 | + const struct nlmsghdr *nlh = cb->nlh; |
---|
2058 | 2187 | struct net *net = sock_net(skb->sk); |
---|
2059 | 2188 | struct mpls_route __rcu **platform_label; |
---|
| 2189 | + struct fib_dump_filter filter = {}; |
---|
| 2190 | + unsigned int flags = NLM_F_MULTI; |
---|
2060 | 2191 | size_t platform_labels; |
---|
2061 | 2192 | unsigned int index; |
---|
2062 | 2193 | |
---|
2063 | 2194 | ASSERT_RTNL(); |
---|
| 2195 | + |
---|
| 2196 | + if (cb->strict_check) { |
---|
| 2197 | + int err; |
---|
| 2198 | + |
---|
| 2199 | + err = mpls_valid_fib_dump_req(net, nlh, &filter, cb); |
---|
| 2200 | + if (err < 0) |
---|
| 2201 | + return err; |
---|
| 2202 | + |
---|
| 2203 | + /* for MPLS, there is only 1 table with fixed type and flags. |
---|
| 2204 | + * If either are set in the filter then return nothing. |
---|
| 2205 | + */ |
---|
| 2206 | + if ((filter.table_id && filter.table_id != RT_TABLE_MAIN) || |
---|
| 2207 | + (filter.rt_type && filter.rt_type != RTN_UNICAST) || |
---|
| 2208 | + filter.flags) |
---|
| 2209 | + return skb->len; |
---|
| 2210 | + } |
---|
2064 | 2211 | |
---|
2065 | 2212 | index = cb->args[0]; |
---|
2066 | 2213 | if (index < MPLS_LABEL_FIRST_UNRESERVED) |
---|
.. | .. |
---|
2068 | 2215 | |
---|
2069 | 2216 | platform_label = rtnl_dereference(net->mpls.platform_label); |
---|
2070 | 2217 | platform_labels = net->mpls.platform_labels; |
---|
| 2218 | + |
---|
| 2219 | + if (filter.filter_set) |
---|
| 2220 | + flags |= NLM_F_DUMP_FILTERED; |
---|
| 2221 | + |
---|
2071 | 2222 | for (; index < platform_labels; index++) { |
---|
2072 | 2223 | struct mpls_route *rt; |
---|
| 2224 | + |
---|
2073 | 2225 | rt = rtnl_dereference(platform_label[index]); |
---|
2074 | 2226 | if (!rt) |
---|
2075 | 2227 | continue; |
---|
2076 | 2228 | |
---|
| 2229 | + if ((filter.dev && !mpls_rt_uses_dev(rt, filter.dev)) || |
---|
| 2230 | + (filter.protocol && rt->rt_protocol != filter.protocol)) |
---|
| 2231 | + continue; |
---|
| 2232 | + |
---|
2077 | 2233 | if (mpls_dump_route(skb, NETLINK_CB(cb->skb).portid, |
---|
2078 | 2234 | cb->nlh->nlmsg_seq, RTM_NEWROUTE, |
---|
2079 | | - index, rt, NLM_F_MULTI) < 0) |
---|
| 2235 | + index, rt, flags) < 0) |
---|
2080 | 2236 | break; |
---|
2081 | 2237 | } |
---|
2082 | 2238 | cb->args[0] = index; |
---|
.. | .. |
---|
2148 | 2304 | rtnl_set_sk_err(net, RTNLGRP_MPLS_ROUTE, err); |
---|
2149 | 2305 | } |
---|
2150 | 2306 | |
---|
| 2307 | +static int mpls_valid_getroute_req(struct sk_buff *skb, |
---|
| 2308 | + const struct nlmsghdr *nlh, |
---|
| 2309 | + struct nlattr **tb, |
---|
| 2310 | + struct netlink_ext_ack *extack) |
---|
| 2311 | +{ |
---|
| 2312 | + struct rtmsg *rtm; |
---|
| 2313 | + int i, err; |
---|
| 2314 | + |
---|
| 2315 | + if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*rtm))) { |
---|
| 2316 | + NL_SET_ERR_MSG_MOD(extack, |
---|
| 2317 | + "Invalid header for get route request"); |
---|
| 2318 | + return -EINVAL; |
---|
| 2319 | + } |
---|
| 2320 | + |
---|
| 2321 | + if (!netlink_strict_get_check(skb)) |
---|
| 2322 | + return nlmsg_parse_deprecated(nlh, sizeof(*rtm), tb, RTA_MAX, |
---|
| 2323 | + rtm_mpls_policy, extack); |
---|
| 2324 | + |
---|
| 2325 | + rtm = nlmsg_data(nlh); |
---|
| 2326 | + if ((rtm->rtm_dst_len && rtm->rtm_dst_len != 20) || |
---|
| 2327 | + rtm->rtm_src_len || rtm->rtm_tos || rtm->rtm_table || |
---|
| 2328 | + rtm->rtm_protocol || rtm->rtm_scope || rtm->rtm_type) { |
---|
| 2329 | + NL_SET_ERR_MSG_MOD(extack, "Invalid values in header for get route request"); |
---|
| 2330 | + return -EINVAL; |
---|
| 2331 | + } |
---|
| 2332 | + if (rtm->rtm_flags & ~RTM_F_FIB_MATCH) { |
---|
| 2333 | + NL_SET_ERR_MSG_MOD(extack, |
---|
| 2334 | + "Invalid flags for get route request"); |
---|
| 2335 | + return -EINVAL; |
---|
| 2336 | + } |
---|
| 2337 | + |
---|
| 2338 | + err = nlmsg_parse_deprecated_strict(nlh, sizeof(*rtm), tb, RTA_MAX, |
---|
| 2339 | + rtm_mpls_policy, extack); |
---|
| 2340 | + if (err) |
---|
| 2341 | + return err; |
---|
| 2342 | + |
---|
| 2343 | + if ((tb[RTA_DST] || tb[RTA_NEWDST]) && !rtm->rtm_dst_len) { |
---|
| 2344 | + NL_SET_ERR_MSG_MOD(extack, "rtm_dst_len must be 20 for MPLS"); |
---|
| 2345 | + return -EINVAL; |
---|
| 2346 | + } |
---|
| 2347 | + |
---|
| 2348 | + for (i = 0; i <= RTA_MAX; i++) { |
---|
| 2349 | + if (!tb[i]) |
---|
| 2350 | + continue; |
---|
| 2351 | + |
---|
| 2352 | + switch (i) { |
---|
| 2353 | + case RTA_DST: |
---|
| 2354 | + case RTA_NEWDST: |
---|
| 2355 | + break; |
---|
| 2356 | + default: |
---|
| 2357 | + NL_SET_ERR_MSG_MOD(extack, "Unsupported attribute in get route request"); |
---|
| 2358 | + return -EINVAL; |
---|
| 2359 | + } |
---|
| 2360 | + } |
---|
| 2361 | + |
---|
| 2362 | + return 0; |
---|
| 2363 | +} |
---|
| 2364 | + |
---|
2151 | 2365 | static int mpls_getroute(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, |
---|
2152 | 2366 | struct netlink_ext_ack *extack) |
---|
2153 | 2367 | { |
---|
.. | .. |
---|
2167 | 2381 | u8 n_labels; |
---|
2168 | 2382 | int err; |
---|
2169 | 2383 | |
---|
2170 | | - err = nlmsg_parse(in_nlh, sizeof(*rtm), tb, RTA_MAX, |
---|
2171 | | - rtm_mpls_policy, extack); |
---|
| 2384 | + err = mpls_valid_getroute_req(in_skb, in_nlh, tb, extack); |
---|
2172 | 2385 | if (err < 0) |
---|
2173 | 2386 | goto errout; |
---|
2174 | 2387 | |
---|
.. | .. |
---|
2410 | 2623 | } |
---|
2411 | 2624 | |
---|
2412 | 2625 | static int mpls_platform_labels(struct ctl_table *table, int write, |
---|
2413 | | - void __user *buffer, size_t *lenp, loff_t *ppos) |
---|
| 2626 | + void *buffer, size_t *lenp, loff_t *ppos) |
---|
2414 | 2627 | { |
---|
2415 | 2628 | struct net *net = table->data; |
---|
2416 | 2629 | int platform_labels = net->mpls.platform_labels; |
---|
.. | .. |
---|
2420 | 2633 | .data = &platform_labels, |
---|
2421 | 2634 | .maxlen = sizeof(int), |
---|
2422 | 2635 | .mode = table->mode, |
---|
2423 | | - .extra1 = &zero, |
---|
| 2636 | + .extra1 = SYSCTL_ZERO, |
---|
2424 | 2637 | .extra2 = &label_limit, |
---|
2425 | 2638 | }; |
---|
2426 | 2639 | |
---|
.. | .. |
---|
2449 | 2662 | .maxlen = sizeof(int), |
---|
2450 | 2663 | .mode = 0644, |
---|
2451 | 2664 | .proc_handler = proc_dointvec_minmax, |
---|
2452 | | - .extra1 = &zero, |
---|
2453 | | - .extra2 = &one, |
---|
| 2665 | + .extra1 = SYSCTL_ZERO, |
---|
| 2666 | + .extra2 = SYSCTL_ONE, |
---|
2454 | 2667 | }, |
---|
2455 | 2668 | { |
---|
2456 | 2669 | .procname = "default_ttl", |
---|
.. | .. |
---|
2458 | 2671 | .maxlen = sizeof(int), |
---|
2459 | 2672 | .mode = 0644, |
---|
2460 | 2673 | .proc_handler = proc_dointvec_minmax, |
---|
2461 | | - .extra1 = &one, |
---|
| 2674 | + .extra1 = SYSCTL_ONE, |
---|
2462 | 2675 | .extra2 = &ttl_max, |
---|
2463 | 2676 | }, |
---|
2464 | 2677 | { } |
---|