summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-12-31 14:30:46 +0100
committerDaniil Baturin <daniil@baturin.org>2018-12-31 14:30:46 +0100
commit77d7e727faa5725735fd2b7742722a3f7f71d52f (patch)
treea29deba34f6ea07434886b2c86051cd45e40d04b
parentfc5f75c23fa3c7f93e982433705ab8971dbbabff (diff)
parentd50524722819582cc1d7ad289d12e9f585f701de (diff)
downloadvyos-1x-77d7e727faa5725735fd2b7742722a3f7f71d52f.tar.gz
vyos-1x-77d7e727faa5725735fd2b7742722a3f7f71d52f.zip
Merge branch 'current' into crux
-rw-r--r--debian/control1
-rwxr-xr-xsrc/conf_mode/host_name.py6
-rwxr-xr-xsrc/migration-scripts/quagga/2-to-317
-rwxr-xr-xsrc/op_mode/show_ipsec_sa.py15
4 files changed, 34 insertions, 5 deletions
diff --git a/debian/control b/debian/control
index 7061d50ef..93608d888 100644
--- a/debian/control
+++ b/debian/control
@@ -35,6 +35,7 @@ Depends: python3,
lsscsi,
pciutils,
usbutils,
+ procps,
snmp, snmpd,
openssh-server,
ntp,
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index 3b3958f7f..030735215 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -100,9 +100,13 @@ def apply(config):
"""Apply configuration"""
os.system("hostnamectl set-hostname --static {0}".format(config["fqdn"]))
- # restart services that use the hostname
+ # Restart services that use the hostname
os.system("systemctl restart rsyslog.service")
+ # If SNMP is running, restart it too
+ if os.system("pgrep snmpd > /dev/null") == 0:
+ os.system("systemctl restart snmpd.service")
+
return None
diff --git a/src/migration-scripts/quagga/2-to-3 b/src/migration-scripts/quagga/2-to-3
index 99d96a0aa..4c1cd86a3 100755
--- a/src/migration-scripts/quagga/2-to-3
+++ b/src/migration-scripts/quagga/2-to-3
@@ -178,6 +178,23 @@ else:
for peer_group in peer_groups:
migrate_neighbor(config, peer_group_path, peer_group)
+ ## Migrate redistribute statements
+ redistribute_path = ['protocols', 'bgp', asn, 'redistribute']
+ if config.exists(redistribute_path):
+ config.set(bgp_path + af_path + ['redistribute'])
+
+ redistributes = config.list_nodes(redistribute_path)
+ for redistribute in redistributes:
+ config.set(bgp_path + af_path + ['redistribute', redistribute])
+ if config.exists(redistribute_path + [redistribute, 'metric']):
+ redist_metric = config.return_value(redistribute_path + [redistribute, 'metric'])
+ config.set(bgp_path + af_path + ['redistribute', redistribute, 'metric'], value=redist_metric)
+ if config.exists(redistribute_path + [redistribute, 'route-map']):
+ redist_route_map = config.return_value(redistribute_path + [redistribute, 'route-map'])
+ config.set(bgp_path + af_path + ['redistribute', redistribute, 'route-map'], value=redist_route_map)
+
+ config.delete(redistribute_path)
+
try:
with open(file_name, 'w') as f:
f.write(config.to_string())
diff --git a/src/op_mode/show_ipsec_sa.py b/src/op_mode/show_ipsec_sa.py
index 3c8d678eb..117824632 100755
--- a/src/op_mode/show_ipsec_sa.py
+++ b/src/op_mode/show_ipsec_sa.py
@@ -1,14 +1,21 @@
#!/usr/bin/env python3
import re
+import sys
import subprocess
import tabulate
import hurry.filesize
def parse_conn_spec(s):
- # Example: ESTABLISHED 14 seconds ago, 10.0.0.2[foo]...10.0.0.1[10.0.0.1]
- return re.search(r'.*ESTABLISHED\s+(.*)ago,\s(.*)\[(.*)\]\.\.\.(.*)\[(.*)\].*', s).groups()
+ try:
+ # Example: ESTABLISHED 14 seconds ago, 10.0.0.2[foo]...10.0.0.1[10.0.0.1]
+ return re.search(r'.*ESTABLISHED\s+(.*)ago,\s(.*)\[(.*)\]\.\.\.(.*)\[(.*)\].*', s).groups()
+ except AttributeError:
+ # No active SAs found, so we have nothing to display
+ print("No established security associations found.")
+ print("Use \"show vpn ipsec sa\" to view inactive and connecting tunnels.")
+ sys.exit(0)
def parse_ike_line(s):
try:
@@ -42,8 +49,8 @@ for conn in connections:
enc, hash, dh, bytes_in, bytes_out = parse_ike_line(status)
# Convert bytes to human-readable units
- bytes_in = hurry.filesize.size(bytes_in)
- bytes_out = hurry.filesize.size(bytes_out)
+ bytes_in = hurry.filesize.size(int(bytes_in))
+ bytes_out = hurry.filesize.size(int(bytes_out))
status_line = [conn, "up", time, "{0}/{1}".format(bytes_in, bytes_out), ip, id, "{0}/{1}/{2}".format(enc, hash, dh)]
except Exception as e: