Bug 1398914 - SOCK_DGRAM socket option IP_RECVORIGDSTADDR doesn't work
Summary: SOCK_DGRAM socket option IP_RECVORIGDSTADDR doesn't work
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 25
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Neil Horman
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-27 09:48 UTC by Iybego
Modified: 2019-01-09 12:54 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-28 22:20:55 UTC
Type: Bug


Attachments (Terms of Use)
small autotest for IP_RECVORIGDSTADDR (3.22 KB, application/x-gzip)
2016-11-27 09:48 UTC, Iybego
no flags Details
patchto fix IP_RECVORIGDTADDR (1.75 KB, patch)
2017-02-10 18:43 UTC, Neil Horman
no flags Details | Diff

Description Iybego 2016-11-27 09:48:45 UTC
Created attachment 1224772 [details]
small autotest for IP_RECVORIGDSTADDR

Description of problem:
Even if i set IP_RECVORIGDSTADDR on SOCK_DGRAM, i doesn't receive IP_ORIGDSTADDR in CMSG

Version-Release number of selected component (if applicable):
kernel 4.8.8-300.fc25.x86_64

How reproducible:
Attached small autotest. Just do say "make" and test will be compiled and started.

Steps to Reproduce:
1. Enable IP_RECVORIGDSTADDR on SOCK_DGRAM socket
2. Use recvmsg with CMSG buffer specified
3. Scan CMSG buffer against IP_ORIGDSTADDR

Actual results:

==== testing [IP_RECVORIGDSTADDR]
binded to port 38886
failure: [SOL_IP, IP_ORIGDSTADDR] doesn't exists in CMSG!
==== testing [FAILED]


Expected results:

On kernel 3.10.49 its works and returns:

==== testing [IP_RECVORIGDSTADDR]
binded to port 43699
cmsg received [level: 0, type: 20]
IP_ORIGDSTADDR received
 ^ looks like all ok! grats!
==== testing [OK]

Comment 1 Neil Horman 2016-11-28 20:11:16 UTC
hmm, I'm not sure why there is a length validation in the cmsg add routine int he kernel, but thats where it seems to be failing.  Let me look into the why behind that.

Comment 2 Neil Horman 2016-11-30 19:10:22 UTC
hmm, odder still, printed out the skb_transport_offset and length fields, and the transport offset was -8, which implies that the transport pointer points to a space lower in memory than the data pointer, which is definitely odd.  Continuing to look into this

Comment 3 Neil Horman 2016-12-09 18:25:17 UTC
note to self: problem may exist in udp_v4_early_demux

Comment 4 Laura Abbott 2017-01-17 01:12:05 UTC
*********** MASS BUG UPDATE **************
We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 25 kernel bugs.
 
Fedora 25 has now been rebased to 4.9.3-200.fc25.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.
 
If you have moved on to Fedora 26, and are still experiencing this issue, please change the version to Fedora 26.
 
If you experience different issues, please open a new bug report for those.

Comment 5 Iybego 2017-01-18 05:51:59 UTC
Problem still exists with:
4.9.3-200.fc25.x86_64 #1 SMP Fri Jan 13 01:01:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Comment 6 Neil Horman 2017-02-10 18:42:49 UTC
Think I found the problem.  Can you apply this patch and see if the problem abates?

Comment 7 Neil Horman 2017-02-10 18:43:26 UTC
Created attachment 1249106 [details]
patchto fix IP_RECVORIGDTADDR

Comment 8 Iybego 2017-02-26 08:48:01 UTC
Thanks! Looks like its works well!

==== testing [IP_RECVORIGDSTADDR]
binded to port 43123
cmsg received [level: 0, type: 20]
IP_ORIGDSTADDR received
 ^ looks like all ok! grats!
==== testing [OK]

Comment 9 Laura Abbott 2017-02-28 22:20:55 UTC
That fix is now in the 4.9.x stable tree. Thanks for reporting the bug and thank you Neil for pointing out the fix.


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