libreswan/SOURCES/libreswan-3.29-1699318-show.patch

39 lines
1.3 KiB
Diff
Raw Normal View History

2019-11-05 18:48:41 +00:00
diff -Naur libreswan-3.29-orig/programs/show/show.in libreswan-3.29/programs/show/show.in
--- libreswan-3.29-orig/programs/show/show.in 2019-07-31 20:03:51.794714920 -0400
+++ libreswan-3.29/programs/show/show.in 2019-07-31 20:02:38.792224647 -0400
@@ -1,7 +1,7 @@
#!/usr/bin/python
import sys
-import commands
+import subprocess
import argparse
try:
import ipaddress
@@ -42,14 +42,14 @@
source = args.source
else:
getsrccmd = "ip -o ro get %s" % dest
- status, output = commands.getstatusoutput(getsrccmd)
+ output = subprocess.getoutput([getsrccmd])
try:
source = output.split("src")[1].strip().split(" ")[0]
except Exception:
sys.exit("failed to find source ip for destination %s" % dest)
if args.debug:
- print "Need to find matching IPsec policy for %s/32 <=> %s/32" % (source, dest)
+ print("Need to find matching IPsec policy for %s/32 <=> %s/32" % (source, dest))
if dest:
if "/" in source:
@@ -65,7 +65,7 @@
sys.exit(1)
ipxfrmcmd = 'ip -o xfrm pol | grep -v socket | grep "dir out"'
- status, output = commands.getstatusoutput(ipxfrmcmd)
+ output = subprocess.getoutput([ipxfrmcmd])
polsrc = ""
poldst = ""
for line in output.split("\n"):