Ignore:
Timestamp:
Jan 21, 2013 11:05:56 PM (11 years ago)
Author:
Ted Faber <faber@…>
Branches:
master
Children:
328e93f
Parents:
5dbcc93 (diff), dcac546 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of git://fedd.deterlab.net/fedd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/gateway_lib.pm

    r5dbcc93 r06a2b49  
    3333my $IPROUTE = "/sbin/ip route ";
    3434
     35$BRCTL = '/sbin/brctl' unless -x $BRCTL ;
     36
    3537# Takes an ssh config file and a reference to a hash of keys whose values must
    3638# be set a specific way.  Replaces existing entries with the set values.
     
    4446    $t = new File::Temp() || die "Can't open tempfile: $!\n";
    4547
     48    # If the parameter is in the file (even in a comment) update the line to
     49    # have the new parameter.
     50    my %updated;
    4651    while (<$f>) {
    4752        foreach my $k (keys %{$keys}) {
    48             s/^\s*#?\s*$k.*/$k $keys->{$k}/;
     53            if (s/^\s*#?\s*$k.*/$k $keys->{$k}/) { $updated{$k}++; }
    4954        }
    5055        print $t $_;
     56    }
     57    # Any parameters not found above are output directly.
     58    foreach my $k (keys %{$keys}) {
     59        print $t "$k " . $keys->{$k} . "\n" unless $updated{$k};
    5160    }
    5261    $f->close();
     
    278287    $ipipe->reader("$IFCONFIG");
    279288    while(<$ipipe>) {
    280         /^([[:alnum:]]+):/ && do {
     289        /^([[:alnum:]]+):?/ && do {
    281290            $iface = $1;
    282291            next;
    283292        };
    284         /inet\s+([0-9\.]+)/ && do {
    285             if ($1 eq $addr) {
     293        /inet(\s+addr:)?\s*([0-9\.]+)/ && do {
     294            if ($2 eq $addr) {
    286295                $ipipe->close();
    287296                return $iface;
Note: See TracChangeset for help on using the changeset viewer.