Skip to content

Bug: Broadcast discovery assumes /24 subnets #24

Open

Description

@LinuxSuRen

Background

transfer send without an explicit IP discovers receivers via a periodic UDP broadcast sent by transfer wait.

Description

pkg/broadcast.go:52 derives the broadcast address as:

ip.To4()[3] = 255

This only equals the real broadcast address on /24 networks. On any other prefix length (/16, /23, /26 — common on corporate, Docker and home networks) the packet goes to a wrong address and discovery silently fails — transfer send then blocks forever waiting for a waiter.

Technical requirement

Basic Go networking (net.Interface, *net.IPNet). The mask is already available where the addresses are collected — i.Addrs() returns *net.IPNet which carries it.

Expect

  • compute broadcast = ip | ^mask from the actual IPNet mask per address,
  • keep skipping link-local/loopback/non-IPv4 as today,
  • discovery works on non-/24 subnets.

Potential TODO list

  • collect (ip, mask) pairs in Broadcast
  • compute the proper broadcast address per subnet
  • add a unit test with a /16 and a /26 example

Activity

  1. added
    bug
    good first issue
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions