<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Dec 2, 2013 at 1:48 PM, Guibin(Bill) Tian <span dir="ltr"><<a href="mailto:gbtian@gmail.com" target="_blank">gbtian@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi there,<div>Right now, I am trying to do such a thing.</div><div><br></div><div>If a computer has multiple interface A and B, assume the packet is from device A.</div>
<div>At ip layer, before the packet is transmitted to transport layer, I change the source address and destination address of the IP header and transmit to transport layer to pretend that this packet is from device B. Not sure whether this can work or not. </div>
</div></blockquote><div><br></div><div>feasible? yes, theoretically u can change IP address, but there is a problem. TCP port + IP address is combined together to uniquely identify which "socket" to pass to. And each socket is always associated with each process. if u change that the packet will be redirected to another process. (this process context identification is done in the upper layer of TCP, ie, in interrupt context the packet has not been associated with any process yet.)</div>
<div><br></div><div style>and remember there is a checksum (TCP and IP) that need to be patched whenever u change anything.</div><div style><br></div><div style>not sure why u want to that, but I suspect Netfilter should fulfill your requirement as well?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<div><br></div><div>There are other interface specific information in the skb structure like the net_device member. If I pass the packet to transport layer only with my proposed modification, will the application's sockehit detect this? I didn't look into the socket match code, not sure if the socket match will check other information in skb struct beside the ip address and port number.</div>
<div><br></div><div>Thanks for your help.</div><span><font color="#888888"><div><br></div><div>Bill</div></font></span></div>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Peter Teoh
</div></div>