You can't get to it with the request.

You'll need to adjust the parameters that IO::Socket::INET creates the connection socket, adding LocalAddr to be something like one of the other addresses aliases for your host.

Be aware that you can only set this to one of the addresses that your host understands: you won't be able to set it to an address that would not have been routed to your host in the first place. (And that is as it should be: the TCP protocol is a two-way street, and the packets have to come back to you with a valid return address.)

I see some code in LWP::Protocol::http in the _newsocket subroutine that looks like it could be hooked in to add the appropriate values to the IO::Socket::INET call. But I've not used it directly. It might be as simple as setting @LWP::Protocol::http::EXTRA_SOCK_OPTS to ("LocalAddr", $yourhostalias) just before you issue each request. But again, that would have to be some address that is ifconfig'ed as being one of your IPs.

-- Randal L. Schwartz, Perl hacker


In reply to •Re: LWP User Agent - SPOOF IP in req header by merlyn
in thread LWP User Agent - SPOOF IP in req header by Bill

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.