Skip to content

Commit

Permalink
mctp: Set route MTU via netlink
Browse files Browse the repository at this point in the history
A route's RTAX_MTU can be set in nested RTAX_METRICS

Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Matt Johnston authored and David S. Miller committed Sep 29, 2021
1 parent f4d41c5 commit 6183569
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion net/mctp/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,10 +1026,15 @@ static int mctp_route_nlparse(struct sk_buff *skb, struct nlmsghdr *nlh,
return 0;
}

static const struct nla_policy rta_metrics_policy[RTAX_MAX + 1] = {
[RTAX_MTU] = { .type = NLA_U32 },
};

static int mctp_newroute(struct sk_buff *skb, struct nlmsghdr *nlh,
struct netlink_ext_ack *extack)
{
struct nlattr *tb[RTA_MAX + 1];
struct nlattr *tbx[RTAX_MAX + 1];
mctp_eid_t daddr_start;
struct mctp_dev *mdev;
struct rtmsg *rtm;
Expand All @@ -1046,8 +1051,15 @@ static int mctp_newroute(struct sk_buff *skb, struct nlmsghdr *nlh,
return -EINVAL;
}

/* TODO: parse mtu from nlparse */
mtu = 0;
if (tb[RTA_METRICS]) {
rc = nla_parse_nested(tbx, RTAX_MAX, tb[RTA_METRICS],
rta_metrics_policy, NULL);
if (rc < 0)
return rc;
if (tbx[RTAX_MTU])
mtu = nla_get_u32(tbx[RTAX_MTU]);
}

if (rtm->rtm_type != RTN_UNICAST)
return -EINVAL;
Expand Down

0 comments on commit 6183569

Please sign in to comment.