Destination_IP Field in packets coming from QUEUE
Hi everybody...
I'm facing the problem to understand the destination of an OUTGOING tcp packet caught by the chain iptables -t filter -A OUTPUT -j QUEUE
The destination address field in the ip header has my ip while the real destination is another.
Here I'd like to know if is a common behaviour that can be changed with some flags in the chain or there is anyway to know where the packet was addressed to (perhaps using the IPQ).
Thanks in advance.
Lore
(I know I posted some sort of message like this but I figured out that the content was un-understandable... sorry for my english)
___________________________________
Yahoo! Messenger: chiamate gratuite in tutto il mondo
http://it.messenger.yahoo.com
Quoted 6 lines · Lore
I'm facing the problem to understand the destination of an OUTGOING tcp packet caught by the chain iptables -t filter -A OUTPUT -j QUEUE
The destination address field in the ip header has my ip while the real destination is another.
Are you sure you look at the destination IP and not the source IP?
If unsure send a hex dump of the packet for us to ponder at.
Regards
Henrik
Quoted 11 lines · --- Henrik Nordstrom
Quoted 1 line · Lore
I'm facing the problem to understand the
destination
Quoted 4 lines
of an OUTGOING tcp packet caught by the chain
iptables -t filter -A OUTPUT -j QUEUEThe destination address field in the ip header has
my
Quoted 1 line
ip while the real destination is another.
Quoted 9 lines
Are you sure you look at the destination IP and not the source IP?
If unsure send a hex dump of the packet for us to
ponder at.Regards
Henrik
Hi, At the moment I'm not able to run the program as root. But what follow is the code that shows me the wrong IP.
//START OF CODE
--CUT-- ipq_set_mode(QHandle,IPQ_COPY_PACKET,256); --CUT--ipq_read(QHandle,pacchetto,256,0);
--CUT--
pckfiltrato=ipq_get_packet(pacchetto);
iph=((struct iphdr *)pckfiltrato->payload);
printf("S_ADDR:%s,D_ADDR:%s\n",
inet_ntoa(iph->saddr),
inet_ntoa(iph->daddr));--CUT--
//END OF CODE
As I'm in a Lan trying to connect to one of the computers at univiersity I should read S_ADDR:192.168.0.2,D_ADDR:130.136.4.234
but I read:
S_ADDR:192.168.0.2,D_ADDR:192.168.0.2
I Compared my code with a lot of similar examples on the net and they all look similar.
because of this I thought it was a feature that could be switched in iptables.
If it isn't so please, let me know and I'll try to post the Hex Dump you requested ASAP.
Thank you very much.
Lore
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
Quoted 7 lines · Lore
Hi, At the moment I'm not able to run the program as root. But what follow is the code that shows me the wrong IP.
printf("S_ADDR:%s,D_ADDR:%s\n", inet_ntoa(iph->saddr), inet_ntoa(iph->daddr));
inet_ntoa can not be used like this. Each call to inet_ntoa overwrites the result string. (see man inet_ntoa)
The following will give better results:
printf("S_ADDR:%s", inet_ntoa(iph->saddr));
printf(",D_ADDR:%s\n", inet_ntoa(iph->daddr));Regards
Henrik
Hey man.
It works.
Thank You very much, Henrik.
It was about my degree thesis, You can't figure out how much helpfull and important this was to me.
Thank You again.
thank you all.
Lore
--- Henrik Nordstrom <[email protected]> ha scritto:
Quoted 16 lines · Lore
Quoted 2 lines
Hi, At the moment I'm not able to run the program
as
Quoted 1 line
root. But what follow is the code that shows me
the
Quoted 5 lines
wrong IP.
printf("S_ADDR:%s,D_ADDR:%s\n", inet_ntoa(iph->saddr), inet_ntoa(iph->daddr));
inet_ntoacan not be used like this. Each call toinet_ntoaoverwrites the
result string. (see maninet_ntoa)
Quoted 8 lines
The following will give better results:
printf("S_ADDR:%s", inet_ntoa(iph->saddr)); printf(",D_ADDR:%s\n", inet_ntoa(iph->daddr));Regards
Henrik
___________________________________
Yahoo! Messenger: chiamate gratuite in tutto il mondo
http://it.messenger.yahoo.com
Quoted 1 line · Lore
Thank You very much, Henrik.
You are welcome.
Quoted 1 line
It was about my degree thesis
May I ask yhat subject are you writing about?
Regards
Henrik
-- Henrik Nordstrom <[email protected]> ha scritto:
Quoted 5 lines
May I ask yhat subject are you writing about?
Regards
Henrik
For shure :)
I'm writing (tonight/tomorrow it will be finally tested on different networks) a daemon for linux that keeps tcp connections alive on multihoming devices. It works as follows: when a linux box with multiple network interfaces creates a tcp connection with another host (both running the daemon), for instance via an ethernet adapter, it can leave the current media and keep up the tcp connection using one of the others adapters available (fiber, wireless, gprs) or (in the case of simple ip reconfiguration) it can simply move from an access point with a particular subnet to another (with a completely different subnet), without interrupting the connection.
I hope to move the code (that at the moment uses LibIPQ) to kernel to increase performances. When I will degree the project will be released under the GPL 2 License
What do you thing about it? I just wanted to do something that wasn't destined to end on shelf collecting dust... Hope it will be helpfull.
Lore
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
Quoted 5 lines · Lore
I'm writing (tonight/tomorrow it will be finally tested on different networks) a daemon for linux that keeps tcp connections alive on multihoming devices. It works as follows: when a linux box with multiple network interfaces creates a tcp connection with
Quoted 8 lines
another host (both running the daemon), for instance via an ethernet adapter, it can leave the current media and keep up the tcp connection using one of the others adapters available (fiber, wireless, gprs) or (in the case of simple ip reconfiguration) it can simply move from an access point with a particular subnet to another (with a completely different subnet), without interrupting the connection.
In the simplest case where only the media changes but the IP network is the same no changes at all is required other than to bring up/down the different network connections.
For the more complex case where one has to be able to move between different IP networks with preserved connectivity one normally implements something like this by using tunnelling by IPIP, GRE, IPSec, OpenVPN or similar.
How does your approach compare to these alternatives?
Regards
Henrik
--- Henrik Nordstrom <[email protected]> ha scritto:
Quoted 14 lines
In the simplest case where only the media changes but the IP network is
the same no changes at all is required other than to bring up/down the
different network connections.For the more complex case where one has to be able to move between
different IP networks with preserved connectivity one normally implements
something like this by using tunnelling by IPIP, GRE, IPSec, OpenVPN or
similar.
Quoted 6 lines
How does your approach compare to these alternatives?
Regards
Henrik
I'm trying to do this in a transparent way. every program that uses tcp will be able to work with this daemon without being aware of its existence. Is there anything that works like this?
Then a question about the simpliest case:
What happens if I remove the device where the network is attached (and I care to bring up another device with the same ip as the former)???
I thought that linux uses to link the socket to an interface, is it wrong?
Thank you.
Lore
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it