diff options
-rwxr-xr-x | scripts/vyatta-ipsec-dhcp.pl | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/vyatta-ipsec-dhcp.pl b/scripts/vyatta-ipsec-dhcp.pl index e034810..61e5e02 100755 --- a/scripts/vyatta-ipsec-dhcp.pl +++ b/scripts/vyatta-ipsec-dhcp.pl @@ -91,11 +91,10 @@ close FD; open my $output_secrets, '>', $secrets_file or die "Can't open $secrets_file"; foreach my $line (@lines){ - if (($line =~ /\#dhcp-interface=(.*)\#/) && ($1 eq $iface)){ - $line =~ s/^$oip/$nip/; - if (!($line =~ /^oip/)){ - $line =~ s/^/$nip/; - } + if (($line =~ /(.*)\#dhcp-interface=(.*)\#/) && ($2 eq $iface)){ + my $secretline = $1; + $secretline =~ /(.*?) (.*?) : PSK (.*)/; + $line = "$nip $2 : PSK $3\#dhcp-interface=$iface\#\n"; } print ${output_secrets} $line; } |