[pve-devel] [PATCH V3 ifupdown2 2/3] add debian dir

Alexandre Derumier aderumier at odiso.com
Fri Jun 15 01:52:02 CEST 2018


---
 Makefile                                           |   2 +-
 debian/changelog                                   | 185 +++++++++++++++++++++
 debian/compat                                      |   1 +
 debian/control                                     |  36 ++++
 debian/copyright                                   |  28 ++++
 ...ns-scripts-fix-ENV-for-interfaces-options.patch |  29 ++++
 ...2-netlink-IFLA_BRPORT_ARP_SUPPRESS-use-32.patch |  30 ++++
 .../extra/0003-add-vxlan-physdev-support.patch     | 162 ++++++++++++++++++
 debian/patches/pve/0001-config-tuning.patch        |  52 ++++++
 .../pve/0002-manual-interfaces-set-link-up.patch   |  58 +++++++
 ...e-tap-veth-fwpr-interfaces-from-bridge-on.patch |  27 +++
 ...0004-add-dummy-mtu-bridgevlanport-modules.patch |  85 ++++++++++
 debian/patches/series                              |   7 +
 debian/rules                                       |  21 +++
 14 files changed, 722 insertions(+), 1 deletion(-)
 create mode 100644 debian/changelog
 create mode 100644 debian/compat
 create mode 100644 debian/control
 create mode 100644 debian/copyright
 create mode 100644 debian/patches/extra/0001-addons-scripts-fix-ENV-for-interfaces-options.patch
 create mode 100644 debian/patches/extra/0002-netlink-IFLA_BRPORT_ARP_SUPPRESS-use-32.patch
 create mode 100644 debian/patches/extra/0003-add-vxlan-physdev-support.patch
 create mode 100644 debian/patches/pve/0001-config-tuning.patch
 create mode 100644 debian/patches/pve/0002-manual-interfaces-set-link-up.patch
 create mode 100644 debian/patches/pve/0003-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
 create mode 100644 debian/patches/pve/0004-add-dummy-mtu-bridgevlanport-modules.patch
 create mode 100644 debian/patches/series
 create mode 100755 debian/rules

diff --git a/Makefile b/Makefile
index 142b44e..395ebae 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 PACKAGE=ifupdown2
 VER=1.1
-PKGREL=cl3u18
+PKGREL=2.0
 
 SRCDIR=ifupdown2
 BUILDDIR=${SRCDIR}.tmp
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..772b13c
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,185 @@
+ifupdown2 (2.0.0) UNRELEASED; urgency=medium
+
+  * Package architecture refactoring and cleanups
+  * Package can be build/install as debian, pip or rpm package
+  * Makefile to easily perform tasks (i.e.: install, build, test, upload..)
+  * New. Enabled: traditional bridge support for mstpctl attributes
+    (portautoedge, portrestrrole)
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Thu, 24 May 2018 15:42:42 +0200
+
+ifupdown2 (1.1.18) RELEASED; urgency=medium
+
+  * Fix: Link down does not work on SVI configured in a VRF
+  * Fix: ifreload causes MTU to drop on bridge SVIs
+  * Fix: addons: addressvirtual: check if SVI name is first in routing table
+  * Fix: ifreload error on deleting bond slaves from an already configured bond
+  * Fix: ifupdown2 error is confusing when netmask is specified for vxlan-local-tunnelip
+  * Fix: ifupdown2 syntax check needed for vxlan interfaces
+  * Fix: vxlan-ageing default timer doesn't align with bridge-ageing
+  * Fix: Error with "ifreload -a -n" when MGMT VRF is not Applied
+  * Fix: using reserved VLAN range reports error but ifreload returns 0
+  * Fix: unable to set bridge-portmcrouter to "2"
+  * Fix: vxlan syntax-check warn on missing vxlan-local-tunnelip
+  * Fix: traditional bridge svi breaks when extra bridge added
+  * Fix: github #39: addons: vrf: fix vrf slave link kind
+  * New. Enabled: addons: vxlan: add support for vxlan-port attribute
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Thu, 12 Apr 2018 11:10:04 +0200
+
+ifupdown2 (1.1.17) RELEASED; urgency=medium
+
+  * Fix: ip[6]-forward attributes not set at boot
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Thu, 08 Feb 2018 09:48:37 +0100
+
+ifupdown2 (1.1.16) RELEASED; urgency=medium
+
+  * Fix: python exception on macvlans address dump
+  * Fix: eth0 doesn't acquire DHCP address when mgmt VRF is enabled
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Tue, 09 Jan 2018 02:02:58 +0100
+
+ifupdown2 (1.1.15) RELEASED; urgency=medium
+
+  * New. Enabled: bridge: add support for bridge-l2protocol-tunnel
+  * New. Enabled: bridge attributes, when removed reset to default
+  * New. Enabled: vxlan attributes, when removed reset to default
+  * New. Enabled: improve handling of optional resources (if missing bridge-utils/ethtool)
+  * Fix: policy "iface_defaults" not supported for MTU
+  * Fix: address module: handling of ipv4 & ipv6 (add/remove)
+  * Fix: warning for vlan reserved range
+  * Fix: MTU handling on bridge SVIs
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Wed, 22 Nov 2017 19:07:43 +0100
+
+ifupdown2 (1.1.14) RELEASED; urgency=medium
+
+  * New. Enabled: default policy for bridge MAC address
+  * Fix: ethtool: don't set link speed and duplex if autoneg is on
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Wed, 25 Oct 2017 23:12:27 +0200
+
+ifupdown2 (1.1.13) RELEASED; urgency=medium
+
+  * Fix: VRF: ssh session not killed on ifreload
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Fri, 15 Sep 2017 22:43:12 +0200
+
+ifupdown2 (1.1.12) RELEASED; urgency=medium
+
+  * New. Enabled: mpls-enable attribute
+  * New. Enabled: bond and bridge module moved to netlink configuration
+  * New. Enabled: handle a mix of auto and specified vrf table ids
+  * Fix: igmp attribute reset to defaults when removed from config
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Mon, 07 Aug 2017 22:14:03 +0200
+
+ifupdown2 (1.1.11) RELEASED; urgency=medium
+
+  * Fix: link-down attribute not applied on slave ports
+  * Fix: bug that prevented config of mtu below 1280
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Thu, 18 May 2017 12:45:21 -0700
+
+ifupdown2 (1.1.10) RELEASED; urgency=medium
+
+  * New. Enabled: drop the dependency to pkg_resources, hardcode version number (closes: #855401)
+  * New. Enabled: adjust allow-hotplug behavior to ifupdown (closes: #855598)
+  * New. Enabled: bond-lacp-rate support slow/fast argument
+  * New. Enabled: ifquery --syntax-help: add support for json output
+  * New. Enabled: vlan: add new attribute 'vlan-protocol'
+  * New. Enabled: address: add new attribute 'ip6-forward'
+  * New. Enabled: bridge: add new attribute 'bridge-mcstats'
+  * New. Enabled: bridge: add new attribute 'bridge-vlan-stats'
+  * New. Enabled: bridge: add new attribute 'bridge-vlan-protocol'
+  * New. Enabled: bridge: add new attribute 'bridge-arp-nd-suppress'
+  * Fix: bond: add attribute bond-(up|down)delay
+  * Fix: bridge-vids: --syntax-check accepts legacy syntax
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Mon, 17 Apr 2017 06:18:04 +0200
+
+ifupdown2 (1.1.9) RELEASED; urgency=medium
+
+  * New. Enabled: support for bridge-learning attribute
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Mon, 06 Feb 2017 13:22:51 -0800
+
+ifupdown2 (1.1.8) RELEASED; urgency=medium
+
+  * New. Enabled: update link-speed values: add 25G and 50G
+  * New. Enabled: new 'link-down' [yes|no] attribute to keep link down
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Tue, 17 Jan 2017 08:39:29 +0100
+
+ifupdown2 (1.1.7) RELEASED; urgency=medium
+
+  * New. Enabled: fix for inet and inet6 dhcp on the same interface
+  * New. Enabled: syntax check to warn on common configuration mistakes
+  * New. Enabled: addons: bridge: disable ip fwding on a bridge with no ip
+    and no upperifaces
+  * Fix: fixes for MTU handling
+  * Fix: dhcpv6 fails if interface doesn't have link-local addr
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Wed, 07 Dec 2016 05:48:45 +0100
+
+ifupdown2 (1.1.6) RELEASED; urgency=medium
+
+  * Closes: github #14. add environment variables passed to user scripts
+  * New. Enabled: addons may provide a list of ifupdown scripts to ignore
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Mon, 19 Sep 2016 16:37:36 -0700
+
+ifupdown2 (1.1.5) RELEASED; urgency=medium
+
+  * Fix: handling of EXISTS errors on address add
+  * Fix: handling of mtu on addressvirtual macvlan devices
+  * Fix: mako namespace handling
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Fri, 16 Sep 2016 12:48:04 -0700
+
+ifupdown2 (1.1.4) RELEASED; urgency=medium
+
+  * Performance improvements
+  * New. Enabled: sbin: start-networking: support hotplug class from init script
+  * New. Enabled: support for classical numerical bond modes
+  * New. Enabled: extend ifquery support for mstpctl addons
+  * New. Enabled: each addon may perform semantic and syntax checks by
+    implementing a custom method
+  * Fix: Support for address-virtual lines under a vrf slave
+  * Fix: Defaults for link attributes were not applied
+  * Fix: Disable IPv6 duplicate address detection on VRR interfaces
+  * Fix: ifquery to extract vlan-id from iface if not preset
+  * Fix: ifquery -c bridge pvid error on a valid config
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Fri, 29 Jul 2016 08:55:50 -0700
+
+ifupdown2 (1.1.3) RELEASED; urgency=medium
+
+  * Fix: Interface configuration parsing error when keyword vlan
+    is the interface name.
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Sun, 05 Jun 2016 08:55:50 -0700
+
+ifupdown2 (1.1.2) RELEASED; urgency=medium
+
+  * Fix: checks for invalid address-virtual attributes
+  * New. Deprecated: `mstpctl-stp` attribute
+  * New. Deprecated: lacp parameters: bond-ad-sys-priority, bond-ad-sys-mac-addr
+  * New. Enabled: addon module for configuring vrf
+  * New. Enabled: bridge: display warning when (in vlan unware bridge)
+    an untagged bridge is not configured
+  * New. Enabled: adjusting MTU for vlan devices depending on lower device mtu
+  * New. Enabled: introduce checks for reserved vrf table names
+  * New. Enabled: ifquery: new option '--with-defaults' to include default
+    attributes
+  * New. Enabled: bridge: disabling ipv6 on bridge if any VXLAN port
+  * New. Enabled: vrf awareness in dhcp addon module
+
+ -- Julien Fortin <julien at cumulusnetworks.com>  Tue, 3 May 2016 14:42:42 -0700
+
+ifupdown2 (1.1.0) unstable; urgency=low
+
+  * Initial release.
+
+ -- Roopa Prabhu <roopa at cumulusnetworks.com>  Thu, 20 Aug 2015 06:14:24 -0700
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..a6178e4
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,36 @@
+Source: ifupdown2
+Section: admin
+Priority: optional
+Maintainer: Julien Fortin <julien at cumulusnetworks.com>
+Build-Depends: debhelper (>=9),
+               dh-systemd,
+               dh-python,
+               python-all,
+               python-setuptools,
+               python-docutils
+Standards-Version: 3.9.8
+Homepage: https://github.com/cumulusnetworks/ifupdown2
+X-Python-Version: >= 2.7
+
+Package: ifupdown2
+Architecture: all
+Provides: ifupdown
+Conflicts: ifupdown
+Replaces: ifupdown
+Depends: ${python:Depends}, ${misc:Depends}, iproute2, python-argcomplete, python-ipaddr
+Suggests: isc-dhcp-client, bridge-utils, ethtool, python-gvgen, python-mako
+Description: Network Interface Management tool similar to ifupdown
+ ifupdown2 is ifupdown re-written in Python. It replaces ifupdown and provides
+ the same user interface as ifupdown for network interface configuration.
+ Like ifupdown, ifupdown2 is a high level tool to configure (or, respectively
+ deconfigure) network interfaces based on interface definitions in
+ /etc/network/interfaces. It is capable of detecting network interface
+ dependencies and comes with several new features which are available as
+ new command options to ifup/ifdown/ifquery commands. It also comes with a new
+ command ifreload to reload interface configuration with minimum
+ disruption. Most commands are also capable of input and output in JSON format.
+ It is backward compatible with ifupdown /etc/network/interfaces format and
+ supports newer simplified format. It also supports interface templates with
+ python-mako for large scale interface deployments. See
+ /usr/share/doc/ifupdown2/README.rst for details about ifupdown2. Examples
+ are available under /usr/share/doc/ifupdown2/examples.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..51d5604
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,28 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: ifupdown2
+Upstream-Contact: Julien Fortin <julien at cumulusnetworks.com>
+Source: https://github.com/cumulusnetworks/ifupdown2
+
+Files: *
+Copyright: 2014,2015,2016,2017,2018 Cumulus Networks, Inc.
+License: GPL-2
+
+Files: debian/*
+Copyright: 2014,2015,2016,2017,2018 Cumulus Networks, Inc.
+License: GPL-2
+
+License: GPL-2
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
diff --git a/debian/patches/extra/0001-addons-scripts-fix-ENV-for-interfaces-options.patch b/debian/patches/extra/0001-addons-scripts-fix-ENV-for-interfaces-options.patch
new file mode 100644
index 0000000..2d42b7a
--- /dev/null
+++ b/debian/patches/extra/0001-addons-scripts-fix-ENV-for-interfaces-options.patch
@@ -0,0 +1,29 @@
+From 9c3dcc88df68adc1acda3faa2118917b038574c5 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Mon, 14 May 2018 16:27:22 +0200
+Subject: [PATCH 2/4] addons scripts : fix ENV for interfaces options
+
+This is a bug currently, where env vars with interfaces options
+were not reset between interfaces
+
+https://github.com/CumulusNetworks/ifupdown2/issues/49
+---
+ ifupdown2/ifupdown/ifupdownmain.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ifupdown2/ifupdown/ifupdownmain.py b/ifupdown2/ifupdown/ifupdownmain.py
+index 3c72429..e818880 100644
+--- a/ifupdown2/ifupdown/ifupdownmain.py
++++ b/ifupdown2/ifupdown/ifupdownmain.py
+@@ -1556,7 +1556,7 @@ class ifupdownMain(ifupdownBase):
+         cenv = None
+         iface_env = ifaceobj.get_env()
+         if iface_env:
+-            cenv = os.environ
++            cenv = dict(os.environ)
+             if cenv:
+                 cenv.update(iface_env)
+             else:
+-- 
+2.11.0
+
diff --git a/debian/patches/extra/0002-netlink-IFLA_BRPORT_ARP_SUPPRESS-use-32.patch b/debian/patches/extra/0002-netlink-IFLA_BRPORT_ARP_SUPPRESS-use-32.patch
new file mode 100644
index 0000000..90f737b
--- /dev/null
+++ b/debian/patches/extra/0002-netlink-IFLA_BRPORT_ARP_SUPPRESS-use-32.patch
@@ -0,0 +1,30 @@
+From 8fc842ad6a75fe0af3a2b8d4937b16e3967fca3c Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Wed, 16 May 2018 02:16:42 +0200
+Subject: [PATCH] netlink : IFLA_BRPORT_ARP_SUPPRESS : use 32
+
+this has been upstreamed recently in linux kernel, with IFLA_BRPORT_NEIGH_SUPPRESS.
+cumulus was using a temp 152 number.
+It's need for vxlan + anycast gateway
+---
+ ifupdown2/nlmanager/nlpacket.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ifupdown2/nlmanager/nlpacket.py b/ifupdown2/nlmanager/nlpacket.py
+index bd6addf..358c06c 100644
+--- a/ifupdown2/nlmanager/nlpacket.py
++++ b/ifupdown2/nlmanager/nlpacket.py
+@@ -3247,9 +3247,9 @@ class Link(NetlinkPacket):
+     IFLA_BRPORT_VLAN_TUNNEL         = 29
+     IFLA_BRPORT_BCAST_FLOOD         = 30
+     IFLA_BRPORT_GROUP_FWD_MASK      = 31
++    IFLA_BRPORT_ARP_SUPPRESS        = 32
+     IFLA_BRPORT_PEER_LINK           = 150
+     IFLA_BRPORT_DUAL_LINK           = 151
+-    IFLA_BRPORT_ARP_SUPPRESS        = 152
+     IFLA_BRPORT_GROUP_FWD_MASKHI    = 153
+ 
+     ifla_brport_to_string = {
+-- 
+2.11.0
+
diff --git a/debian/patches/extra/0003-add-vxlan-physdev-support.patch b/debian/patches/extra/0003-add-vxlan-physdev-support.patch
new file mode 100644
index 0000000..337dfd7
--- /dev/null
+++ b/debian/patches/extra/0003-add-vxlan-physdev-support.patch
@@ -0,0 +1,162 @@
+From 813b7bc0da9f4c9df65936d10aa9dc18d857d0a5 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Wed, 16 May 2018 09:58:45 +0200
+Subject: [PATCH] add vxlan-physdev support
+
+backported from master branch
+https://github.com/CumulusNetworks/ifupdown2/pull/19
+---
+ ifupdown2/addons/vxlan.py | 19 ++++++++++++++++++-
+ ifupdown2/ifupdown/netlink.py         |  8 ++++++--
+ ifupdown2/ifupdownaddons/LinkUtils.py |  5 ++++-
+ ifupdown2/nlmanager/nlmanager.py      |  4 +++-
+
+ 4 files changed, 31 insertions(+), 5 deletions(-)
+
+diff --git a/ifupdown2/addons/vxlan.py b/ifupdown2/addons/vxlan.py
+index 3148e44..2aedbfc 100644
+--- a/ifupdown2/addons/vxlan.py
++++ b/ifupdown2/addons/vxlan.py
+@@ -54,6 +54,9 @@ class vxlan(moduleBase):
+                              'validvals' : ['<ipv4>'],
+                              'example': ['vxlan-remoteip 172.16.22.127'],
+                              'multiline': True},
++                        'vxlan-physdev' :
++                            {'help' : 'vxlan physical device',
++                             'example': ['vxlan-physdev eth1']},
+                         'vxlan-learning' :
+                             {'help' : 'vxlan learning yes/no',
+                              'validvals' : ['yes', 'no', 'on', 'off'],
+@@ -123,6 +126,13 @@ class vxlan(moduleBase):
+                 vxlan._clagd_vxlan_anycast_ip = clagd_vxlan_list[0]
+ 
+             self._set_global_local_ip(ifaceobj)
++
++        # If we should use a specific underlay device for the VXLAN
++        # tunnel make sure this device is set up before the VXLAN iface.
++        physdev = ifaceobj.get_attr_value_first('vxlan-physdev')
++        if physdev:
++            return [ physdev ]
++
+         return None
+ 
+     def _set_global_local_ip(self, ifaceobj):
+@@ -184,6 +194,7 @@ class vxlan(moduleBase):
+             self.syntax_check_localip_anycastip_equal(ifname, local, anycastip)
+             # if both local-ip and anycast-ip are identical the function prints a warning
+ 
++            physdev = ifaceobj.get_attr_value_first('vxlan-physdev')
+             ageing = ifaceobj.get_attr_value_first('vxlan-ageing')
+             vxlan_port = ifaceobj.get_attr_value_first('vxlan-port')
+             purge_remotes = self._get_purge_remotes(ifaceobj)
+@@ -291,7 +302,8 @@ class vxlan(moduleBase):
+                                            learning=learning,
+                                            ageing=ageing,
+                                            group=group,
+-                                           dstport=vxlan_port)
++                                           dstport=vxlan_port,
++                                           physdev=physdev)
+                 except Exception as e_netlink:
+                     self.logger.debug('%s: vxlan netlink: %s' % (ifname, str(e_netlink)))
+                     try:
+@@ -463,6 +475,11 @@ class vxlan(moduleBase):
+         self._query_check_n_update(ifaceobj, ifaceobjcurr, 'vxlan-ageing',
+                        ageing, vxlanattrs.get('ageing'))
+ 
++        physdev = ifaceobj.get_attr_value_first('vxlan-physdev')
++        if physdev:
++            self._query_check_n_update(ifaceobj, ifaceobjcurr, 'vxlan-physdev',
++                           physdev, vxlanattrs.get('physdev'))
++
+     def _query_running(self, ifaceobjrunning):
+         vxlanattrs = self.ipcmd.get_vxlandev_attrs(ifaceobjrunning.name)
+         if not vxlanattrs:
+diff --git a/ifupdown2/ifupdown/netlink.py b/ifupdown2/ifupdown/netlink.py
+index 17672c2..516d39c 100644
+--- a/ifupdown2/ifupdown/netlink.py
++++ b/ifupdown2/ifupdown/netlink.py
+@@ -252,7 +252,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):
++                       group=None, learning=True, ageing=None, physdev=None):
+         cmd = 'ip link add %s type vxlan id %s dstport %s' % (ifacename,
+                                                               vxlanid,
+                                                               dstport)
+@@ -260,16 +260,20 @@ class Netlink(utilsBase):
+         cmd += ' ageing %s' % ageing if ageing else ''
+         cmd += ' remote %s' % group if group else ' noremote'
+         cmd += ' nolearning' if not learning else ''
++        cmd += ' dev %s' % physdev if physdev else ''
+         self.logger.info('%s: netlink: %s' % (ifacename, cmd))
+         if ifupdownflags.flags.DRYRUN: return
+         try:
++            if physdev:
++                physdev = self.get_iface_index (physdev)
+             return self._nlmanager_api.link_add_vxlan(ifacename,
+                                                       vxlanid,
+                                                       dstport=dstport,
+                                                       local=local,
+                                                       group=group,
+                                                       learning=learning,
+-                                                      ageing=ageing)
++                                                      ageing=ageing,
++                                                      physdev=physdev)
+         except Exception as e:
+             raise Exception('netlink: %s: cannot create vxlan %s: %s'
+                             % (ifacename, vxlanid, str(e)))
+
+diff --git a/ifupdown2/ifupdownaddons/LinkUtils.py b/ifupdown2/ifupdownaddons/LinkUtils.py
+index ae541e9..8605704 100644
+--- a/ifupdown2/ifupdownaddons/LinkUtils.py
++++ b/ifupdown2/ifupdownaddons/LinkUtils.py
+@@ -507,18 +507,21 @@ class LinkUtils(utilsBase):
+                         linkattrs['kind'] = 'vxlan'
+                         vattrs = {'vxlanid': citems[i + 2],
+                                   'svcnode': None,
++                                 'physdev': None,
+                                   'remote': [],
+                                   'ageing': citems[i + 2],
+                                   'learning': 'on'}
+                         for j in range(i + 2, len(citems)):
+                             if citems[j] == 'local':
+                                 vattrs['local'] = citems[j + 1]
+-                            elif citems[j] == 'remote':
++                            elif citems[j] == 'group':
+                                 vattrs['svcnode'] = citems[j + 1]
+                             elif citems[j] == 'ageing':
+                                 vattrs['ageing'] = citems[j + 1]
+                             elif citems[j] == 'nolearning':
+                                 vattrs['learning'] = 'off'
++                            elif citems[j] == 'dev':
++                                vattrs['physdev'] = citems[j + 1]
+                         linkattrs['linkinfo'] = vattrs
+                         break
+                     elif citems[i] == 'vrf' and citems[i + 1] == 'table':
+diff --git a/ifupdown2/nlmanager/nlmanager.py b/ifupdown2/nlmanager/nlmanager.py
+index e4a5892..14f7066 100644
+--- a/ifupdown2/nlmanager/nlmanager.py
++++ b/ifupdown2/nlmanager/nlmanager.py
+@@ -969,7 +969,7 @@ class NetlinkManager(object):
+         return self.tx_nlpacket_get_response(nbr)
+
+     def link_add_vxlan(self, ifname, vxlanid, dstport=None, local=None,
+-                       group=None, learning=True, ageing=None):
++                       group=None, learning=True, ageing=None, physdev=None):
+
+         debug = RTM_NEWLINK in self.debug
+
+@@ -980,6 +980,8 @@ class NetlinkManager(object):
+             info_data[Link.IFLA_VXLAN_LOCAL] = local
+         if group:
+             info_data[Link.IFLA_VXLAN_GROUP] = group
++        if physdev:
++            info_data[Link.IFLA_VXLAN_LINK] = int (physdev)
+
+         info_data[Link.IFLA_VXLAN_LEARNING] = int(learning)
+
+
+-- 
+2.11.0
+
diff --git a/debian/patches/pve/0001-config-tuning.patch b/debian/patches/pve/0001-config-tuning.patch
new file mode 100644
index 0000000..f0e72fb
--- /dev/null
+++ b/debian/patches/pve/0001-config-tuning.patch
@@ -0,0 +1,52 @@
+From 849e8213baa8483604a0de6a59695fd3dd98b248 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Mon, 14 May 2018 16:36:58 +0200
+Subject: [PATCH 3/4] config tuning
+
+allow ovs_... options:
+ addon_syntax_check=0
+
+allow custom addons scripts:
+ addon_scripts_support=1
+
+ multiple_vlan_aware_bridge_support=1
+
+don't shutdown tap, veth, vmbrvX, fwbr on reload
+(as they are not defined in /etc/network/interfaces)
+
+ ifreload_down_changed=1
+---
+ etc/network/ifupdown2/ifupdown2.conf | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/etc/network/ifupdown2/ifupdown2.conf b/etc/network/ifupdown2/ifupdown2.conf
+index 906fdea..aa7f120 100644
+--- a/etc/network/ifupdown2/ifupdown2.conf
++++ b/etc/network/ifupdown2/ifupdown2.conf
+@@ -29,12 +29,12 @@ disable_cli_interfacesfile=0
+ # are used. But when a mix of scripts and modules are used (which is the
+ # default case), you may get false warnings for attributes supported
+ # by scripts
+-addon_syntax_check=1
++addon_syntax_check=0
+ 
+ # Support executing of ifupdown style scripts.
+ # Note that by default python addon modules override scripts with the same
+ # name
+-addon_scripts_support=0
++addon_scripts_support=1
+ 
+ # enable python addons
+ addon_python_modules_support=1
+@@ -42,7 +42,7 @@ addon_python_modules_support=1
+ # By default ifupdown2 only supports a single vlan filtering bridge
+ # on the system. Set this flag to 1 to support multiple vlan
+ # filtering bridges
+-multiple_vlan_aware_bridge_support=0
++multiple_vlan_aware_bridge_support=1
+ 
+ # ifquery check status strings.
+ # By default `ifquery --check` prints the check and
+-- 
+2.11.0
+
diff --git a/debian/patches/pve/0002-manual-interfaces-set-link-up.patch b/debian/patches/pve/0002-manual-interfaces-set-link-up.patch
new file mode 100644
index 0000000..b61f3c9
--- /dev/null
+++ b/debian/patches/pve/0002-manual-interfaces-set-link-up.patch
@@ -0,0 +1,58 @@
+From 8ae199ef085b051038427f47fba0c719deda4a30 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Mon, 14 May 2018 17:06:52 +0200
+Subject: [PATCH] manual interfaces : set link up
+
+by default ifdown2 don't set link up for manual interfaces.
+
+classic ifupdown set link up for manual interfaces.
+I think this has change with jessie and systemd.
+
+https://github.com/CumulusNetworks/ifupdown2/issues/4
+---
+ ifupdown2/ifupdown/ifupdownmain.py | 15 +--------------
+ 1 file changed, 1 insertion(+), 14 deletions(-)
+
+diff --git a/ifupdown2/ifupdown/ifupdownmain.py b/ifupdown2/ifupdown/ifupdownmain.py
+index 3c72429..f1cd2fd 100644
+--- a/ifupdown2/ifupdown/ifupdownmain.py
++++ b/ifupdown2/ifupdown/ifupdownmain.py
+@@ -90,11 +90,6 @@ class ifupdownMain(ifupdownBase):
+             (ifaceobj.link_privflags & ifaceLinkPrivFlags.VRF_SLAVE)):
+             self._keep_link_down(ifaceobj)
+             return
+-        # if not a logical interface and addr method is manual,
+-        # ignore link admin state changes
+-        if (ifaceobj.addr_method == 'manual' and
+-            not ifaceobj.link_kind):
+-            return
+         if self._delay_admin_state:
+             self._delay_admin_state_iface_queue.append(ifaceobj.name)
+             return
+@@ -127,11 +122,6 @@ class ifupdownMain(ifupdownBase):
+         # there is no real interface behind it
+         if ifaceobj.type == ifaceType.BRIDGE_VLAN:
+             return
+-        # if not a logical interface and addr method is manual,
+-        # ignore link admin state changes
+-        if (ifaceobj.addr_method == 'manual' and
+-            not ifaceobj.link_kind):
+-            return
+         if self._delay_admin_state:
+             self._delay_admin_state_iface_queue.append(ifaceobj.name)
+             return
+@@ -520,10 +510,7 @@ class ifupdownMain(ifupdownBase):
+     def _set_iface_role_n_kind(self, ifaceobj, upperifaceobj):
+ 
+         # If addr_method is set and link is not a logical interface,
+-        # set flag KEEP_LINK_DOWN. addr_method == 'manual' only applies to
+-        # logical interfaces.
+-        if (ifaceobj.addr_method == 'manual' and not ifaceobj.link_kind):
+-            ifaceobj.link_privflags |= ifaceLinkPrivFlags.KEEP_LINK_DOWN
++        # set flag KEEP_LINK_DOWN. 
+ 
+         if (upperifaceobj.link_kind & ifaceLinkKind.BOND):
+             self._set_iface_role(ifaceobj, ifaceRole.SLAVE, upperifaceobj)
+-- 
+2.11.0
+
diff --git a/debian/patches/pve/0003-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch b/debian/patches/pve/0003-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
new file mode 100644
index 0000000..7ded409
--- /dev/null
+++ b/debian/patches/pve/0003-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
@@ -0,0 +1,27 @@
+From fc168d1897cefd4781722af58f856b2686074d0d Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Wed, 16 May 2018 02:11:45 +0200
+Subject: [PATCH] don't remove (tap|veth|fwpr) interfaces from bridge on ifup
+ bridge
+
+as proxmox don't defined them in /etc/network/interfaces
+---
+ ifupdown2/addons/bridge.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ifupdown2/addons/bridge.py b/ifupdown2/addons/bridge.py
+index 7c582e9..e294c95 100644
+--- a/ifupdown2/addons/bridge.py
++++ b/ifupdown2/addons/bridge.py
+@@ -944,7 +944,7 @@ class bridge(moduleBase):
+             runningbridgeports = self.brctlcmd.get_bridge_ports(ifaceobj.name)
+             if runningbridgeports:
+                 for bport in runningbridgeports:
+-                    if not bridgeports or bport not in bridgeports:
++                    if ( not bridgeports or bport not in bridgeports ) and not re.match('^(tap|veth|fwpr)',bport):
+                         self.ipcmd.link_set(bport, 'nomaster')
+                         # set admin DOWN on all removed ports
+                         # that don't have config outside bridge
+-- 
+2.11.0
+
diff --git a/debian/patches/pve/0004-add-dummy-mtu-bridgevlanport-modules.patch b/debian/patches/pve/0004-add-dummy-mtu-bridgevlanport-modules.patch
new file mode 100644
index 0000000..8ecb4a8
--- /dev/null
+++ b/debian/patches/pve/0004-add-dummy-mtu-bridgevlanport-modules.patch
@@ -0,0 +1,85 @@
+From c77ca88f7d08789bddc4b43bafa23b38c0bd2d64 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier <aderumier at odiso.com>
+Date: Fri, 15 Jun 2018 00:36:03 +0200
+Subject: [PATCH] add dummy mtu, bridgevlanport modules
+
+As pve-manager package still provide ifupdown custom bridgevlanport && mtu script,
+we can override them with ifupdown2 addon scripts, doing nothing.
+
+(ifupdown2 don't launch an ifdown script, if an ifupdown2 addon script
+ exist with same name)
+---
+ etc/network/ifupdown2/addons.conf  |  3 +++
+ ifupdown2/addons/bridgevlanport.py | 17 +++++++++++++++++
+ ifupdown2/addons/mtu.py            | 17 +++++++++++++++++
+ 3 files changed, 37 insertions(+)
+ create mode 100644 ifupdown2/addons/bridgevlanport.py
+ create mode 100644 ifupdown2/addons/mtu.py
+
+diff --git a/etc/network/ifupdown2/addons.conf b/etc/network/ifupdown2/addons.conf
+index c0d1ce9..955b7d5 100644
+--- a/etc/network/ifupdown2/addons.conf
++++ b/etc/network/ifupdown2/addons.conf
+@@ -13,6 +13,8 @@ up,dhcp
+ up,address
+ up,addressvirtual
+ up,usercmds
++up,mtu
++up,bridgevlanport
+ post-up,usercmds
+ post-up,clagd
+ post-up,vxrd
+@@ -33,3 +35,4 @@ post-down,vlan
+ post-down,bond
+ post-down,usercmds
+ post-down,link
++
+diff --git a/ifupdown2/addons/bridgevlanport.py b/ifupdown2/addons/bridgevlanport.py
+new file mode 100644
+index 0000000..ab6a680
+--- /dev/null
++++ b/ifupdown2/addons/bridgevlanport.py
+@@ -0,0 +1,17 @@
++#!/usr/bin/python
++#
++
++import os
++
++try:
++    from ifupdown2.ifupdown.utils import utils
++
++    from ifupdown2.ifupdownaddons.modulebase import moduleBase
++except ImportError:
++    from ifupdown.utils import utils
++
++    from ifupdownaddons.modulebase import moduleBase
++
++class bridgevlanport(moduleBase):
++
++    _modinfo = {'mhelp' : 'dummy package to override proxmox script'}
+diff --git a/ifupdown2/addons/mtu.py b/ifupdown2/addons/mtu.py
+new file mode 100644
+index 0000000..efdf569
+--- /dev/null
++++ b/ifupdown2/addons/mtu.py
+@@ -0,0 +1,17 @@
++#!/usr/bin/python
++#
++
++import os
++
++try:
++    from ifupdown2.ifupdown.utils import utils
++
++    from ifupdown2.ifupdownaddons.modulebase import moduleBase
++except ImportError:
++    from ifupdown.utils import utils
++
++    from ifupdownaddons.modulebase import moduleBase
++
++class mtu(moduleBase):
++
++    _modinfo = {'mhelp' : 'dummy package to override proxmox script'}
+-- 
+2.11.0
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..f1346b0
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,7 @@
+extra/0001-addons-scripts-fix-ENV-for-interfaces-options.patch
+extra/0002-netlink-IFLA_BRPORT_ARP_SUPPRESS-use-32.patch
+extra/0003-add-vxlan-physdev-support.patch
+pve/0001-config-tuning.patch
+pve/0002-manual-interfaces-set-link-up.patch
+pve/0003-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
+pve/0004-add-dummy-mtu-bridgevlanport-modules.patch
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..7f8667a
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,21 @@
+#!/usr/bin/make -f
+
+#export DH_VERBOSE=1
+export PYBUILD_NAME=ifupdown2
+export PYBUILD_INSTALL_ARGS=--install-lib=/usr/share/ --install-scripts=/usr/share/
+
+%:
+	dh $@ --with python2 --with systemd --buildsystem=pybuild --with quilt
+
+override_dh_installman:
+	./ifupdown2/man/genmanpages.sh ./ifupdown2/man ./man
+	dh_installman
+
+override_dh_systemd_start:
+	dh_systemd_start --name=networking --no-start
+
+override_dh_systemd_enable:
+	dh_systemd_enable --name=networking
+
+override_dh_compress:
+	dh_compress -X.py
-- 
2.11.0



More information about the pve-devel mailing list