Skip to contentSkip to conversation

Ping in ESTABLISHED

DISCUSSION Gilad Benjamini 2 participants 4 messages Dec 6, 2008 – Dec 7, 2008

lore
Share & tools
lore
#0 lore raw

I have a situation where a continuous ping, expected to create a new connection each time, turns into a single connection in ESTABLISHED state

Here are the details:
- iptables runs on a bridge
- The bridge connects eth1 and eth2
- The iptables rules (minimized for the sake of this post)

    -A FORWARD -p icmp -m physdev  --physdev-in eth1 --physdev-is-bridged -j
ACCEPT
    -A FORWARD -p icmp -m state --state ESTABLISHED -j ACCEPT
    -A FORWARD -p icmp -m state --state NEW -j ACCEPT
    -A FORWARD -j ACCEPT

- A machine located on the eth2 network constantly sends a ping to a machine located in eth1 network
- "iptables -L -v" shows the counters growing on rules #1 and #3. This is expected.
- However, at some point, the counters start increasing on rule #2, and stop increasing on rule #3. This can happen after 200 pings, 400, or even 3000 in one overnight test.

Any idea what's going on ?

#1 lore raw

Hi,

does your machine on the eth2 network always waits for the reply of the ping, before sending the next one?

After seeing the ECHO-REPLY passing, the connection tracker tries to delete the created connection, if all the ECHO-REQUESTS have been answered. As it may be possible, that there are several ECHO-REQUESTS passing before the ECHO- REPLY deletes the connection, netfilter will put the state of the connection as ESTABLISHED. And that's the reason, why you don't have any NEW connections anymore. This behaviour may be due to the fact that some ECHO-REPLY's are lost on their way, and a new ECHO-REQUEST was send, before the connection timed out in the connection tracker.

I hope, I was clear, and that it was correct what I told.

Have a nice day.

Christoph

2008-12-06, "Gilad Benjamini" <[email protected]>:

Quoted 20 lines

I have a situation where a continuous ping, expected to create a new connection each time, turns into a single connection in ESTABLISHED state

Here are the details:
- iptables runs on a bridge
- The bridge connects eth1 and eth2
- The iptables rules (minimized for the sake of this post)

    -A FORWARD -p icmp -m physdev  --physdev-in eth1 --physdev-is-bridged
-j ACCEPT
    -A FORWARD -p icmp -m state --state ESTABLISHED -j ACCEPT
    -A FORWARD -p icmp -m state --state NEW -j ACCEPT
    -A FORWARD -j ACCEPT

- A machine located on the eth2 network constantly sends a ping to a machine located in eth1 network
- "iptables -L -v" shows the counters growing on rules #1 and #3. This is expected.
- However, at some point, the counters start increasing on rule #2, and stop increasing on rule #3. This can happen after 200 pings, 400, or even 3000 in one overnight test.

Quoted 7 lines

Any idea what's going on ?

--
To unsubscribe from this list: send the line "unsubscribe netfilter" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Christoph Paasch

www.rollerbulls.be
--

#2 lore raw

So you are saying that once a single ECHO REPLY does not arrive, the connection will go into ESTABLISHED and all further pings, request or reply, will be considered part of this connection ?
Seems to match my scenario.
Can you point me to the relevant places in the code ?

Thx

Quoted 77 lines

-----Original Message-----
From: Christoph Paasch [mailto:[email protected]]
Sent: Sunday, December 07, 2008 2:56 AM
To: [email protected]
Cc: Gilad Benjamini
Subject: Re: Ping in ESTABLISHED

Hi,

does your machine on the eth2 network always waits for the reply of the ping,
before sending the next one?

After seeing the ECHO-REPLY passing, the connection tracker tries to delete
the created connection, if all the ECHO-REQUESTS have been answered. As it may
be possible, that there are several ECHO-REQUESTS passing before the ECHO-
REPLY deletes the connection, netfilter will put the state of the connection as
ESTABLISHED. And that's the reason, why you don't have any NEW connections
anymore. This behaviour may be due to the fact that some ECHO-REPLY's are lost
on their way, and a new ECHO-REQUEST was send, before the connection timed out
in the connection tracker.

I hope, I was clear, and that it was correct what I told.

Have a nice day.

Christoph

2008-12-06, "Gilad Benjamini" <[email protected]>:

Quoted 2 lines

I have a situation where a continuous ping, expected to create a new connection each time, turns into a single connection in ESTABLISHED

state

Quoted 6 lines

Here are the details:
- iptables runs on a bridge
- The bridge connects eth1 and eth2
- The iptables rules (minimized for the sake of this post)

    -A FORWARD -p icmp -m physdev  --physdev-in eth1 --physdev-is-

bridged

Quoted 7 lines

-j ACCEPT

    -A FORWARD -p icmp -m state --state ESTABLISHED -j ACCEPT
    -A FORWARD -p icmp -m state --state NEW -j ACCEPT
    -A FORWARD -j ACCEPT

- A machine located on the eth2 network constantly sends a ping to a machine located in eth1 network
- "iptables -L -v" shows the counters growing on rules #1 and #3.

This is

Quoted 2 lines

expected.
- However, at some point, the counters start increasing on rule #2,

and

Quoted 1 line

stop increasing on rule #3. This can happen after 200 pings, 400, or

even

Quoted 7 lines

3000 in one overnight test.

Any idea what's going on ?

--
To unsubscribe from this list: send the line "unsubscribe netfilter"

in

Quoted 2 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Christoph Paasch

www.rollerbulls.be
--

#3 lore raw

2008-12-07, "Gilad Benjamini" <[email protected]>:

Quoted 3 lines

So you are saying that once a single ECHO REPLY does not arrive, the connection will go into ESTABLISHED and all further pings, request or reply, will be considered part of this connection ?

Yes, that's the way I understood the code.

Quoted 2 lines

Seems to match my scenario.
Can you point me to the relevant places in the code ?

In the function icmp_packet(...) from
net/ipv4/netfilter/nf_conntrack_proto_icmp.c

If it's in the reply-direction, it checks if he can delete the connection- entry. In the other direction, he increments the counter. So, it's easy to imagine a scenario of lost ECHO_REPLY's where the counter gets greater than 1, because of incoming ECHO_REQUEST's

Quoted 90 lines

Thx

Quoted 87 lines

-----Original Message-----
From: Christoph Paasch [mailto:[email protected]]
Sent: Sunday, December 07, 2008 2:56 AM
To: [email protected]
Cc: Gilad Benjamini
Subject: Re: Ping in ESTABLISHED

Hi,

does your machine on the eth2 network always waits for the reply of the ping,
before sending the next one?

After seeing the ECHO-REPLY passing, the connection tracker tries to delete
the created connection, if all the ECHO-REQUESTS have been answered. As it may
be possible, that there are several ECHO-REQUESTS passing before the ECHO-
REPLY deletes the connection, netfilter will put the state of the connection as
ESTABLISHED. And that's the reason, why you don't have any NEW connections
anymore. This behaviour may be due to the fact that some ECHO-REPLY's are lost
on their way, and a new ECHO-REQUEST was send, before the connection timed out
in the connection tracker.

I hope, I was clear, and that it was correct what I told.

Have a nice day.

Christoph

2008-12-06, "Gilad Benjamini" <[email protected]>:

Quoted 2 lines

I have a situation where a continuous ping, expected to create a new connection each time, turns into a single connection in ESTABLISHED

state

Quoted 5 lines

Here are the details:
- iptables runs on a bridge
- The bridge connects eth1 and eth2
- The iptables rules (minimized for the sake of this post)

    -A FORWARD -p icmp -m physdev  --physdev-in eth1 --physdev-is-

bridged

Quoted 7 lines

-j ACCEPT

    -A FORWARD -p icmp -m state --state ESTABLISHED -j ACCEPT
    -A FORWARD -p icmp -m state --state NEW -j ACCEPT
    -A FORWARD -j ACCEPT

- A machine located on the eth2 network constantly sends a ping to a machine located in eth1 network
- "iptables -L -v" shows the counters growing on rules #1 and #3.

This is

Quoted 2 lines

expected.
- However, at some point, the counters start increasing on rule #2,

and

Quoted 1 line

stop increasing on rule #3. This can happen after 200 pings, 400, or

even

Quoted 7 lines

3000 in one overnight test.

Any idea what's going on ?

--
To unsubscribe from this list: send the line "unsubscribe netfilter"

in

Quoted 2 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Christoph Paasch

www.rollerbulls.be
--

--
Christoph Paasch

www.rollerbulls.be
--