Commit Graph

59 Commits

Author SHA1 Message Date
Alexandre Derumier
4ac94c72a2 network_interfaces: use allow-ovs for OVSBridge
new openvswitch-switch service use "ifup --allow-ovs",
and this race with "auto ..." used by networking service

bug reported here:
https://forum.proxmox.com/threads/so-is-openvswitch-bonding-just-broken-on-pve-6-whats-going-on.58020/

This is also fixing ovs with ifupdown2

Openvswitch github have a note about this:
e0dfd67b45 (diff-555e6da95251766b76e83867900bd8fe)

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2019-09-20 09:06:47 +02:00
Thomas Lamprecht
9bbc4e174c tree wide trailing whitespace cleanup
generated with:
 # find . -name '*.pm' -exec sed -i 's/\s\+$//' {} \;

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-09 16:42:12 +02:00
Alexandre Derumier
d949babe56 etc_network_interfaces : add uplink-id option
uplink-id is an integer

it's used to abstract the interface name (could be different on
differents hosts)
and map it to a transportzone.

uplink-id is only allowed on physical interfaces (bond,eth,vlan)
as it's used for traffic to external

example:

auto eth0
iface eth0 inet manual
        uplink-id 1

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2019-09-09 16:41:12 +02:00
Thomas Lamprecht
4515aaec1e inotify: network/interfaces: fix 'Use of uninitialized value' for netmask
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-06-12 12:01:08 +02:00
Thomas Lamprecht
b610385849 followup code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-08 15:36:14 +00:00
Dominik Csapak
2896245e75 INotify: map address/netmask to cidr while parsing interfaces
this allows us to always show the 'address' the 'netmask' and the 'cidr'
both for ipv4 and ipv6

there is a small api change involved in one scenario:
if one manually changed the address to cidr format like
    '10.0.0.4/24'

we now get from the api the parsed values
    addr => 10.0.0.4
    netmask => 24
    cidr => 10.0.0.4/24

instead of
    addr => 10.0.0.4/24
    netmask =>

but i think that circumventing our api when writing the file, but still
relying on the api for reading is not a valid use case, i would argue
that we can change this, especially since we have a new field that
contains that information again (cidr)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-05-08 14:49:45 +00:00
Tim Marx
b3e3b51ba0 INotify: fix wording in networkdoc
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-01-03 09:03:46 +01:00
Wolfgang Bumiller
0c0bcf7cdc INotify: simplify lookup_type_prio
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-10-04 13:34:22 +02:00
Alexandre Derumier
51eec39065 improve lookup_type_prio
- use d->{type} instead regex on ifname
- add stacked vlan support
2018-10-04 13:06:54 +02:00
Alexandre Derumier
8f5d56bfc9 Inotify: add support for 802.1ad stacked vlans 2018-10-04 13:06:54 +02:00
Dominik Csapak
9194ee0657 INotify.pm: add methods for reading/writing /etc/hosts
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-09-14 11:37:32 +02:00
Dominik Csapak
69758574a1 INotify.pm: use run_command instead of open for calling diff
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-09-14 07:09:03 +02:00
Dominik Csapak
1b505ae239 decode comments in /etc/network/interfaces as utf8
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-09-14 07:08:35 +02:00
Alexandre Derumier
514c2138d1 Inotify: check bridgeport: fix vlan interface not defined
We can add to a bridge a non defined vlan interface.
We only need to check that physical interface exist

example:
    auto eno1
    iface eno1 inet manual

    auto vmbr0
    iface vmbr0 inet manual
        bridge_ports eno1.1

[w.bumiller@proxmox.com: style & commit message fixup]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-09-11 14:13:33 +02:00
Alexandre Derumier
000e32bc4a Inotify: fix mtu check
- special check for bond, set parent mtu from slaves mtu if no defined.

- error if parent mtu is lower than child mtu (not bigger)

- return if child mtu is not defined

- fix vlan check (parent/child was inverted)
2018-09-11 10:53:58 +02:00
Wolfgang Bumiller
fc158d0d9c fixup: don't use exists boolean
The previous condition didn't fail tests because it was
always false. The 'exists' property is not actually usable
when writing the interface file. It is merely a hint that
the interface existed in /proc/net/dev while parsing the
interfaces file and is otherwise actually unused here.

Simply check for the existence of the interface in $ifaces.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-07-10 12:08:04 +02:00
Wolfgang Bumiller
c27ef07ff5 fixup: compare MTUs numerically
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-07-10 11:55:39 +02:00
Wolfgang Bumiller
cebd1c85f0 whitespace fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-07-10 11:55:21 +02:00
Wolfgang Bumiller
94d786b393 cleanup: whitespace and error message consistency
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-07-10 11:53:18 +02:00
Alexandre Derumier
9b053d70de Inotify : add mtu option
also check if mtu value is lower than parent interface

fixme: vxlan interface should be 50bytes lower than outgoing interface
       we need to find which interface is used (unicast/multicast/frr)
2018-07-10 11:38:54 +02:00
Alexandre Derumier
c4e564708b Inotify : add check vlan
verify than parent interface exist
verify than parent interface type is eth,bond,bridge
verify than parent bridge is vlan aware if type bridge
2018-07-10 11:38:54 +02:00
Alexandre Derumier
0115696f6a Inotify : add check_bond
verify than bond slaves exist && type is eth
2018-07-10 11:38:54 +02:00
Alexandre Derumier
9a052564e1 Inotify : add bridge ports options 2018-07-10 11:38:54 +02:00
Alexandre Derumier
95aa8788b8 Inotify : add vxlan interface support 2018-07-10 11:38:54 +02:00
Wolfgang Bumiller
f6c4a56381 INotify: write network: don't duplicate bridge-vids
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-06-20 10:27:08 +02:00
Alexandre Derumier
b7c4f37851 Inotify : write network config : remove allow- ovs with ifupdown2 2018-06-20 10:11:48 +02:00
Alexandre Derumier
95d0e63377 Inotify : write network config : add bridge-vids
default is 2-4094 if user don't have specified.

mandatory for ifupdown2 and compatible with
current promox ifupdown bridgevlanport script
2018-06-20 10:11:48 +02:00
Alexandre Derumier
1accc6da65 Inotify : write network config : use modern syntax for options
-replace options with '_'  with '-'
-use 'bond-slaves' instead 'slaves'
2018-06-20 10:11:48 +02:00
Alexandre Derumier
1b1fb9f70c Inotify : read network config : allow alternative options names 2018-06-20 10:11:48 +02:00
Dietmar Maurer
3b671d82b1 INotify.pm - new helper poll_changes
Useful to detect file changes.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-01-22 14:52:04 +01:00
Dietmar Maurer
04cba6c8c1 read_file: replace $versions->{$filename} with $cver
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-01-22 14:52:04 +01:00
Fabian Grünbichler
3dabe28a23 add and use physical NIC regexp
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-06-08 15:00:49 +02:00
Dietmar Maurer
32ef45aee2 INotify.pm: use Clone::clone instead of Storable::dclone
I run into seroius troubles with dclone, which seem to be
buggy with tainted flag ...

Also, documentation states Clone::clone is much faster.
2017-03-21 11:59:08 +01:00
Fabian Grünbichler
fb3a6db16c cleanup previous commit 2017-01-27 15:21:54 +01:00
Wolfgang Link
affde347f1 Fix interface writer for bridge_ports and slaves.
The pve-iface-list allow to separate interfaces with [;,\s].
But in the interface file are only whitespace allowed to separate interfaces.
2017-01-27 14:45:54 +01:00
Michael Rasmussen
d3d77e03f8 Add check for infiniband to write functions as well
Signed-off-by: Michael Rasmussen <mir@datanom.net>
2016-10-24 11:37:35 +02:00
Michael Rasmussen
309085272b Add support for infiniband nics
Signed-off-by: Michael Rasmussen <mir@datanom.net>
2016-10-24 11:36:43 +02:00
Wolfgang Bumiller
f0d1b04fda move Network::get_active_interfaces to ProcFSTools
This avoids a circular dependency between PVE::INotify and
PVE::Network.

Also renamed to get_active_network_interfaces since the
package name now doesn't hint at this anymore.
2016-06-03 11:22:40 +02:00
Dietmar Maurer
c8e5d28e29 export bond_modes (define with 'our' instead of 'my')
So that other people can use that from outside.
2016-05-18 16:49:19 +02:00
Wolfgang Bumiller
b8246bfca7 typo fix 2016-05-18 12:55:50 +02:00
Wolfgang Bumiller
899f8c4aa5 support for predictable network interface device names
Based on patch from: Igor Vlasenko <viy@altlinux.org>
2016-05-17 16:14:15 +02:00
Wolfgang Bumiller
12a235d624 Fix #882: active state of interfaces depends on ipv6
read_etc_network_interfaces used the content of
/proc/net/if_inet6 to decide whether an interface's state is
"active", which means an interface is only active when it
has an ipv6 address, thus using net.ipv6.conf.*.disable_ipv6
on an interface will cause it to show as inactive in the web
interface.

We now filter the interfaces found in /proc/dev/net by their
IFF_UP flag read via an SIOCGIFFLAGS ioctl().
2016-02-10 12:20:21 +01:00
Wolfgang Bumiller
e34c27f474 Fix #861: use safer sprintf formatting 2016-01-08 12:49:40 +01:00
Wolfgang Bumiller
aeac55e138 half-revert: remove autostart property from bridge ports
In commit 21d32c95cd autostart was removed from all bridge
ports but should have only been removed from ovs bridge ports.
2015-10-19 11:11:29 +02:00
Wolfgang Bumiller
7a82210017 don't reorder unknown interface types
Giving unknown interfaces an order-id of 0 caused them to
always be on top of the interfaces file. This is often
undesired. Instead we now only take type-ordering into
account when both interfaces which are being compared have a
known type, and otherwise only use the priority attribute.
This should result in a more stable modification of
interfaces.

Fixes #747
2015-10-07 13:43:28 +02:00
Wolfgang Bumiller
176b1186bd INotify::read_etc_resolv_conf: ipv6 support 2015-10-05 12:30:44 +02:00
Alexandre Derumier
9c8089450c read|write network interfaces : add support for vlan interfaces
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2015-09-25 06:57:24 +02:00
Alexandre Derumier
685a2528b1 add bridge_vlan_aware
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2015-09-16 10:48:52 +02:00
Wolfgang Bumiller
21d32c95cd remove autostart property from bridge ports
Fixes #711
2015-09-14 12:42:47 +02:00
Wolfgang Bumiller
562fad0bab write_network_interfaces: improved sorting
This way option line positions between interfaces can be
preserved.
2015-06-26 07:51:07 +02:00