Skip to content

Commit

Permalink
@resolve returns IP addresses as-is
Browse files Browse the repository at this point in the history
We're using Net::DNS, but this library is incapable of "resolving" raw
IP addresses.  It is convenient to pass a "mixed" list to @resolve,
and trust that @resolve does the right thing.
  • Loading branch information
MaxKellermann committed Jul 4, 2016
1 parent 4aaf958 commit 562c810
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
v2.3.1 - not yet released
- updated netfilter modules:
* connlimit: add connlimit-upto, connlimit-saddr, connlimit-daddr
- @resolve returns IP addresses as-is


v2.3 - 30 Mar 2016
Expand Down
7 changes: 7 additions & 0 deletions src/ferm
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,13 @@ sub resolve($\@$) {
my @result;
foreach my $hostname (@$names) {
if (($type eq 'A' and $hostname =~ /^\d+\.\d+\.\d+\.\d+$/) or
(($type eq 'AAAA' and
$hostname =~ /^[0-9a-fA-F:]*:[0-9a-fA-F:]*$/))) {
push @result, $hostname;
next;
}
my $query = $resolver->search($hostname, $type);
error("DNS query for '$hostname' failed: " . $resolver->errorstring)
unless $query;
Expand Down

0 comments on commit 562c810

Please sign in to comment.