nexthop.c (dc5e0141ff19439bfe8d54fce6d6b834bdf1efe0) nexthop.c (262a68aa46f88d9b42f1569f893d53f71ddf7e52)
1// SPDX-License-Identifier: GPL-2.0
2/* Generic nexthop implementation
3 *
4 * Copyright (c) 2017-19 Cumulus Networks
5 * Copyright (c) 2017-19 David Ahern <dsa@cumulusnetworks.com>
6 */
7
8#include <linux/nexthop.h>

--- 3384 unchanged lines hidden (view full) ---

3393 filter->fdb_filter = nla_get_flag(tb[NHA_FDB]);
3394
3395 nhm = nlmsg_data(nlh);
3396 if (nhm->nh_protocol || nhm->resvd || nhm->nh_scope || nhm->nh_flags) {
3397 NL_SET_ERR_MSG(extack, "Invalid values in header for nexthop dump request");
3398 return -EINVAL;
3399 }
3400
1// SPDX-License-Identifier: GPL-2.0
2/* Generic nexthop implementation
3 *
4 * Copyright (c) 2017-19 Cumulus Networks
5 * Copyright (c) 2017-19 David Ahern <dsa@cumulusnetworks.com>
6 */
7
8#include <linux/nexthop.h>

--- 3384 unchanged lines hidden (view full) ---

3393 filter->fdb_filter = nla_get_flag(tb[NHA_FDB]);
3394
3395 nhm = nlmsg_data(nlh);
3396 if (nhm->nh_protocol || nhm->resvd || nhm->nh_scope || nhm->nh_flags) {
3397 NL_SET_ERR_MSG(extack, "Invalid values in header for nexthop dump request");
3398 return -EINVAL;
3399 }
3400
3401 if (tb[NHA_OP_FLAGS])
3402 filter->op_flags = nla_get_u32(tb[NHA_OP_FLAGS]);
3403 else
3404 filter->op_flags = 0;
3405
3406 return 0;
3407}
3408
3409static int nh_valid_dump_req(const struct nlmsghdr *nlh,
3410 struct nh_dump_filter *filter,
3411 struct netlink_callback *cb)
3412{
3413 struct nlattr *tb[NHA_MAX + 1];
3414 int err;
3415
3416 err = nlmsg_parse(nlh, sizeof(struct nhmsg), tb, NHA_MAX,
3417 rtm_nh_policy_dump, cb->extack);
3418 if (err < 0)
3419 return err;
3420
3401 return 0;
3402}
3403
3404static int nh_valid_dump_req(const struct nlmsghdr *nlh,
3405 struct nh_dump_filter *filter,
3406 struct netlink_callback *cb)
3407{
3408 struct nlattr *tb[NHA_MAX + 1];
3409 int err;
3410
3411 err = nlmsg_parse(nlh, sizeof(struct nhmsg), tb, NHA_MAX,
3412 rtm_nh_policy_dump, cb->extack);
3413 if (err < 0)
3414 return err;
3415
3416 if (tb[NHA_OP_FLAGS])
3417 filter->op_flags = nla_get_u32(tb[NHA_OP_FLAGS]);
3418 else
3419 filter->op_flags = 0;
3420
3421 return __nh_valid_dump_req(nlh, tb, filter, cb->extack);
3422}
3423
3424struct rtm_dump_nh_ctx {
3425 u32 idx;
3426};
3427
3428static struct rtm_dump_nh_ctx *

--- 617 unchanged lines hidden ---
3421 return __nh_valid_dump_req(nlh, tb, filter, cb->extack);
3422}
3423
3424struct rtm_dump_nh_ctx {
3425 u32 idx;
3426};
3427
3428static struct rtm_dump_nh_ctx *

--- 617 unchanged lines hidden ---