Deleted Added
full compact
scriptdump.pl (62583) scriptdump.pl (78064)
1#! @LOCALPREFIX@/bin/perl
1#! @LOCALPREFIX@/bin/perl
2# $FreeBSD: head/sbin/setkey/scriptdump.pl 62583 2000-07-04 16:22:05Z itojun $
2# $FreeBSD: head/sbin/setkey/scriptdump.pl 78064 2001-06-11 12:39:29Z ume $
3
4if ($< != 0) {
5 print STDERR "must be root to invoke this\n";
6 exit 1;
7}
8
9$mode = 'add';
10while ($i = shift @ARGV) {

--- 17 unchanged lines hidden (view full) ---

28 $ekey =~ s/\s//g;
29 $ekey =~ s/^/0x/g;
30 } elsif (/^\tA: (\S+) (.*)/) {
31 $aalgo = $1;
32 $akey = $2;
33 $akey =~ s/\s//g;
34 $akey =~ s/^/0x/g;
35 } elsif (/^\treplay=(\d+) flags=(0x\d+) state=/) {
3
4if ($< != 0) {
5 print STDERR "must be root to invoke this\n";
6 exit 1;
7}
8
9$mode = 'add';
10while ($i = shift @ARGV) {

--- 17 unchanged lines hidden (view full) ---

28 $ekey =~ s/\s//g;
29 $ekey =~ s/^/0x/g;
30 } elsif (/^\tA: (\S+) (.*)/) {
31 $aalgo = $1;
32 $akey = $2;
33 $akey =~ s/\s//g;
34 $akey =~ s/^/0x/g;
35 } elsif (/^\treplay=(\d+) flags=(0x\d+) state=/) {
36 print "$mode $src $dst $proto $spi -m $ipsecmode";
36 print "$mode $src $dst $proto $spi";
37 $replay = $1;
38 print " -u $reqid" if $reqid;
39 if ($mode eq 'add') {
37 $replay = $1;
38 print " -u $reqid" if $reqid;
39 if ($mode eq 'add') {
40 print " -r $replay" if $replay;
40 print " -m $ipsecmode -r $replay" if $replay;
41 if ($proto eq 'esp') {
42 print " -E $ealgo $ekey" if $ealgo;
43 print " -A $aalgo $akey" if $aalgo;
44 } elsif ($proto eq 'ah') {
45 print " -A $aalgo $akey" if $aalgo;
46 }
47 }
48 print ";\n";
49
50 $src = $dst = $upper = $proxy = '';
51 $ealgo = $ekey = $aalgo = $akey = '';
52 }
53}
54close(IN);
55
56exit 0;
41 if ($proto eq 'esp') {
42 print " -E $ealgo $ekey" if $ealgo;
43 print " -A $aalgo $akey" if $aalgo;
44 } elsif ($proto eq 'ah') {
45 print " -A $aalgo $akey" if $aalgo;
46 }
47 }
48 print ";\n";
49
50 $src = $dst = $upper = $proxy = '';
51 $ealgo = $ekey = $aalgo = $akey = '';
52 }
53}
54close(IN);
55
56exit 0;