diff options
| author | cvs2svn <cvs2svn@FreeBSD.org> | 2003-12-07 03:02:28 +0000 |
|---|---|---|
| committer | cvs2svn <cvs2svn@FreeBSD.org> | 2003-12-07 03:02:28 +0000 |
| commit | a348451bd8bd6d66bcb5b23f2aaec00e74c1292f (patch) | |
| tree | 9ec09934982086efda46b256741376768b702210 /sbin/setkey/scriptdump.pl | |
| parent | e56b2c57d71d0f9232936aaac58617fed29ac33d (diff) | |
Notes
Diffstat (limited to 'sbin/setkey/scriptdump.pl')
| -rw-r--r-- | sbin/setkey/scriptdump.pl | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/sbin/setkey/scriptdump.pl b/sbin/setkey/scriptdump.pl deleted file mode 100644 index a1d8adb207bc..000000000000 --- a/sbin/setkey/scriptdump.pl +++ /dev/null @@ -1,56 +0,0 @@ -#! @LOCALPREFIX@/bin/perl -# $FreeBSD$ - -if ($< != 0) { - print STDERR "must be root to invoke this\n"; - exit 1; -} - -$mode = 'add'; -while ($i = shift @ARGV) { - if ($i eq '-d') { - $mode = 'delete'; - } else { - print STDERR "usage: scriptdump [-d]\n"; - exit 1; - } -} - -open(IN, "setkey -D |") || die; -foreach $_ (<IN>) { - if (/^[^\t]/) { - ($src, $dst) = split(/\s+/, $_); - } elsif (/^\t(esp|ah) mode=(\S+) spi=(\d+).*reqid=(\d+)/) { - ($proto, $ipsecmode, $spi, $reqid) = ($1, $2, $3, $4); - } elsif (/^\tE: (\S+) (.*)/) { - $ealgo = $1; - $ekey = $2; - $ekey =~ s/\s//g; - $ekey =~ s/^/0x/g; - } elsif (/^\tA: (\S+) (.*)/) { - $aalgo = $1; - $akey = $2; - $akey =~ s/\s//g; - $akey =~ s/^/0x/g; - } elsif (/^\tseq=(0x\d+) replay=(\d+) flags=(0x\d+) state=/) { - print "$mode $src $dst $proto $spi"; - $replay = $2; - print " -u $reqid" if $reqid; - if ($mode eq 'add') { - print " -m $ipsecmode -r $replay" if $replay; - if ($proto eq 'esp') { - print " -E $ealgo $ekey" if $ealgo; - print " -A $aalgo $akey" if $aalgo; - } elsif ($proto eq 'ah') { - print " -A $aalgo $akey" if $aalgo; - } - } - print ";\n"; - - $src = $dst = $upper = $proxy = ''; - $ealgo = $ekey = $aalgo = $akey = ''; - } -} -close(IN); - -exit 0; |
