.. | .. |
---|
632 | 632 | */ |
---|
633 | 633 | void batadv_update_min_mtu(struct net_device *soft_iface) |
---|
634 | 634 | { |
---|
635 | | - soft_iface->mtu = batadv_hardif_min_mtu(soft_iface); |
---|
| 635 | + struct batadv_priv *bat_priv = netdev_priv(soft_iface); |
---|
| 636 | + int limit_mtu; |
---|
| 637 | + int mtu; |
---|
| 638 | + |
---|
| 639 | + mtu = batadv_hardif_min_mtu(soft_iface); |
---|
| 640 | + |
---|
| 641 | + if (bat_priv->mtu_set_by_user) |
---|
| 642 | + limit_mtu = bat_priv->mtu_set_by_user; |
---|
| 643 | + else |
---|
| 644 | + limit_mtu = ETH_DATA_LEN; |
---|
| 645 | + |
---|
| 646 | + mtu = min(mtu, limit_mtu); |
---|
| 647 | + dev_set_mtu(soft_iface, mtu); |
---|
636 | 648 | |
---|
637 | 649 | /* Check if the local translate table should be cleaned up to match a |
---|
638 | 650 | * new (and smaller) MTU. |
---|