| To: | netdev@xxxxxxxxxxx |
|---|---|
| Subject: | How to determine source ip address |
| From: | Padraig Brady <padraig@xxxxxxxxxxxxx> |
| Date: | Mon, 10 Sep 2001 20:23:17 +0100 |
| Newsgroups: | comp.os.linux.networking |
| Sender: | owner-netdev@xxxxxxxxxxx |
| User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.3) Gecko/20010808 |
Hi, I'm writing a network app (currently on linux 2.2.18, but soon moving to 2.4) that needs to build up ip & tcp packets manually. So my question is how do I determine the source ip address to use for a given destination ip address. I.E. take account of multiple interfaces/routes/ aliases/... Could I create a temporary UDP socket and connect() it. If indeed the kernel fills in the appropriate info when "connecting" a UDP socket (source ip/port), how do I read this info? If a port number is not allocated with the above connect(), how do I manually allocate a source port, bind()? Or do I have to resort to ioctl()? thanks, Padraig. (I'm not on netdev). |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH] ioctl SIOCGIFNETMASK: ip alias bug 2.4.9 and 2.2.19, Dennis |
|---|---|
| Next by Date: | Re: [PATCH] ioctl SIOCGIFNETMASK: ip alias bug 2.4.9 and 2.2.19, kuznet |
| Previous by Thread: | IPv6 Addressing Architecture (RFC2373) updates, Pekka Savola |
| Next by Thread: | Re: How to determine source ip address, Christopher Friesen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |