Skip to content

Send outgoing packets for every address#462

Open
anti-social wants to merge 1 commit intokeepsimple1:mainfrom
anti-social:multi-addr-if
Open

Send outgoing packets for every address#462
anti-social wants to merge 1 commit intokeepsimple1:mainfrom
anti-social:multi-addr-if

Conversation

@anti-social
Copy link
Copy Markdown
Contributor

@anti-social anti-social commented Apr 23, 2026

Partially fixes #459

@keepsimple1
Copy link
Copy Markdown
Owner

Thanks for submitting the PR! I understand it's still in Draft, but I have a general comment: can we split this PR into smaller ones that are relatively independent (or built on-top) of each other? That will make review and merge much easier.

For example, those cleanup changes can be in one PR:

  • println!debug! in DnsHostInfo::write.
  • u32-overflow fix in get_expiration_time.
  • add Debug derives on DnsOutPacket, etc.

@anti-social
Copy link
Copy Markdown
Contributor Author

anti-social commented Apr 27, 2026

I've fixed u32 overflow in a PR that optimizes dns packet serialization because I caught it in tests that were written for the PR

#465 #466 #467

Comment thread src/service_daemon.rs
/// Resend unregister packet.
UnregisterResend(Vec<u8>, u32, bool), // (packet content, if_index, is_ipv4)
/// Resend unregister packets.
UnregisterResend(Vec<DnsOutPacket>, u32, bool), // (packets to resend, if_index, is_ipv4)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We changed this variant thus DnsOutPacket should implement std::fmt::Debug

@anti-social anti-social force-pushed the multi-addr-if branch 3 times, most recently from 95ca00f to 0814fba Compare May 1, 2026 22:26
@anti-social anti-social marked this pull request as ready for review May 1, 2026 22:34
Copy link
Copy Markdown
Owner

@keepsimple1 keepsimple1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is somewhat non-trivial change, could you please add a detailed PR description:

  • What's the problem? (motivation)
  • Changes (approach or the solution)

That will also help the reader understand which part of #459 is addressed by this PR.

And could you please also add new test case to cover the multi-address-per-interface case that motivated this change?

Thanks!

Comment thread src/service_daemon.rs

send_dns_outgoing_impl(out, if_name, my_intf.index, if_addr, sock, port)
let mut invalid_interfaces = HashSet::new();
let packets = out.to_packets();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems it would return packets even when no address was actually sent on.

Comment thread src/service_daemon.rs
};
sent_vec.into_iter().next().unwrap_or_default()
let (sent_packets, invalid_intf_addrs) = send_dns_outgoing(&out, intf, sock, self.port);
let _ = self.send_cmd_to_self(Command::InvalidIntfAddrs(invalid_intf_addrs));
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sends the InvalidIntfAddrs command even if invalid_intf_addrs is empty.

Comment thread src/service_daemon.rs
let is_ipv4 = sock.domain() == Domain::IPV4;
if let Some(out) = prepare_announce(info, intf, dns_registry, is_ipv4) {
let _ = send_dns_outgoing(&out, intf, sock, port, None)?;
let _ = send_dns_outgoing(&out, intf, sock, port);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call used to propagate the error back to the caller. Now it silently ignores the error.

Comment thread src/dns_parser.rs

/// Returns a list of actual DNS packet data to be sent on the wire.
pub fn to_data_on_wire(&self) -> Vec<Vec<u8>> {
pub(crate) fn _to_data_on_wire(&self) -> Vec<Vec<u8>> {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems odd as it's still used. If you removed it completely and replace the call sites with direct alternative calls, I'm ok with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple interface address case

2 participants