[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210319115035.11272a9c@hermes.local>
Date: Fri, 19 Mar 2021 11:50:35 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Subject: Fw: [Bug 212353] New: Requesting IP_RECVTTL via setsockopt returns
IP_TTL via recvmsg()'s cmsghdr
Begin forwarded message:
Date: Fri, 19 Mar 2021 07:04:12 +0000
From: bugzilla-daemon@...zilla.kernel.org
To: stephen@...workplumber.org
Subject: [Bug 212353] New: Requesting IP_RECVTTL via setsockopt returns IP_TTL via recvmsg()'s cmsghdr
https://bugzilla.kernel.org/show_bug.cgi?id=212353
Bug ID: 212353
Summary: Requesting IP_RECVTTL via setsockopt returns IP_TTL
via recvmsg()'s cmsghdr
Product: Networking
Version: 2.5
Kernel Version: 4.12.14-122.63-default (SLES12 SP5)
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: Other
Assignee: stephen@...workplumber.org
Reporter: Ulrich.Windl@...uni-regensburg.de
Regression: No
Trying to get IP_RECVTTL, I noticed that recvmsg() returns IP_TTL, not
IP_RECVTTL in struct cmsghdr.
Example xode being used was similar to
https://stackoverflow.com/a/49308499/6607497 that checks for IP_RECVTTL in
struct cmsghdr:
...
int yes = 1;
setsockopt(soc, IPPROTO_IP, IP_RECVTTL, &yes, sizeof(yes));
...
int ttl = -1;
struct cmsghdr * cmsg = CMSG_FIRSTHDR(&hdr);
for (; cmsg; cmsg = CMSG_NXTHDR(&hdr, cmsg)) {
if (cmsg->cmsg_level == IPPROTO_IP
&& cmsg->cmsg_type == IP_RECVTTL
) {
uint8_t * ttlPtr = (uint8_t *)CMSG_DATA(cmsg);
ttl = *ttlPtr;
break;
}
}
// ttl is now either the real ttl or -1 if something went wrong
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are the assignee for the bug.
Powered by blists - more mailing lists