]>
git.saurik.com Git - apple/ipsec.git/blob - ipsec-tools/setkey/scriptdump.pl
1 #! @LOCALPREFIX@/bin/perl
4 print STDERR
"must be root to invoke this\n";
9 while ($i = shift @ARGV) {
13 print STDERR
"usage: scriptdump [-d]\n";
18 open(IN
, "setkey -D |") || die;
21 ($src, $dst) = split(/\s+/, $_);
22 } elsif (/^\t(esp|ah) mode=(\S+) spi=(\d+).*reqid=(\d+)/) {
23 ($proto, $ipsecmode, $spi, $reqid) = ($1, $2, $3, $4);
24 } elsif (/^\tE: (\S+) (.*)/) {
29 } elsif (/^\tA: (\S+) (.*)/) {
34 } elsif (/^\tseq=(0x\d+) replay=(\d+) flags=(0x\d+) state=/) {
35 print "$mode $src $dst $proto $spi";
37 print " -u $reqid" if $reqid;
39 print " -m $ipsecmode -r $replay" if $replay;
40 if ($proto eq 'esp') {
41 print " -E $ealgo $ekey" if $ealgo;
42 print " -A $aalgo $akey" if $aalgo;
43 } elsif ($proto eq 'ah') {
44 print " -A $aalgo $akey" if $aalgo;
49 $src = $dst = $upper = $proxy = '';
50 $ealgo = $ekey = $aalgo = $akey = '';