This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 678582 - ping traffic (icmp) sends xfrm ACQUIRE msgs with protocol 17 (UDP)
ping traffic (icmp) sends xfrm ACQUIRE msgs with protocol 17 (UDP)
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel (Show other bugs)
6.1
Unspecified Unspecified
urgent Severity high
: rc
: ---
Assigned To: Herbert Xu
Red Hat Kernel QE team
:
Depends On:
Blocks: RHEL62CCC 846801 846802
  Show dependency treegraph
 
Reported: 2011-02-18 09:18 EST by Avesh Agarwal
Modified: 2012-08-08 14:29 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-03-09 09:17:20 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Avesh Agarwal 2011-02-18 09:18:36 EST
Description of problem:
We have observed an issue with ping (ICMP) traffic. When an ipsec policy specific to UDP protocol is added to kernel (in SPD) and ping traffic is initiated, kernel sends ACQUIRE messages with protocol 17. Due to this, wrong ipsec's security associations (SA) are being established.

I have tested and found this issue on RHEL6.1 kernel (2.6.32-113.el6.x86_64), and also with ipsec-tools too on RHEL5.5/5.6 kernels too. 

However, we tested this on upstream kernel 2.6.36, and this issue is not found.

Version-Release number of selected component (if applicable):
2.6.32-113.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Add an ipsec policy specific to UDP protocol
2. Start ping traffic to the destination
3. Observe ACQUIRE messages in user space 
  
Actual results:
ACQUIRE mesgs with protocol UDP

Expected results:
ACQUIRE mesgs with protocol ICMP

Additional info:
Comment 3 Joy Latten 2011-02-22 13:07:19 EST
Before sending icmp-echo-request, ping gets the source address via opening a DGRAM socket and doing a connect(). This results in a __xfrm_lookup() in ip_route_output_flow(), which can trigger an ACQUIRE depending on ipsec policy.
However, ping opening this dgram socket, does not result in an outgoing pkt, 
just in it acquiring some info it needs to form and then send the 
icmp-echo-request pkt.
 
So, this is not a kernel problem, but rather a side effect of ping.
"ping -I <srcaddr> dstaddr" will give ping the src addr and it does
not have to open the dgram socket to get src addr info. And thus an
ACQUIRE won't be triggered.
Comment 4 Avesh Agarwal 2011-02-23 07:48:59 EST
> 
> However, we tested this on upstream kernel 2.6.36, and this issue is not found.
> 

Also found from discussion with Joy that the behaviour is same with upstream kernel, and the issue is found. However as Joy noted in comment 3 that this seems more likely related to behaviour of Ping command.
Comment 5 Avesh Agarwal 2011-02-23 09:57:09 EST
I would like to ask that even though it seems its a side effect of Ping command, is the kernel behaviour, of sending ACQUIRE for UDP policy when ping opens a dgram (UDP) socket, right? Because dgram (UDP) socket seems local to the machine and the UDP ipsec policy we have is for a outside box. So I am wondering why the kernel is matching this local dgram stuff with the ipsec policy specific to UDP?
Just curious? If we know that kernel is doing it right, then perhaps we can close this bz.
Comment 6 Joy Latten 2011-02-23 13:59:31 EST
Avesh,
I had thought about that too. 
It's the connect() that ping does after it opens the dgram socket that results in the ACQUIRE. It does something similar to, 
connect(socket_fd, dst, sizeof(dst))  
since we do the connect with the dst, the guy we want to ping... then 
we are planning on querying routes to see which route to use for our source
address using dst. The ip_route_output_flow, calls __xfrm_lookup() which results
in that ACQUIRE.  

here is what my dump looked like from upstream kernel...

km_query
xfrm_state_find
xfrm_resolve_and_create_bundle
xfrm_bundle_lookup
flow_cache_lookup
__xfrm_lookup
ip_route_output_flow
ip4_datagram_connect
inet_dgram_connect
sys_connect
Comment 7 Herbert Xu 2011-03-04 02:15:14 EST
So I think you guys have figured this out already :)

Ping does a connect to obtain routing information for the actual ICMP packets.  It does so using a UDP socket.  That's why you end up with a UDP ACQUIRE message.

IOW I don't think we have a bug here at all.

Note You need to log in before you can comment on or make changes to this bug.