Changeset 06a2b49 for fedkit/gateway_lib.pm
- Timestamp:
- Jan 21, 2013 11:05:56 PM (11 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedkit/gateway_lib.pm
r5dbcc93 r06a2b49 33 33 my $IPROUTE = "/sbin/ip route "; 34 34 35 $BRCTL = '/sbin/brctl' unless -x $BRCTL ; 36 35 37 # Takes an ssh config file and a reference to a hash of keys whose values must 36 38 # be set a specific way. Replaces existing entries with the set values. … … 44 46 $t = new File::Temp() || die "Can't open tempfile: $!\n"; 45 47 48 # If the parameter is in the file (even in a comment) update the line to 49 # have the new parameter. 50 my %updated; 46 51 while (<$f>) { 47 52 foreach my $k (keys %{$keys}) { 48 s/^\s*#?\s*$k.*/$k $keys->{$k}/;53 if (s/^\s*#?\s*$k.*/$k $keys->{$k}/) { $updated{$k}++; } 49 54 } 50 55 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}; 51 60 } 52 61 $f->close(); … … 278 287 $ipipe->reader("$IFCONFIG"); 279 288 while(<$ipipe>) { 280 /^([[:alnum:]]+): / && do {289 /^([[:alnum:]]+):?/ && do { 281 290 $iface = $1; 282 291 next; 283 292 }; 284 /inet \s+([0-9\.]+)/ && do {285 if ($ 1eq $addr) {293 /inet(\s+addr:)?\s*([0-9\.]+)/ && do { 294 if ($2 eq $addr) { 286 295 $ipipe->close(); 287 296 return $iface;
Note: See TracChangeset
for help on using the changeset viewer.