RE: Sending a packet with 127.0.0.2 source address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: linux-net-owner@xxxxxxxxxxxxxxx 
> [mailto:linux-net-owner@xxxxxxxxxxxxxxx] On Behalf Of Anatoly 
> Muliarski
> Sent: Monday, April 27, 2009 8:56 AM
> To: Satish Chandra Kilaru
> Cc: linux-net@xxxxxxxxxxxxxxx
> Subject: Re: Sending a packet with 127.0.0.2 source address
> 
> Thanks for the idea.
> 
> I have finally managed to get it work :)
> The problem was in route.c in ip_route_input_slow() function 
> in the next lines:
> 	if (ipv4_is_lbcast(daddr) || ipv4_is_zeronet(daddr) ||
> 	    ipv4_is_loopback(daddr))
> 		goto martian_destination;
>  I commented the loopback check and it began to work.
> 
> 2009/4/27 Satish Chandra Kilaru <iam.kilaru@xxxxxxxxx>:
> > IP layer might be dropping themn since dest ip is 127.0.0.x 
> and it is
> > not received on lo.
> 
> -- 
> Best regards
> Anatoly Muliarski

Just an FYI, another option that I have useful in the past to enable
this kind of thing is to modify the definition of the LOOPBACK(x) macro
in include/linux/in.h to exclude from consideration the subset of the
127/8 network that you don't want the stack to interpret as a loopback
network. For example, changing this:

#define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000))

to this:

#define LOOPBACK(x) ((((x) & htonl(0xff000000)) == htonl(0x7f000000)) &&
\
                        (((x) & htonl(0x00ff0000)) !=
htonl(0x00010000)))

enables the stack to treat 127.1/16 as a "normal" non-loopback address
range.

This can be handy in the creation of private IPv4 networks that wont
conflict with the address ranges assigned to other external network
interfaces on the hosts using the private 127.1/16 network when you
don't have control over the network addresses being assigned to those
external networks.

I don't know if that is sufficient for make NAT work the way you want.

Jeff Haran
--
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux