Bug 69 - Source IP address is not set correctly
Source IP address is not set correctly
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: internet
pre-release
All All
: P1 normal
Assigned To: ns-bugs
:
Depends on: 65
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-14 15:04 UTC by Craig Dowell
Modified: 2008-07-01 13:32 UTC (History)
0 users

See Also:


Attachments
patch extracted from craigdo/ns-3-mc (7.60 KB, text/x-patch)
2007-08-23 02:26 UTC, Tom Henderson
Details
Additional patch for Source IP 0.0.0.0 (2.27 KB, patch)
2007-08-24 15:24 UTC, Joe Kopena
Details | Diff
this patch supersedes previous 2, and depends on bug65.patch (5.60 KB, patch)
2007-09-04 02:38 UTC, Tom Henderson
Details | Diff
UDP broadcast; builds on previous patch (12.66 KB, patch)
2007-09-05 02:28 UTC, Tom Henderson
Details | Diff
fix for Mathieu's comment (15.59 KB, patch)
2007-09-05 03:02 UTC, Tom Henderson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Dowell 2007-08-14 15:04:11 UTC
Packets sent (at least via sockets) have a source IP address of 0.0.0.0
Comment 1 Tom Henderson 2007-08-23 02:26:43 UTC
Created attachment 46 [details]
patch extracted from craigdo/ns-3-mc
Comment 2 Joe Kopena 2007-08-24 15:24:44 UTC
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()
Comment 3 Tom Henderson 2007-09-04 02:38:10 UTC
Created attachment 49 [details]
this patch supersedes previous 2, and depends on bug65.patch
Comment 4 Tom Henderson 2007-09-05 02:28:47 UTC
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.
Comment 5 Mathieu Lacage 2007-09-05 02:34:19 UTC
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).
Comment 6 Tom Henderson 2007-09-05 02:46:53 UTC
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).
Comment 7 Tom Henderson 2007-09-05 03:02:04 UTC
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
Comment 8 Tom Henderson 2007-09-08 18:18:00 UTC
fixed by ns-3-dev changesets 1317 and 1318
Comment 9 Gustavo J. A. M. Carneiro 2007-09-21 09:44:55 UTC
Oops, sorry, didn't mean to reopen this bug... bad bugzilla interface! :P