1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

addons: vxlan: add support for vxlan-ttl attribute

New vxlan-ttl attribute: specifies the TTL value to use in outgoing
packets. Valid values: range 1..255 or auto (0)

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
Julien Fortin
2019-01-25 18:06:39 +08:00
parent 5bc963f0ad
commit ec25a08c3a
5 changed files with 57 additions and 9 deletions

View File

@@ -273,7 +273,7 @@ class Netlink(utilsBase):
% (ifacename, vlanid, str(e)))
def link_add_vxlan(self, ifacename, vxlanid, local=None, dstport=VXLAN_UDP_PORT,
group=None, learning=True, ageing=None, physdev=None):
group=None, learning=True, ageing=None, physdev=None, ttl=None):
cmd = 'ip link add %s type vxlan id %s dstport %s' % (ifacename,
vxlanid,
dstport)
@@ -282,6 +282,10 @@ class Netlink(utilsBase):
cmd += ' remote %s' % group if group else ' noremote'
cmd += ' nolearning' if not learning else ''
cmd += ' dev %s' % physdev if physdev else ''
if ttl is not None:
cmd += ' ttl %s' % ttl
self.logger.info('%s: netlink: %s' % (ifacename, cmd))
if ifupdownflags.flags.DRYRUN: return
try:
@@ -294,7 +298,8 @@ class Netlink(utilsBase):
group=group,
learning=learning,
ageing=ageing,
physdev=physdev)
physdev=physdev,
ttl=ttl)
except Exception as e:
raise Exception('netlink: %s: cannot create vxlan %s: %s'
% (ifacename, vxlanid, str(e)))