diff options
author | Daniil Baturin <daniil@vyos.io> | 2020-03-09 19:17:49 +0200 |
---|---|---|
committer | Daniil Baturin <daniil@vyos.io> | 2020-03-09 19:17:49 +0200 |
commit | 5dd56053319f1af72d8d684151873e559ed1de46 (patch) | |
tree | f67c55a9ad1b729b3bfa15c57721c1f2db2b5290 | |
parent | f1467d4c193f02bd17b31630045cd53b7109b9e3 (diff) | |
parent | 72516c872e1690895d0269cafcb87e4e44bf153c (diff) | |
download | vyatta-cfg-system-5dd56053319f1af72d8d684151873e559ed1de46.tar.gz vyatta-cfg-system-5dd56053319f1af72d8d684151873e559ed1de46.zip |
Merge branch 'crux' of github.com:vyos/vyatta-cfg-system into cruxvyos/1.2.5
-rw-r--r-- | Makefile.am | 2 | ||||
-rwxr-xr-x | scripts/system/irq-affinity.pl | 11 | ||||
-rwxr-xr-x | scripts/vyatta_net_name | 39 | ||||
-rw-r--r-- | sysconf/63-hyperv-vf-net.rules | 5 | ||||
-rw-r--r-- | sysconf/64-vyos-vmware-net.rules | 14 | ||||
-rw-r--r-- | sysconf/65-vyatta-net.rules | 7 | ||||
-rw-r--r-- | sysconf/vyatta-sysctl.conf | 9 | ||||
-rw-r--r-- | templates/system/ipv6/multipath/layer4-hashing/node.def | 4 |
8 files changed, 78 insertions, 13 deletions
diff --git a/Makefile.am b/Makefile.am index 8ccd7887..cecc9208 100644 --- a/Makefile.am +++ b/Makefile.am @@ -100,6 +100,8 @@ udevrulesdir = /lib/udev/rules.d libudev_SCRIPTS = scripts/vyatta_net_name udevrules_DATA = sysconf/65-vyatta-net.rules udevrules_DATA += sysconf/42-qemu-usb.rules +udevrules_DATA += sysconf/64-vyos-vmware-net.rules +udevrules_DATA += sysconf/63-hyperv-vf-net.rules cronhourlydir = /etc/cron.hourly cronhourly_SCRIPTS = sysconf/vyatta-logrotate-hourly diff --git a/scripts/system/irq-affinity.pl b/scripts/system/irq-affinity.pl index de0c3099..20181578 100755 --- a/scripts/system/irq-affinity.pl +++ b/scripts/system/irq-affinity.pl @@ -30,6 +30,17 @@ my ($ifname, $mask, $debug) = @ARGV; die "Error: Interface $ifname does not exist\n" unless -d "/sys/class/net/$ifname"; +# Detect xen and use special (vifX-) interface irq +if ( -d "/proc/xen" ){ + open( my $f, '<', "/sys/class/net/$ifname/device/nodename" ) + or die "Can't read /sys/class/net/$ifname/device/nodename "; + my $xen_ifname = <$f>; + $xen_ifname =~ s/device\/vif\///; + $ifname = "vif".$xen_ifname; + chomp($ifname); + close $f; +} + my $logopt = defined($debug) ? "perror" : ""; openlog("irq-affinity", $logopt, LOG_LOCAL0); diff --git a/scripts/vyatta_net_name b/scripts/vyatta_net_name index 53ae9fba..825bf86f 100755 --- a/scripts/vyatta_net_name +++ b/scripts/vyatta_net_name @@ -21,7 +21,7 @@ use Sys::Syslog qw(:standard :macros); use Fcntl qw(:flock); my $BOOTFILE = "/opt/vyatta/etc/config/config.boot"; -my $VYATTACFG = "/opt/vyatta/config/active"; +my $VYATTACFG = "/opt/vyatta/config/active/interfaces"; my $UDEVDIR = "/run/udev/"; my $VYATTAUDEV = $UDEVDIR . "vyatta"; @@ -137,7 +137,7 @@ sub logit { # Determine network name to use based on Vyatta config during boot sub coldplug { - my ($ifname, $hwaddr) = @_; + my ($ifname, $hwaddr, $predef_ifname) = @_; # at this time root directory is read-only so use log file instead mkdir ($UDEVLOG); @@ -168,8 +168,14 @@ sub coldplug { } } - $newname = biosdevname($ifname); - logit($log, "biosdevname for $ifname returned '$newname'\n"); + if ($predef_ifname) { + $newname = $predef_ifname; + logit($log, "predefined interface name for $ifname returned '$newname'\n"); + } + else { + $newname = biosdevname($ifname); + logit($log, "biosdevname for $ifname returned '$newname'\n"); + } unless (is_available($interfaces, $newname)) { $newname = find_available($interfaces, $newname); @@ -185,7 +191,7 @@ sub coldplug { # Determine name from active config sub hotplug { - my ($ifname, $hwaddr) = @_; + my ($ifname, $hwaddr, $predef_ifname) = @_; # real filesystem available use real logging openlog("vyatta-net-name", "", LOG_DAEMON); @@ -211,8 +217,14 @@ sub hotplug { return $newname; } - $newname = biosdevname($ifname); - syslog(LOG_DEBUG, "biosdevname for %s returned '%s'", $ifname, $newname); + if ($predef_ifname) { + $newname = $predef_ifname; + syslog(LOG_DEBUG, "predefined interface name for %s returned '%s'", $ifname, $newname); + } + else{ + $newname = biosdevname($ifname); + syslog(LOG_DEBUG, "biosdevname for %s returned '%s'", $ifname, $newname); + } unless (is_available($interfaces, $newname)) { $newname = find_available($interfaces, $newname); @@ -238,21 +250,26 @@ sub unlock_file { $LOCKF = undef; } -# This script is called from udev with two arguments +# This script is called from udev with two or three arguments # it outputs the new name (if any) to stdout -if ($#ARGV != 1) { +if ($#ARGV > 2 or $#ARGV < 1) { die "vyatta_net_name called with wrong args:" . join(' ', @ARGV) . "\n"; } my $ifname = $ARGV[0]; my $hwaddr = $ARGV[1]; +my $predef_ifname = ""; +if ($ARGV[2]){ + $predef_ifname = $ARGV[2]; +} + lock_file; my $newname; if ( -d $VYATTACFG ) { - $newname = hotplug($ifname, $hwaddr); + $newname = hotplug($ifname, $hwaddr, $predef_ifname); } else { - $newname = coldplug($ifname, $hwaddr); + $newname = coldplug($ifname, $hwaddr, $predef_ifname); } unlock_file; diff --git a/sysconf/63-hyperv-vf-net.rules b/sysconf/63-hyperv-vf-net.rules new file mode 100644 index 00000000..b4dcb5a3 --- /dev/null +++ b/sysconf/63-hyperv-vf-net.rules @@ -0,0 +1,5 @@ +ATTR{[dmi/id]sys_vendor}!="Microsoft Corporation", GOTO="end_hyperv_nic" + +ACTION=="add", SUBSYSTEM=="net", DRIVERS=="hv_pci", NAME="vf_%k" + +LABEL="end_hyperv_nic" diff --git a/sysconf/64-vyos-vmware-net.rules b/sysconf/64-vyos-vmware-net.rules new file mode 100644 index 00000000..66a4a069 --- /dev/null +++ b/sysconf/64-vyos-vmware-net.rules @@ -0,0 +1,14 @@ +ATTR{[dmi/id]sys_vendor}!="VMware, Inc.", GOTO="end_vmware_nic" + +ACTION=="add", SUBSYSTEM=="net", ATTRS{label}=="Ethernet0", ENV{VYOS_IFNAME}="eth0" +ACTION=="add", SUBSYSTEM=="net", ATTRS{label}=="Ethernet1", ENV{VYOS_IFNAME}="eth1" +ACTION=="add", SUBSYSTEM=="net", ATTRS{label}=="Ethernet2", ENV{VYOS_IFNAME}="eth2" +ACTION=="add", SUBSYSTEM=="net", ATTRS{label}=="Ethernet3", ENV{VYOS_IFNAME}="eth3" +ACTION=="add", SUBSYSTEM=="net", ATTRS{label}=="Ethernet4", ENV{VYOS_IFNAME}="eth4" +ACTION=="add", SUBSYSTEM=="net", ATTRS{label}=="Ethernet5", ENV{VYOS_IFNAME}="eth5" +ACTION=="add", SUBSYSTEM=="net", ATTRS{label}=="Ethernet6", ENV{VYOS_IFNAME}="eth6" +ACTION=="add", SUBSYSTEM=="net", ATTRS{label}=="Ethernet7", ENV{VYOS_IFNAME}="eth7" +ACTION=="add", SUBSYSTEM=="net", ATTRS{label}=="Ethernet8", ENV{VYOS_IFNAME}="eth8" +ACTION=="add", SUBSYSTEM=="net", ATTRS{label}=="Ethernet9", ENV{VYOS_IFNAME}="eth9" + +LABEL="end_vmware_nic" diff --git a/sysconf/65-vyatta-net.rules b/sysconf/65-vyatta-net.rules index 0f4b9006..2b48c121 100644 --- a/sysconf/65-vyatta-net.rules +++ b/sysconf/65-vyatta-net.rules @@ -13,6 +13,13 @@ KERNEL!="eth*|wlan*", GOTO="vyatta_net_end" # ignore "secondary" monitor interfaces of mac80211 drivers KERNEL=="wlan*", ATTRS{type}=="803", GOTO="vyatta_net_end" +# If using VyOS predefined names +ENV{VYOS_IFNAME}!="eth*", GOTO="end_vyos_predef_names" + +DRIVERS=="?*", PROGRAM="vyatta_net_name %k $attr{address} $env{VYOS_IFNAME}", NAME="%c", GOTO="vyatta_net_end" + +LABEL="end_vyos_predef_names" + # ignore interfaces without a driver link like bridges and VLANs DRIVERS=="?*", PROGRAM="vyatta_net_name %k $attr{address}", NAME="%c" diff --git a/sysconf/vyatta-sysctl.conf b/sysconf/vyatta-sysctl.conf index 560c29de..0314fcc5 100644 --- a/sysconf/vyatta-sysctl.conf +++ b/sysconf/vyatta-sysctl.conf @@ -80,3 +80,12 @@ net.ipv4.igmp_max_memberships = 512 # Enable conntrack helper by default net.netfilter.nf_conntrack_helper=1 + +# Increase default garbage collection thresholds +net.ipv4.neigh.default.gc_thresh1 = 1024 +net.ipv4.neigh.default.gc_thresh2 = 4096 +net.ipv4.neigh.default.gc_thresh3 = 8192 +# +net.ipv6.neigh.default.gc_thresh1 = 1024 +net.ipv6.neigh.default.gc_thresh2 = 4096 +net.ipv6.neigh.default.gc_thresh3 = 8192 diff --git a/templates/system/ipv6/multipath/layer4-hashing/node.def b/templates/system/ipv6/multipath/layer4-hashing/node.def index 97ffdc61..d138666b 100644 --- a/templates/system/ipv6/multipath/layer4-hashing/node.def +++ b/templates/system/ipv6/multipath/layer4-hashing/node.def @@ -1,5 +1,5 @@ help: Use layer 4 information for ECMP hashing -create: sudo sysctl -w net.ipv4.fib_multipath_hash_policy=1 >/dev/null -delete: sudo sysctl -w net.ipv4.fib_multipath_hash_policy=0 >/dev/null +create: sudo sysctl -w net.ipv6.fib_multipath_hash_policy=1 >/dev/null +delete: sudo sysctl -w net.ipv6.fib_multipath_hash_policy=0 >/dev/null |