getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, sa, &salen) is in fact sometimes returning the source IP instead the destination IP.

Bug #1809795 reported by roobesh ganapathy mohandass
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dpkg (Ubuntu)
New
Undecided
Unassigned

Bug Description

We are using below version of Ubuntu/kernel,

~# lsb_release -rd
Description: Ubuntu 18.04.1 LTS
Release: 18.04

What you expected to happen:
getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, sa, &salen) - should return always destination IP(connected IP).

What happened instead:
getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, sa, &salen) is in fact sometimes returning the source IP instead the destination IP. Using getsockname() instead looks like solving the issue.

For just an example: Out of 6569124 requests , 4 requests were wrong 0.000060891 % (this is just an rough estimate to give you idea on frequency)

Some old reference:
https://stackoverflow.com/questions/11417187/getsockopt-so-original-dst-occasionally-returns-client-address

We searched in launchpad for any bug filed for this but couldn't see any. Hence filing this behavior here.

Side Note: (about how we identified this behavior)
We were using haproxy-version 1.8.14-1 which is using this kernel function getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, sa, &salen) to get the destination IP details/connected address details. But instead we are getting very occasional source IP address instead of destination(Connected IP).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.