User-configurable physical MTU for individual links

This patch allows users to specify the physical layer MTU for individual links
when in multipath mode. For example:

{
  "settings":
  {
    "defaultBondingPolicy": "custom-balance-xor",
    "policies":
    {
      "custom-balance-xor":
      {
        "basePolicy": "balance-xor",
        "failoverInterval": 5000,
        "links": {
          "weird_5g_link": { "mtu": 1300 },
          "enp5s0": { "mtu": 1400  }
        }
      }
    }
  }
}
This commit is contained in:
Joseph Henry 2023-01-11 20:12:15 -08:00 committed by Sean OMeara
parent eccc31a4b9
commit 39f3f5b2d9
6 changed files with 36 additions and 7 deletions

View file

@ -122,9 +122,10 @@ class Link {
* @param mode
* @param failoverToLinkStr
*/
Link(std::string ifnameStr, uint8_t ipvPref, uint32_t capacity, bool enabled, uint8_t mode, std::string failoverToLinkStr)
Link(std::string ifnameStr, uint8_t ipvPref, uint16_t mtu, uint32_t capacity, bool enabled, uint8_t mode, std::string failoverToLinkStr)
: _ifnameStr(ifnameStr)
, _ipvPref(ipvPref)
, _mtu(mtu)
, _capacity(capacity)
, _relativeCapacity(0.0)
, _enabled(enabled)
@ -226,6 +227,14 @@ class Link {
return _ipvPref;
}
/**
* @return The MTU for this link (as specified by the user.)
*/
inline uint16_t mtu()
{
return _mtu;
}
/**
* @return The mode (e.g. primary/spare) for this link (as specified by the user.)
*/
@ -260,6 +269,11 @@ class Link {
*/
uint8_t _ipvPref;
/**
* The physical-layer MTU for this link
*/
uint16_t _mtu;
/**
* User-specified capacity of this link
*/