diff options
author | Daniil Baturin <daniil@baturin.org> | 2015-02-15 05:20:44 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2015-02-15 05:20:44 +0100 |
commit | 13d64226876ea325b8f32d410452ded6ad65e529 (patch) | |
tree | 62eb2b368deec5f8b45cdb0207e92f6a4abbf711 | |
parent | e8f156f129057427a59d162a11c414525f6495ac (diff) | |
parent | ddf9a933451f639edc15d669c0c32b15cc0a2717 (diff) | |
download | vyatta-cfg-system-13d64226876ea325b8f32d410452ded6ad65e529.tar.gz vyatta-cfg-system-13d64226876ea325b8f32d410452ded6ad65e529.zip |
Merge branch 'lithium' of github.com:vyos/vyatta-cfg-system into lithium
19 files changed, 283 insertions, 110 deletions
diff --git a/debian/changelog b/debian/changelog index 6e5cfb7c..ca08ca74 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,43 @@ +vyatta-cfg-system (0.20.44+vyos2+lithium13) unstable; urgency=low + + [ Alex Harpin ] + * vyatta-cfg-system: multiple servers for dns forwarding domain override + * vyatta-cfg-system: redesign the layout and updating of /etc/resolv.conf + * vyatta-cfg-system: remove blank domain search and expand comment type + + -- Alex Harpin <development@landsofshadow.co.uk> Sat, 14 Feb 2015 14:37:03 +0000 + +vyatta-cfg-system (0.20.44+vyos2+lithium12) unstable; urgency=low + + [ Alex Harpin ] + * vyatta-cfg-system: invalid resolv.conf format causing extra DNS request + + -- Alex Harpin <development@landsofshadow.co.uk> Mon, 09 Feb 2015 22:34:02 +0000 + +vyatta-cfg-system (0.20.44+vyos2+lithium11) unstable; urgency=low + + [ Hiroyuki Sato ] + * Bug#382: fix radvd status check + + [ Kim Hagen ] + * Bug #467, tos inherit not turned on by default on tunnels (IPIP, GRE) + * Bug #352 - QinQ - changing the ethertype value of vif-s + * Can not change EtherType with vif-c interfaces configured + + [ Alex Harpin ] + * vyatta-cfg-system: allow dynamic dns updating from behind nat + + -- Alex Harpin <development@landsofshadow.co.uk> Sun, 08 Feb 2015 20:19:41 +0000 + +vyatta-cfg-system (0.20.44+vyos2+lithium10) unstable; urgency=low + + [ Alex Harpin ] + * vyatta-cfg-system: formatting changes for style consistency + * vyatta-cfg-system: changes to update_inittab for xen console access + * vyatta-cfg-system: remove default speed value for console access + + -- Alex Harpin <development@landsofshadow.co.uk> Sun, 25 Jan 2015 09:32:40 +0000 + vyatta-cfg-system (0.20.44+vyos2+lithium9) unstable; urgency=low [ Alex Harpin ] diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl index b5efd269..217a520a 100755 --- a/scripts/dns-forwarding/vyatta-dns-forwarding.pl +++ b/scripts/dns-forwarding/vyatta-dns-forwarding.pl @@ -63,7 +63,7 @@ sub dnsforwarding_get_values { my $output = ''; my $config = new Vyatta::Config; my $use_dnsmasq_conf = 0; - my (@listen_interfaces, $cache_size, @use_nameservers, $use_system_nameservers, @use_dhcp_nameservers, @domain, $server, $ignore_hosts_file); + my (@listen_interfaces, $cache_size, @use_nameservers, $use_system_nameservers, @use_dhcp_nameservers, @domains, $server, $ignore_hosts_file); $config->setLevel("service dns forwarding"); @@ -73,7 +73,7 @@ sub dnsforwarding_get_values { @use_nameservers = $config->returnOrigValues("name-server"); $use_system_nameservers = $config->existsOrig("system"); @use_dhcp_nameservers = $config->returnOrigValues("dhcp"); - @domain = $config->listOrigNodes("domain"); + @domains = $config->listOrigNodes("domain"); $ignore_hosts_file = $config->returnOrigValue("ignore-hosts-file"); } else { @@ -82,7 +82,7 @@ sub dnsforwarding_get_values { @use_nameservers = $config->returnValues("name-server"); $use_system_nameservers = $config->exists("system"); @use_dhcp_nameservers = $config->returnValues("dhcp"); - @domain = $config->listNodes("domain"); + @domains = $config->listNodes("domain"); $ignore_hosts_file = $config->exists("ignore-hosts-file"); } @@ -112,7 +112,7 @@ sub dnsforwarding_get_values { my $sys_config = new Vyatta::Config; $sys_config->setLevel("system"); my @system_nameservers; - if ($outside_cli == 1){ + if ($outside_cli == 1) { @system_nameservers = $sys_config->returnOrigValues("name-server"); } else { @system_nameservers = $sys_config->returnValues("name-server"); @@ -123,11 +123,18 @@ sub dnsforwarding_get_values { } } } - if (@domain != 0) { - foreach my $dom (@domain) { - my $ser = $config->returnValue("domain $dom server"); - if (defined ($ser)) { - $output .="server=/$dom/$ser\t# domain-override\n"; + if (@domains != 0) { + foreach my $domain (@domains) { + my @domain_servers; + if ($outside_cli == 1) { + @domain_servers = $config->returnValues("domain $domain server"); + } else { + @domain_servers = $config->returnValues("domain $domain server"); + } + if (@domain_servers > 0) { + foreach my $domain_server (@domain_servers) { + $output .="server=/$domain/$domain_server\t# domain-override\n"; + } } } } diff --git a/scripts/dynamic-dns/vyatta-dynamic-dns.pl b/scripts/dynamic-dns/vyatta-dynamic-dns.pl index 8788730f..83206253 100755 --- a/scripts/dynamic-dns/vyatta-dynamic-dns.pl +++ b/scripts/dynamic-dns/vyatta-dynamic-dns.pl @@ -96,16 +96,24 @@ sub dynamicdns_get_constants { $output .= "ssl=yes\n"; $output .= "pid=$ddclient_run_dir/ddclient_$interface.pid\n"; $output .= "cache=$ddclient_cache_dir/ddclient_$interface.cache\n"; - $output .= "use=if, if=$interface\n\n\n"; return $output; } sub dynamicdns_get_values { - my $output = ''; + my $output; my $config = new Vyatta::Config; $config->setLevel("service dns dynamic interface $interface"); + my $web_url = $config->returnValue("use-web url"); + my $web_skip = $config->returnValue("use-web skip"); + + if ($web_url && $web_skip) { + $output = "use=web, web=$web_url, web-skip='".$web_skip."'\n\n\n"; + } else { + $output = "use=if, if=$interface\n\n\n"; + } + my @services = $config->listNodes("service"); foreach my $service (@services) { $config->setLevel("service dns dynamic interface $interface service $service"); diff --git a/scripts/system/vyatta_update_console.pl b/scripts/system/vyatta_update_console.pl index 0ee6a6e5..7c36ec7f 100755 --- a/scripts/system/vyatta_update_console.pl +++ b/scripts/system/vyatta_update_console.pl @@ -34,13 +34,13 @@ die "$0 expects no arguments\n" if (@ARGV); sub update { my ($old, $new) = @_; - if ( compare($old, $new) != 0) { - move($new, $old) - or die "Can't move $new to $old"; - return 1; + if (compare($old, $new) != 0) { + move($new, $old) + or die "Can't move $new to $old"; + return 1; } else { - unlink($new); - return; + unlink($new); + return; } } @@ -48,14 +48,15 @@ my $INITTAB = "/etc/inittab"; my $TMPTAB = "/tmp/inittab.$$"; sub update_inittab { - open (my $inittab, '<', $INITTAB) - or die "Can't open $INITTAB: $!"; + open(my $inittab, '<', $INITTAB) + or die "Can't open $INITTAB: $!"; - open (my $tmp, '>', $TMPTAB) - or die "Can't open $TMPTAB: $!"; + open(my $tmp, '>', $TMPTAB) + or die "Can't open $TMPTAB: $!"; # Clone original inittab but remove all references to serial lines - print {$tmp} grep { ! /^T|^# Vyatta/ } <$inittab>; + # and Xen consoles + print {$tmp} grep {!/^T|^# Vyatta|^h/} <$inittab>; close $inittab; my $config = new Vyatta::Config; @@ -63,29 +64,38 @@ sub update_inittab { print {$tmp} "# Vyatta console configuration (do not modify)\n"; - my $id = 0; + my $serial_id = 0; + my $xen_id = 0; + foreach my $tty ($config->listNodes()) { - my $speed = $config->returnValue("$tty speed"); - $speed = 9600 unless $speed; - - printf {$tmp} "T%d:23:respawn:", $id; - if ($config->exists("$tty modem")) { - printf {$tmp} "/sbin/mgetty -x0 -s %d %s\n", $speed, $tty; - } else { - printf {$tmp} "/sbin/getty -L %s %d vt100\n", $tty, $speed; - } - - # id field is limited to 4 characters - if (++$id >= 1000) { - warn "Ignoring $tty only 1000 serial devices supported\n"; - last; - } + my $speed = $config->returnValue("$tty speed"); + if ($tty =~ /^hvc\d/) { + $speed = 38400 unless $speed; + printf {$tmp} "h%d:23:respawn:", $xen_id; + printf {$tmp} "/sbin/getty %d %s\n", $speed, $tty; + $xen_id++; + } else { + $speed = 9600 unless $speed; + printf {$tmp} "T%d:23:respawn:", $serial_id; + if ($config->exists("$tty modem")) { + printf {$tmp} "/sbin/mgetty -x0 -s %d %s\n", $speed, $tty; + } else { + printf {$tmp} "/sbin/getty -L %s %d vt100\n", $tty, $speed; + } + + # id field is limited to 4 characters + if (++$serial_id >= 1000) { + warn "Ignoring $tty only 1000 serial devices supported\n"; + last; + } + } } close $tmp; if (update($INITTAB, $TMPTAB)) { - # This is same as telinit q - it tells init to re-examine inittab - kill 1, 1; + + # This is same as telinit q - it tells init to re-examine inittab + kill 1, 1; } } @@ -104,20 +114,20 @@ sub update_grub { my $speed = $config->returnValue("ttyS0 speed"); $speed = "9600" unless defined($speed); - open (my $grub, '<', $GRUBCFG) - or die "Can't open $GRUBCFG: $!"; + open(my $grub, '<', $GRUBCFG) + or die "Can't open $GRUBCFG: $!"; - open (my $tmp, '>', $GRUBTMP) - or die "Can't open $GRUBTMP: $!"; + open(my $tmp, '>', $GRUBTMP) + or die "Can't open $GRUBTMP: $!"; while (<$grub>) { - if (/^serial / ) { - print {$tmp} "serial --unit=0 --speed=$speed\n"; - } elsif (/^(.* console=ttyS0),[0-9]+(.*)$/) { - print {$tmp} "$1,$speed$2\n"; - } else { - print {$tmp} $_; - } + if (/^serial /) { + print {$tmp} "serial --unit=0 --speed=$speed\n"; + } elsif (/^(.* console=ttyS0),[0-9]+(.*)$/) { + print {$tmp} "$1,$speed$2\n"; + } else { + print {$tmp} $_; + } } close $grub; close $tmp; diff --git a/scripts/system/vyatta_update_resolv.pl b/scripts/system/vyatta_update_resolv.pl index 921052f0..0dfa4bec 100755 --- a/scripts/system/vyatta_update_resolv.pl +++ b/scripts/system/vyatta_update_resolv.pl @@ -37,7 +37,7 @@ GetOptions("dhclient-script=i" => \$dhclient_script, my $vc = new Vyatta::Config(); $vc->setLevel('system'); -my @domains; +my @search_domains; my $domain_name = undef; my $disable_dhcp_nameservers = undef; @@ -48,34 +48,39 @@ if ($config_mode == 1) { } if ($dhclient_script == 1) { - @domains = $vc->returnOrigValues('domain-search domain'); + @search_domains = $vc->returnOrigValues('domain-search domain'); $domain_name = $vc->returnOrigValue('domain-name'); } else { - @domains = $vc->returnValues('domain-search domain'); + @search_domains = $vc->returnValues('domain-search domain'); $domain_name = $vc->returnValue('domain-name'); } -if ($dhclient_script == 0 && @domains > 0 && $domain_name && length($domain_name) > 0) { - my @loc; +if ($dhclient_script == 0 && @search_domains > 0 && $domain_name && length($domain_name) > 0) { + my @location; if ($vc->returnOrigValues('domain-search domain') > 0) { - @loc = ["system","domain-name"]; + @location = ["system","domain-name"]; } else { - @loc = ["system","domain-search","domain"]; + @location = ["system","domain-search","domain"]; } - Vyatta::Config::outputError(@loc,"System configuration error. Both \'domain-name\' and \'domain-search\' are specified, but only one of these mutually exclusive parameters is allowed."); + Vyatta::Config::outputError(@location,"System configuration error. Both \'domain-name\' and \'domain-search\' are specified, but only one of these mutually exclusive parameters is allowed."); exit(1); } -my $doms = ''; -foreach my $domain (@domains) { - if (length($doms) > 0) { - $doms .= ' '; +my $search_domain_list = ''; +my $search_includes_system = 0; + +foreach my $domain (@search_domains) { + if (length($search_domain_list) > 0) { + $search_domain_list .= ' '; } - $doms .= $domain; + $search_domain_list .= $domain; + $search_includes_system = 1; } -# add domain names received from dhcp client to domain search in /etc/resolv.conf if domain-name not set in CLI +# add domain searches received from the dhcp client to those already in /etc/resolv.conf, as long as domain-name is not set in the CLI + +my $search_includes_dhcp = 0; if (!defined($domain_name)) { my @dhcp_interfaces_resolv_files = `ls /etc/ | grep resolv.conf.dhclient-new`; @@ -88,20 +93,34 @@ if (!defined($domain_name)) { my @dhcp_domains = split(/\s+/, $search_string, 2); my $dhcp_domain = $dhcp_domains[1]; chomp $dhcp_domain; - $doms .= ' ' . $dhcp_domain; + if (length($search_domain_list) > 0) { + $search_domain_list .= ' '; + } + $search_domain_list .= $dhcp_domain; + $search_includes_dhcp = 1; } } } } my $search = ''; -if (length($doms) > 0) { - $search = "search\t\t$doms\t\t#line generated by $0\n"; +if (length($search_domain_list) > 0) { + my $source; + if ($search_includes_system == 1) { + if ($search_includes_dhcp == 1) { + $source = "(system + dhcp)"; + } else { + $source = "(system)"; + } + } else { + $source = "(dhcp)"; + } + $search = "#line generated by vyatta_update_resolv.pl $source\nsearch\t\t$search_domain_list\n"; } my $domain = ''; if ($domain_name && length($domain_name) > 0) { - $domain = "domain\t\t$domain_name\t\t#line generated by $0\n"; + $domain = "#line generated by vyatta_update_resolv.pl (system)\ndomain\t\t$domain_name\n"; } # update /etc/resolv.conf with name-servers received from dhcp client, done when this script is called @@ -143,7 +162,7 @@ if (($dhclient_script == 1) || ($config_mode == 1)) { if (($ns_in_resolvconf == 0) && !($disable_dhcp_nameservers)) { open (my $rf, '>>', '/etc/resolv.conf') or die "$! error trying to overwrite"; - print $rf "nameserver\t$ns\t\t#nameserver written by $0\n"; + print $rf "#nameserver written by vyatta_update_resolv.pl (dhcp)\nnameserver\t$ns\n"; close $rf; $restart_ntp = 1; } @@ -156,7 +175,16 @@ if (($dhclient_script == 1) || ($config_mode == 1)) { # from dhcp-server, or to remove previous dhcp supplied name-servers if disable-dhcp-nameservers has # been enabled. - my @nameservers_dhcp_in_resolvconf = `grep 'nameserver written' /etc/resolv.conf`; + my $found_old = 0; + + my @nameservers_dhcp_in_resolvconf = `sed -n '/nameserver written/{n;P;}' /etc/resolv.conf`; + for my $old_style_nameservers (@nameservers_dhcp_in_resolvconf) { + if ($old_style_nameservers =~ /#line generated by/){ + @nameservers_dhcp_in_resolvconf = `sed -n '/nameserver written/{P;}' /etc/resolv.conf`; + $found_old = 1; + last; + } + } my @dhcp_nameservers_in_resolvconf; my $count_nameservers_in_resolvconf = 0; for my $count_dhcp_nameserver (@nameservers_dhcp_in_resolvconf) { @@ -166,20 +194,32 @@ if (($dhclient_script == 1) || ($config_mode == 1)) { } if (($#current_dhcp_nameservers < 0) || ($disable_dhcp_nameservers)) { for my $dhcpnameserver (@dhcp_nameservers_in_resolvconf) { - my $cmd = "sed -i '/$dhcpnameserver\t/d' /etc/resolv.conf"; + my $cmd; + chomp $dhcpnameserver; + if ($found_old == 1) { + $cmd = "sed -i '/nameserver\t$dhcpnameserver/d' /etc/resolv.conf"; + } else { + $cmd = "sed -i -n '/nameserver\t$dhcpnameserver/".'{n;x;d;};x;1d;p;${x;p;}'."' /etc/resolv.conf"; + } system($cmd); $restart_ntp = 1; } } else { for my $dhcpnameserver (@dhcp_nameservers_in_resolvconf) { my $found = 0; + my $cmd; + chomp $dhcpnameserver; for my $currentnameserver (@current_dhcp_nameservers) { if ($dhcpnameserver eq $currentnameserver){ $found = 1; } } if ($found == 0) { - my $cmd = "sed -i '/$dhcpnameserver\t/d' /etc/resolv.conf"; + if ($found_old == 1) { + $cmd = "sed -i '/nameserver\t$dhcpnameserver/d' /etc/resolv.conf"; + } else { + $cmd = "sed -i -n '/nameserver\t$dhcpnameserver/".'{n;x;d;};x;1d;p;${x;p;}'."' /etc/resolv.conf"; + } system($cmd); $restart_ntp = 1; } @@ -221,7 +261,7 @@ foreach my $line (@resolv) { if (length($domain) > 0) { print $r $domain; } - } else { + } elsif ($line !~ /^#line generated by\s/) { print $r $line; } } diff --git a/scripts/vyatta-system-nameservers b/scripts/vyatta-system-nameservers index 74f2c8b6..7b66cf77 100755 --- a/scripts/vyatta-system-nameservers +++ b/scripts/vyatta-system-nameservers @@ -53,7 +53,7 @@ update_system_nameservers () { # find last instance of cli inserted nameserver # insert currently received nameserver immediately after that # this is done to keep system set nameservers priority over dhcp received nameservers - cli_ns_array=($(awk '{if (!$3) print $2}' /etc/resolv.conf)) + cli_ns_array=($(awk '{if (/(dhcp)/) exit 0; if (!$3) print $2}' /etc/resolv.conf)) cli_ns_array_len=${#cli_ns_array[*]} line_num=0 if [ $cli_ns_array_len -gt 0 ]; then diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.def index 5a2e8dee..dcec3900 100644 --- a/templates/interfaces/bonding/node.tag/vif-s/node.def +++ b/templates/interfaces/bonding/node.tag/vif-s/node.def @@ -5,14 +5,8 @@ help: QinQ TAG-S Virtual Local Area Network (VLAN) ID syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094" val_help: u32:0-4094; VLAN ID -create: read -a SLAVES </sys/class/net/$VAR(../@)/bonding/slaves - if [ ${#SLAVES[*]} -eq 0 ]; then - echo "Must configure slave devices for bond interface $VAR(../@) before adding vif" - exit 1 - fi - ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan proto 802.1ad id $VAR(@) || exit 1 - ip link set "$VAR(../@).$VAR(@)" up - /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on - -delete: [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0 - ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto 802.1ad id $VAR(@) +delete: ETHERTYPE=`echo "$VAR(ethertype/@)"` + if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi + if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi + [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0 + ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto $ETHTYPE id $VAR(@) diff --git a/templates/interfaces/bonding/node.tag/vif-s/node.tag/ethertype/node.def b/templates/interfaces/bonding/node.tag/vif-s/node.tag/ethertype/node.def new file mode 100644 index 00000000..a79acae4 --- /dev/null +++ b/templates/interfaces/bonding/node.tag/vif-s/node.tag/ethertype/node.def @@ -0,0 +1,26 @@ +type: txt +help: Set Ethertype +syntax:expression: $VAR(@) in "0x88A8", "0x8100";"Must be (0x88A8 0x8100)\n" +default: "0x88A8" + +comp_help: possible completions: + 0x88A8 802.1AD + 0x8100 802.1Q + +update: ACTIVEETHTYPE=`cli-shell-api returnActiveValue interfaces bonding $VAR(../../@) vif-s $VAR(../@) ethertype` + if [ ! -z $VAR(../vif-c/@@) ] && [ ! -z $ACTIVEETHTYPE ] + then echo "Can not change ethertype with vif-c configured" + exit 1 + fi + ETHERTYPE=`echo "$VAR(@)"` + if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi + if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi + read -a SLAVES </sys/class/net/$VAR(../../@)/bonding/slaves + if [ ${#SLAVES[*]} -eq 0 ]; then + echo "Must configure slave devices for bond interface $VAR(../@) before adding vif" + exit 1 + fi + ip link delete dev "$VAR(../../@).$VAR(../@)" type vlan proto $ETHTYPE id $VAR(../@) > /dev/null 2>&1 + ip link add link $VAR(../../@) name "$VAR(../../@).$VAR(../@)" type vlan proto $ETHTYPE id $VAR(../@) || exit 1 + ip link set "$VAR(../../@).$VAR(../@)" up + /opt/vyatta/sbin/vyatta-link-detect "$VAR(../../@).$VAR(../@)" on diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.def index 0a4ed145..c6483ac0 100644 --- a/templates/interfaces/ethernet/node.tag/vif-s/node.def +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.def @@ -5,15 +5,8 @@ help: QinQ TAG-S Virtual Local Area Network (VLAN) ID syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094" val_help: u32:0-4094; VLAN ID -create: if ! ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan proto 802.1ad id $VAR(@) - then echo "Error creating VLAN device $VAR(../@).$VAR(@)" - exit 1 - fi - # if parent is up, then bring VLAN up - if [ $(( $(cat /sys/class/net/$VAR(../@)/flags) & 1 )) -eq 1 ] - then ip link set "$VAR(../@).$VAR(@)" up - fi - /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on - -delete: [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0 - ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto 802.1ad id $VAR(@) +delete: ETHERTYPE=`echo "$VAR(ethertype/@)"` + if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi + if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi + [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0 + ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto $ETHTYPE id $VAR(@) diff --git a/templates/interfaces/ethernet/node.tag/vif-s/node.tag/ethertype/node.def b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/ethertype/node.def new file mode 100644 index 00000000..0a5e954a --- /dev/null +++ b/templates/interfaces/ethernet/node.tag/vif-s/node.tag/ethertype/node.def @@ -0,0 +1,27 @@ +type: txt +help: Set Ethertype +syntax:expression: $VAR(@) in "0x88A8", "0x8100";"Must be (0x88A8 0x8100)\n" +default: "0x88A8" + +comp_help: possible completions: + 0x88A8 802.1AD + 0x8100 802.1Q + +update: ACTIVEETHTYPE=`cli-shell-api returnActiveValue interfaces ethernet $VAR(../../@) vif-s $VAR(../@) ethertype` + if [ ! -z $VAR(../vif-c/@@) ] && [ ! -z $ACTIVEETHTYPE ] + then echo "Can not change ethertype with vif-c configured" + exit 1 + fi + ETHERTYPE=`echo "$VAR(@)"` + if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi + if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi + ip link delete dev "$VAR(../../@).$VAR(../@)" type vlan proto $ETHTYPE id $VAR(../@) > /dev/null 2>&1 + if ! ip link add link $VAR(../../@) name "$VAR(../../@).$VAR(../@)" type vlan proto $ETHTYPE id $VAR(../@) + then echo "Error creating VLAN device $VAR(../../@).$VAR(../@)" + exit 1 + fi + # if parent is up, then bring VLAN up + if [ $(( $(cat /sys/class/net/$VAR(../../@)/flags) & 1 )) -eq 1 ] + then ip link set "$VAR(../../@).$VAR(../@)" up + fi + /opt/vyatta/sbin/vyatta-link-detect "$VAR(../../@).$VAR(../@)" on diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.def index 0b867411..c4bc9577 100644 --- a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.def +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.def @@ -5,9 +5,8 @@ help: QinQ TAG-S Virtual Local Area Network (VLAN) ID syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094" val_help: u32:0-4094; VLAN ID -create: ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan proto 802.1ad id $VAR(@) || exit 1 - ip link set "$VAR(../@).$VAR(@)" up - /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on - -delete: [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0 - ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto 802.1ad id $VAR(@) +delete: ETHERTYPE=`echo "$VAR(ethertype/@)"` + if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi + if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi + [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0 + ip link delete dev "$VAR(../@).$VAR(@)" type vlan proto $ETHTYPE id $VAR(@) diff --git a/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/ethertype/node.def b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/ethertype/node.def new file mode 100644 index 00000000..9e2d5a54 --- /dev/null +++ b/templates/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/ethertype/node.def @@ -0,0 +1,21 @@ +type: txt +help: Set Ethertype +syntax:expression: $VAR(@) in "0x88A8", "0x8100";"Must be (0x88A8 0x8100)\n" +default: "0x88A8" + +comp_help: possible completions: + 0x88A8 802.1AD + 0x8100 802.1Q + +update: ACTIVEETHTYPE=`cli-shell-api returnActiveValue interfaces pseudo-ethernet $VAR(../../@) vif-s $VAR(../@) ethertype` + if [ ! -z $VAR(../vif-c/@@) ] && [ ! -z $ACTIVEETHTYPE ] + then echo "Can not change ethertype with vif-c configured" + exit 1 + fi + ETHERTYPE=`echo "$VAR(@)"` + if [ $ETHERTYPE == "0x88A8" ]; then ETHTYPE=802.1ad; fi + if [ $ETHERTYPE == "0x8100" ]; then ETHTYPE=802.1Q; fi + ip link delete dev "$VAR(../../@).$VAR(../@)" type vlan proto $ETHTYPE id $VAR(../@) > /dev/null 2>&1 + ip link add link $VAR(../../@) name "$VAR(../../@).$VAR(../@)" type vlan proto $ETHTYPE id $VAR(../@) || exit 1 + ip link set "$VAR(../../@).$VAR(../@)" up + /opt/vyatta/sbin/vyatta-link-detect "$VAR(../../@).$VAR(../@)" on diff --git a/templates/interfaces/tunnel/node.def b/templates/interfaces/tunnel/node.def index f7ffd746..795168f6 100644 --- a/templates/interfaces/tunnel/node.def +++ b/templates/interfaces/tunnel/node.def @@ -40,6 +40,9 @@ create: echo "interfaces tunnel $VAR(@): Tunnel encapsulation type must be gre-bridge if a bridge group is defined"; exit 1; fi + if [ -z "$VAR(./parameters/ip/tos/@)" ]; then + TOS="tos inherit" + fi if [ -z "$VAR(./parameters/ip/ttl/@)" ]; then TTL="ttl 255" fi @@ -47,9 +50,9 @@ create: KEY="key $VAR(./parameters/ip/key/@)"; fi if [ "$VAR(./encapsulation/@)" == "gre" ] && [ -z $VAR(./remote-ip/) ]; then - ip tunnel add $VAR(@) local $VAR(./local-ip/@) mode gre $KEY $TTL + ip tunnel add $VAR(@) local $VAR(./local-ip/@) mode gre $KEY $TTL $TOS else - ip tunnel add $VAR(@) local $VAR(./local-ip/@) remote $VAR(./remote-ip/@) mode $VAR(./encapsulation/@) $KEY $TTL + ip tunnel add $VAR(@) local $VAR(./local-ip/@) remote $VAR(./remote-ip/@) mode $VAR(./encapsulation/@) $KEY $TTL $TOS fi if [ -z "`ip tun sh | grep $VAR(@)`" ]; then echo interfaces tunnel $VAR(@): error creating tunnel interface diff --git a/templates/service/dns/dynamic/interface/node.tag/use-web/node.def b/templates/service/dns/dynamic/interface/node.tag/use-web/node.def new file mode 100644 index 00000000..f1b86b6d --- /dev/null +++ b/templates/service/dns/dynamic/interface/node.tag/use-web/node.def @@ -0,0 +1 @@ +help: Web check used for obtaining the external IP address diff --git a/templates/service/dns/dynamic/interface/node.tag/use-web/skip/node.def b/templates/service/dns/dynamic/interface/node.tag/use-web/skip/node.def new file mode 100644 index 00000000..f316a4b5 --- /dev/null +++ b/templates/service/dns/dynamic/interface/node.tag/use-web/skip/node.def @@ -0,0 +1,2 @@ +help: Skip everything before this on the given URL +type: txt diff --git a/templates/service/dns/dynamic/interface/node.tag/use-web/url/node.def b/templates/service/dns/dynamic/interface/node.tag/use-web/url/node.def new file mode 100644 index 00000000..164ddde4 --- /dev/null +++ b/templates/service/dns/dynamic/interface/node.tag/use-web/url/node.def @@ -0,0 +1,2 @@ +help: URL to obtain the current external IP address +type: txt diff --git a/templates/service/dns/forwarding/domain/node.tag/server/node.def b/templates/service/dns/forwarding/domain/node.tag/server/node.def index 3dec7d5d..8f40a299 100644 --- a/templates/service/dns/forwarding/domain/node.tag/server/node.def +++ b/templates/service/dns/forwarding/domain/node.tag/server/node.def @@ -1,2 +1,3 @@ +multi: type: ipv4 help: DNS server to forward queries diff --git a/templates/system/console/device/node.tag/speed/node.def b/templates/system/console/device/node.tag/speed/node.def index 8453f67d..e7515dca 100644 --- a/templates/system/console/device/node.tag/speed/node.def +++ b/templates/system/console/device/node.tag/speed/node.def @@ -1,6 +1,5 @@ type: u32 help: Console baud rate -default: 9600 allowed: echo 1200 2400 4800 9600 19200 38400 57600 115200 syntax:expression: $VAR(@) in 1200, 2400, 4800, 9600, 19200, 38400, \ 57600, 115200 ; "unknown baud rate" @@ -8,9 +7,9 @@ syntax:expression: $VAR(@) in 1200, 2400, 4800, 9600, 19200, 38400, \ val_help: 1200; 1200 bps val_help: 2400; 2400 bps val_help: 4800; 4800 bps -val_help: 9600; 9600 bps (default) +val_help: 9600; 9600 bps (default for serial console) val_help: 19200; 19,200 bps -val_help: 38400; 38,400 bps +val_help: 38400; 38,400 bps (default for Xen console) val_help: 57600; 57,600 bps val_help: 115200; 115,200 bps diff --git a/templates/system/ipv6/disable-forwarding/node.def b/templates/system/ipv6/disable-forwarding/node.def index 5e689c5b..323b99d6 100644 --- a/templates/system/ipv6/disable-forwarding/node.def +++ b/templates/system/ipv6/disable-forwarding/node.def @@ -38,7 +38,7 @@ delete: # forwarding was disabled, we will need to start the radvd daemon # now. running=$(pgrep -n radvd) - if [[ $running -eq 0 ]] && + if [[ -z "$running" ]] && [[ -e /etc/radvd.conf ]] && [[ -x /etc/init.d/radvd ]]; then /etc/init.d/radvd start |