|
Bugzilla – Full Text Bug Listing |
| Summary: | Source IP address is not set correctly | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Craig Dowell <craigdo> |
| Component: | internet | Assignee: | ns-bugs <ns-bugs> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | P1 | ||
| Version: | pre-release | ||
| Hardware: | All | ||
| OS: | All | ||
| Bug Depends on: | 65 | ||
| Bug Blocks: | |||
| Attachments: |
patch extracted from craigdo/ns-3-mc
Additional patch for Source IP 0.0.0.0 this patch supersedes previous 2, and depends on bug65.patch UDP broadcast; builds on previous patch fix for Mathieu's comment |
||
|
Description
Craig Dowell
2007-08-14 15:04:11 UTC
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 |