Skip to content

Commit 3e7a50c

Browse files
shemmingerdavem330
authored andcommitted
net: report min and max mtu network device settings
Report the minimum and maximum MTU allowed on a device via netlink so that it can be displayed by tools like ip link. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3260155 commit 3e7a50c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/uapi/linux/if_link.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ enum {
164164
IFLA_CARRIER_UP_COUNT,
165165
IFLA_CARRIER_DOWN_COUNT,
166166
IFLA_NEW_IFINDEX,
167+
IFLA_MIN_MTU,
168+
IFLA_MAX_MTU,
167169
__IFLA_MAX
168170
};
169171

net/core/rtnetlink.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,8 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
10151015
+ nla_total_size(4) /* IFLA_IF_NETNSID */
10161016
+ nla_total_size(4) /* IFLA_CARRIER_UP_COUNT */
10171017
+ nla_total_size(4) /* IFLA_CARRIER_DOWN_COUNT */
1018+
+ nla_total_size(4) /* IFLA_MIN_MTU */
1019+
+ nla_total_size(4) /* IFLA_MAX_MTU */
10181020
+ 0;
10191021
}
10201022

@@ -1601,6 +1603,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,
16011603
netif_running(dev) ? dev->operstate : IF_OPER_DOWN) ||
16021604
nla_put_u8(skb, IFLA_LINKMODE, dev->link_mode) ||
16031605
nla_put_u32(skb, IFLA_MTU, dev->mtu) ||
1606+
nla_put_u32(skb, IFLA_MIN_MTU, dev->min_mtu) ||
1607+
nla_put_u32(skb, IFLA_MAX_MTU, dev->max_mtu) ||
16041608
nla_put_u32(skb, IFLA_GROUP, dev->group) ||
16051609
nla_put_u32(skb, IFLA_PROMISCUITY, dev->promiscuity) ||
16061610
nla_put_u32(skb, IFLA_NUM_TX_QUEUES, dev->num_tx_queues) ||
@@ -1732,6 +1736,8 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
17321736
[IFLA_IF_NETNSID] = { .type = NLA_S32 },
17331737
[IFLA_CARRIER_UP_COUNT] = { .type = NLA_U32 },
17341738
[IFLA_CARRIER_DOWN_COUNT] = { .type = NLA_U32 },
1739+
[IFLA_MIN_MTU] = { .type = NLA_U32 },
1740+
[IFLA_MAX_MTU] = { .type = NLA_U32 },
17351741
};
17361742

17371743
static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {

0 commit comments

Comments
 (0)