[lkml]   [2004]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: UDP sockets bound to ANY send answers with wrong src ip address
    On Wed, Jun 09, 2004 at 02:25:39PM +0300, Denis Vlasenko wrote:
    > I observe that UDP sockets listening on ANY
    > send response packets with ip addr derived from
    > ip address of interface which is used to send 'em
    > instead of using dst ip address of client's packet.
    > I was bitten by this with DNS and NTP.

    This is the responsibility of the program. Unless the UDP packet is
    bound to a particular address, or the program specifies an IP, the
    kernel will pick one. For this reason both the BIND and NTP daemons
    open a socket for each interface so they can control this. netstat on
    my machine shows:

    udp 0 0*
    udp 0 0*
    udp 0 0*

    for the NTP server. The DNS has similar machanism. Remember, UDP
    doesn't involve connections, so there is no concept of "replying" to a
    packet, the program has to manage that itself.

    In your example, if you tell netcat which address to bind to, it will

    Hope this helps,
    Martijn van Oosterhout <>
    > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
    > tool for doing 5% of the work and then sitting around waiting for someone
    > else to do the other 95% so you can sue them.
    [unhandled content-type:application/pgp-signature]
     \ /
      Last update: 2005-03-22 14:03    [W:0.022 / U:37.740 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site