netdev
[Top] [All Lists]

Re: How to determine source ip address

To: Padraig Brady <padraig@xxxxxxxxxxxxx>
Subject: Re: How to determine source ip address
From: Julian Anastasov <ja@xxxxxx>
Date: Tue, 11 Sep 2001 22:32:45 +0000 (GMT)
Cc: Christopher Friesen <cfriesen@xxxxxxxxxxxxxxxxxx>, <netdev@xxxxxxxxxxx>
In-reply-to: <3B9E4E1B.9060006@xxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
        Hello,

On Tue, 11 Sep 2001, Padraig Brady wrote:

> Chris, I'm only filling in the TCP header, and I realise the IP header
> will be
> filled appropriately when sent. However I need to calculate the checksum for
> the TCP header which is actually calculated for the pseudo header:

        The checksum is calculated for you in raw_getrawfrag()

> So I need to determine the source address before sending...

        getsockname() gives it to you after connect() to the
DGRAM socket.

> I don't have to worry about source routing, but thanks for the info. I
> don't think
> I have to call connect() so, do I?

        You have to, if you need the source address

> I'm still unsure how to get a source port that will never clash with
> existing connections, but that's not a major problem.

        Hm, then you have to create a normal TCP socket and to
receive port with bind(). I don't know your goals, so you have to
take into account everything you know.

> Thanks,
> Padraig.

Regards

--
Julian Anastasov <ja@xxxxxx>


<Prev in Thread] Current Thread [Next in Thread>