Bugzilla – Bug 69
Source IP address is not set correctly
Last modified: 2008-07-01 13:32:17 UTC
Packets sent (at least via sockets) have a source IP address of 0.0.0.0
Created attachment 46 [details] patch extracted from craigdo/ns-3-mc
Created attachment 47 [details] Additional patch for Source IP 0.0.0.0 Minor changes to UDPSocket to fix SendTo()/Connect() and 0 Source IP problems. **Note that this requires Tom's patch for this be applied first.** Changes include: - Making source IP addresses be reoprted correctly when using SendTo() - Enable using Connect() to provide optional defaults for Send(), overridden by using SendTo()
Created attachment 49 [details] this patch supersedes previous 2, and depends on bug65.patch
Created attachment 50 [details] UDP broadcast; builds on previous patch This supports UDP broadcast to 255.255.255.255; each such packet is converted to a subnet-directed broadcast and sent out on each Ipv4 interface. I provided an example program (csma-broadcast.cc) that tests this behavior; however, I had to slightly hack OnOffApplication because it uses UDP connect(), which is incompatible with broadcast. So, we either need to clean up OnOffApplication to use SendTo(), or find a new sample application (UDP ping?) for csma-broadcast.cc.
Why is it impossible to use 255....255 as an argument to Connect ? I know that it will not work for tcp sockets, but we just need to define what happens with udp sockets and document it somewhere, in udp-socket.h for example (in a similar way to the packet-socket.h header).
I thought it was illegal, but just checked and discovered that it is legal but such a connected socket is limited to exchanging datagrams with only one peer. So I think it is probably best to just fix it so that connect can work (I had put the restriction into udp-socket and can revert that).
Created attachment 51 [details] fix for Mathieu's comment This fixes two things: - allows connect() to broadcast address (and reverts the hack on OnOffApplication) - fixes semantics of SendTo() for connected socket-- sendto cannot overwrite the default addr/port of a connected socket
fixed by ns-3-dev changesets 1317 and 1318
Oops, sorry, didn't mean to reopen this bug... bad bugzilla interface! :P