简体   繁体   中英

Missing IP_MTU socket option define on Debian Etch?

I'm trying to read the MTU of my TCP connection using IP_MTU socket option
According to man 7 ip installed on my Debian Etch (I know, it's quite old, but changing it is not an option right now):

SYNOPSIS
       #include <sys/socket.h>
       #include <netinet/in.h>
       #include <netinet/ip.h> /* superset of previous */
[CUT]
IP_MTU Retrieve the current known path MTU of the current socket.
Only valid when the socket has been  connected.  Returns  an integer.  
Only valid as a getsockopt(2).

Problem is that the above socket option is not present in any of the include files named by the man page. (hence my code is not compiling ;))
I instead found it defined in <linux/in.h> ( grep is your friend)
If I try adding <linux/in.h> to my source code I get all kind of multiple definition/re-declaration compile errors. Does anyone out there knows why the above param is missing from the headers and how to solve the issue?
Many thanks
Sergio

The answer is: I don't think there is an answer. I'm running Red Hat Enterprise Linux AS release 4 (Nahant Update 8) and I have the exact same problem:

  • man 7 ip says I can query the MTU
  • grep -Re IP_MTU /usr/include/* indicates the macro exists only in linux/in.h
  • I can't use linux/in.h or I get a ton of errors

So, I guess the only thing to be done is workaround by setting the MTU discover, constantly tweaking the MTU and watching for the kernel to shut you down when you try to send something too big. That's what I'm going to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM