GetDNSConfig() ignores -4 and -6 flags #26

Closed
opened 2022-07-03 19:25:58 +00:00 by sam · 1 comment
Owner

To reproduce:

  • Have a server that supports IPv6
  • Have an /etc/resolv.conf that has IPv4 and IPv6 address in it
  • run awl -4 or awl -6

Approximately half of the time something like dial udp4: address [IPv6]: no suitable address found will happen

To reproduce: - Have a server that supports IPv6 - Have an /etc/resolv.conf that has IPv4 and IPv6 address in it - run `awl -4` or `awl -6` Approximately half of the time something like `dial udp4: address [IPv6]: no suitable address found` will happen
Author
Owner

What happens:

At

Line 196 in 85a00bf
resp.Answers.Server = resolv.Servers[rand.Intn(len(resolv.Servers))]

, the program grabs a random IP address from /etc/resolv.conf

What should happen

Line 196 in 85a00bf
resp.Answers.Server = resolv.Servers[rand.Intn(len(resolv.Servers))]

should be refactored to only return IPv4 addresses if -4 is passed or IPv6 addresses if -6 is passed

## What happens: At https://git.froth.zone/sam/awl/src/commit/85a00bffbff14d11f369435693f4d791d6bcc03e/cli.go#L196, the program grabs a random IP address from /etc/resolv.conf ## What should happen https://git.froth.zone/sam/awl/src/commit/85a00bffbff14d11f369435693f4d791d6bcc03e/cli.go#L196 should be refactored to only return IPv4 addresses if `-4` is passed or IPv6 addresses if `-6` is passed
sam referenced this issue from a commit 2022-07-03 20:00:46 +00:00
sam added this to the awl v0.3 release candidate project 2022-07-03 20:03:58 +00:00
sam referenced this issue from a commit 2022-07-03 20:45:13 +00:00
sam closed this issue 2022-07-03 20:45:35 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: sam/awl#26
No description provided.