Receiving INADDR_BROADCAST packets

From: Bruce M Simpson (bms_at_spc.org)
Date: 08/22/03

  • Next message: Supote Leelasupphakorn: "How can I subnetting my network ?"
    Date: Fri, 22 Aug 2003 12:16:36 +0100
    To: freebsd-net@freebsd.org
    
    

    Hi all,

    Ok, the broadcast sending problem is solved, as far as I'm concerned.

    However, the reception problem isn't:
       14766 broadcast/multicast datagrams dropped due to no socket

    This despite:
    wi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
            inet 1.234.56.78 netmask 0xff000000 broadcast 1.255.255.255
    udp4 0 0 1.234.56.78.654 *.*

    I can:
    a) patch udp_input() to pass INADDR_BROADCAST traffic to all sockets bound
       to the port and on the interface where the traffic was received.
       Possibly conditionalise this interface based on a socket-level option.
       e.g. 'Yes, I'm an interface-bound socket and I'd like undirected
       broadcasts on my interface thankyou very much'. This would be done in
       such a way which was 'opt-in' and didn't impact existing applications.
    b) preserve the existing 4.2BSD kludge of binding to INADDR_ANY and not
       knowing what interface an undirected broadcast came in on.
    c) same as b) but use IP_RECVIF to determine which interface the broadcast
       came in on, and change my network event dispatch code accordingly.
    d) use a SOCK_RAW socket.
    e) use BPF.

    b), d), e) are not solutions. They are cop-outs.
    Please don't suggest them. Really.

    I note that Apple are using IP_RECVIF in their mDNS code. The problem
    there is not the same (they're dealing with multicasts), but similar.

    I already cache the interface index in my internal RIB and track RTM_IFINFO,
    RTM_IFANNOUNCE events, so this isn't too big a hit (the fact that this
    ioctl provides an index, not a name).

    I'm going to go with solution c) for now, but has anyone considered a)?
    (Little choice really, we have a code freeze coming up, and I'd like my
    code to run unchanged on 4.9-RELEASE).

    BMS
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"


  • Next message: Supote Leelasupphakorn: "How can I subnetting my network ?"

    Relevant Pages

    • Re: Odd routing problem
      ... >>socket gets closed by the system or by ntpd after $NUM errors. ... > did it) - but while it's one socket per interface, ... So it drops the socket but keeps on sending to the broadcast address ...
      (comp.unix.bsd.freebsd.misc)
    • Re: Receiving UDP Broadcasts on Solaris 9, 10
      ... to retrieve the address of the local interface that received a broadcast ... Binding to the broadcast address and receiving messages is not ... The portable way to do things like this is to bind a different socket to ...
      (comp.unix.programmer)
    • Re: broadcast udp packets ...
      ... When I use a udp socket bound to an interface, ... > would seem that if you were requesting the packet be routed, ... It's a broadcast, the socket isn't bound to an interface. ...
      (freebsd-net)
    • Re: Raw socket PF_PACKET questions
      ... I have collected some info from man page for receving broadcast ... sll_ifindex is the interface index of the interface ... sll_pkttype contains the packet type. ... looped back to a packet socket. ...
      (comp.os.linux.networking)
    • Re: [PATCH} Network interface for IPMI
      ... af_ipmi - A network socket interface to IPMI. ... -Note that the KCS-only interface ahs been removed. ... struct sockaddr_ipmi saddr; ...
      (Linux-Kernel)