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

vxlan: fix ttl for single vxlan device

Signed-off-by: Roopa Prabhu <roopa@nvidia.com>
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
Roopa Prabhu
2021-04-13 23:19:12 -07:00
committed by Julien Fortin
parent 6015cce25b
commit 9144496d01
2 changed files with 8 additions and 3 deletions

View File

@ -440,6 +440,7 @@ class vxlan(Addon, moduleBase):
self.logger.info("%s: set vxlan-ttl %s" % (ifname, vxlan_ttl_str if vxlan_ttl_str else vxlan_ttl)) self.logger.info("%s: set vxlan-ttl %s" % (ifname, vxlan_ttl_str if vxlan_ttl_str else vxlan_ttl))
user_request_vxlan_info_data[Link.IFLA_VXLAN_TTL] = vxlan_ttl user_request_vxlan_info_data[Link.IFLA_VXLAN_TTL] = vxlan_ttl
return vxlan_ttl
except Exception: except Exception:
self.log_error("%s: invalid vxlan-ttl '%s'" % (ifname, vxlan_ttl_str), ifaceobj) self.log_error("%s: invalid vxlan-ttl '%s'" % (ifname, vxlan_ttl_str), ifaceobj)
@ -966,7 +967,7 @@ class vxlan(Addon, moduleBase):
self.__config_vxlan_learning(ifaceobj, link_exists, user_request_vxlan_info_data, cached_vxlan_ifla_info_data) self.__config_vxlan_learning(ifaceobj, link_exists, user_request_vxlan_info_data, cached_vxlan_ifla_info_data)
self.__config_vxlan_ageing(ifname, ifaceobj, link_exists, user_request_vxlan_info_data, cached_vxlan_ifla_info_data) self.__config_vxlan_ageing(ifname, ifaceobj, link_exists, user_request_vxlan_info_data, cached_vxlan_ifla_info_data)
self.__config_vxlan_port(ifname, ifaceobj, link_exists, user_request_vxlan_info_data, cached_vxlan_ifla_info_data) self.__config_vxlan_port(ifname, ifaceobj, link_exists, user_request_vxlan_info_data, cached_vxlan_ifla_info_data)
self.__config_vxlan_ttl(ifname, ifaceobj, user_request_vxlan_info_data, cached_vxlan_ifla_info_data) vxlan_ttl = self.__config_vxlan_ttl(ifname, ifaceobj, user_request_vxlan_info_data, cached_vxlan_ifla_info_data)
self.__config_vxlan_tos(ifname, ifaceobj, user_request_vxlan_info_data, cached_vxlan_ifla_info_data) self.__config_vxlan_tos(ifname, ifaceobj, user_request_vxlan_info_data, cached_vxlan_ifla_info_data)
self.__config_vxlan_udp_csum(ifaceobj, link_exists, user_request_vxlan_info_data, cached_vxlan_ifla_info_data) self.__config_vxlan_udp_csum(ifaceobj, link_exists, user_request_vxlan_info_data, cached_vxlan_ifla_info_data)
local = self.__config_vxlan_local_tunnelip(ifname, ifaceobj, link_exists, user_request_vxlan_info_data, cached_vxlan_ifla_info_data) local = self.__config_vxlan_local_tunnelip(ifname, ifaceobj, link_exists, user_request_vxlan_info_data, cached_vxlan_ifla_info_data)
@ -1034,7 +1035,8 @@ class vxlan(Addon, moduleBase):
group.ip if group else None, group.ip if group else None,
vxlan_physdev, vxlan_physdev,
user_request_vxlan_info_data.get(Link.IFLA_VXLAN_PORT), user_request_vxlan_info_data.get(Link.IFLA_VXLAN_PORT),
vxlan_vnifilter vxlan_vnifilter,
vxlan_ttl
) )
else: else:
try: try:

View File

@ -285,7 +285,7 @@ class IPRoute2(Cache, Requirements):
### ###
def link_add_single_vxlan(self, ifname, ip, group, physdev, port, vnifilter="off"): def link_add_single_vxlan(self, ifname, ip, group, physdev, port, vnifilter="off", ttl=None):
self.logger.info("creating single vxlan device: %s" % ifname) self.logger.info("creating single vxlan device: %s" % ifname)
cmd = ["link add dev %s type vxlan external" % ifname] cmd = ["link add dev %s type vxlan external" % ifname]
@ -305,6 +305,9 @@ class IPRoute2(Cache, Requirements):
if port: if port:
cmd.append("dstport %s" % port) cmd.append("dstport %s" % port)
if ttl:
cmd.append("ttl %s" % ttl)
self.__execute_or_batch(utils.ip_cmd, " ".join(cmd)) self.__execute_or_batch(utils.ip_cmd, " ".join(cmd))
self.__update_cache_after_link_creation(ifname, "vxlan") self.__update_cache_after_link_creation(ifname, "vxlan")