If, however, you look at man 7 ip, you will
see this:
...
...
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).
...
So the system should support such a call.
I want to add that I use quite a new os
(Fedora 10).
Any ideas ?
Regards,
MR
Because otherwise code that tried to use 'IP_MTU' to mean something
else would break.
> Trying to add #include <linux/in.h> in my program (which is a user
> space application) gives compilation error. The linux/in.h file is a
> kernel header and it
> intended to be used only in kernel modules.
Can you paste the precise error?
In any event, you can just do what everyone else does:
#define IP_MTU 14
DS
With these includes, I get the following errors:
#include <linux/in.h>
#include <stdlib.h>
#include <netdb.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <signal.h>
In file included from /usr/include/stdlib.h:320,
from udpnochecksum.c:4:
/usr/include/sys/types.h:46: error: conflicting types for ‘loff_t’
/usr/include/linux/types.h:30: error: previous declaration of ‘loff_t’
was here
/usr/include/sys/types.h:62: error: conflicting types for ‘dev_t’
/usr/include/linux/types.h:13: error: previous declaration of ‘dev_t’
was here
In file included from /usr/include/sys/types.h:133,
from /usr/include/stdlib.h:320,
from udpnochecksum.c:4:
/usr/include/time.h:105: error: conflicting types for ‘timer_t’
/usr/include/linux/types.h:22: error: previous declaration of
‘timer_t’ was here
In file included from /usr/include/stdlib.h:320,
from udpnochecksum.c:4:
/usr/include/sys/types.h:198: error: conflicting types for ‘int64_t’
/usr/include/linux/types.h:98: error: previous declaration of
‘int64_t’ was here
/usr/include/sys/types.h:204: error: conflicting types for ‘u_int64_t’
/usr/include/linux/types.h:97: error: previous declaration of
‘u_int64_t’ was here
In file included from /usr/include/sys/types.h:220,
from /usr/include/stdlib.h:320,
from udpnochecksum.c:4:
/usr/include/sys/select.h:78: error: conflicting types for ‘fd_set’
/usr/include/linux/types.h:12: error: previous declaration of ‘fd_set’
was here
In file included from /usr/include/stdlib.h:320,
from udpnochecksum.c:4:
/usr/include/sys/types.h:235: error: conflicting types for ‘blkcnt_t’
/usr/include/linux/types.h:124: error: previous declaration of
‘blkcnt_t’ was here
In file included from /usr/include/netinet/in.h:24,
from /usr/include/netdb.h:28,
from udpnochecksum.c:6:
/usr/include/stdint.h:56: error: conflicting types for ‘uint64_t’
/usr/include/linux/types.h:96: error: previous declaration of
‘uint64_t’ was here
In file included from /usr/include/sys/uio.h:29,
from /usr/include/sys/socket.h:28,
from /usr/include/netinet/in.h:25,
from /usr/include/netdb.h:28,
from udpnochecksum.c:6:
/usr/include/bits/uio.h:45: error: redefinition of ‘struct iovec’
In file included from /usr/include/sys/socket.h:36,
from /usr/include/netinet/in.h:25,
from /usr/include/netdb.h:28,
from udpnochecksum.c:6:
/usr/include/bits/socket.h:149: error: redefinition of ‘struct
sockaddr’
/usr/include/bits/socket.h:162: error: redefinition of ‘struct
__kernel_sockaddr_storage’
/usr/include/bits/socket.h:172: error: expected identifier before
numeric constant
/usr/include/bits/socket.h:220: error: redefinition of ‘struct msghdr’
/usr/include/bits/socket.h:238: error: redefinition of ‘struct
cmsghdr’
/usr/include/bits/socket.h:267: error: conflicting types for
‘__cmsg_nxthdr’
/usr/include/linux/socket.h:128: error: previous definition of
‘__cmsg_nxthdr’ was here
/usr/include/bits/socket.h:296: error: expected identifier before
numeric constant
/usr/include/bits/socket.h:375: error: redefinition of ‘struct linger’
In file included from /usr/include/netdb.h:28,
from udpnochecksum.c:6:
/usr/include/netinet/in.h:34: error: redeclaration of enumerator
‘IPPROTO_IP’
/usr/include/linux/in.h:26: error: previous definition of ‘IPPROTO_IP’
was here
/usr/include/netinet/in.h:38: error: redeclaration of enumerator
‘IPPROTO_ICMP’
/usr/include/linux/in.h:27: error: previous definition of
‘IPPROTO_ICMP’ was here
/usr/include/netinet/in.h:40: error: redeclaration of enumerator
‘IPPROTO_IGMP’
/usr/include/linux/in.h:28: error: previous definition of
‘IPPROTO_IGMP’ was here
/usr/include/netinet/in.h:42: error: redeclaration of enumerator
‘IPPROTO_IPIP’
/usr/include/linux/in.h:29: error: previous definition of
‘IPPROTO_IPIP’ was here
/usr/include/netinet/in.h:44: error: redeclaration of enumerator
‘IPPROTO_TCP’
/usr/include/linux/in.h:30: error: previous definition of
‘IPPROTO_TCP’ was here
/usr/include/netinet/in.h:46: error: redeclaration of enumerator
‘IPPROTO_EGP’
/usr/include/linux/in.h:31: error: previous definition of
‘IPPROTO_EGP’ was here
/usr/include/netinet/in.h:48: error: redeclaration of enumerator
‘IPPROTO_PUP’
/usr/include/linux/in.h:32: error: previous definition of
‘IPPROTO_PUP’ was here
/usr/include/netinet/in.h:50: error: redeclaration of enumerator
‘IPPROTO_UDP’
/usr/include/linux/in.h:33: error: previous definition of
‘IPPROTO_UDP’ was here
/usr/include/netinet/in.h:52: error: redeclaration of enumerator
‘IPPROTO_IDP’
/usr/include/linux/in.h:34: error: previous definition of
‘IPPROTO_IDP’ was here
/usr/include/netinet/in.h:56: error: redeclaration of enumerator
‘IPPROTO_IPV6’
/usr/include/linux/in.h:39: error: previous definition of
‘IPPROTO_IPV6’ was here
/usr/include/netinet/in.h:62: error: redeclaration of enumerator
‘IPPROTO_RSVP’
/usr/include/linux/in.h:36: error: previous definition of
‘IPPROTO_RSVP’ was here
/usr/include/netinet/in.h:64: error: redeclaration of enumerator
‘IPPROTO_GRE’
/usr/include/linux/in.h:37: error: previous definition of
‘IPPROTO_GRE’ was here
/usr/include/netinet/in.h:66: error: redeclaration of enumerator
‘IPPROTO_ESP’
/usr/include/linux/in.h:41: error: previous definition of
‘IPPROTO_ESP’ was here
/usr/include/netinet/in.h:68: error: redeclaration of enumerator
‘IPPROTO_AH’
/usr/include/linux/in.h:42: error: previous definition of ‘IPPROTO_AH’
was here
/usr/include/netinet/in.h:80: error: redeclaration of enumerator
‘IPPROTO_PIM’
/usr/include/linux/in.h:44: error: previous definition of
‘IPPROTO_PIM’ was here
/usr/include/netinet/in.h:82: error: redeclaration of enumerator
‘IPPROTO_COMP’
/usr/include/linux/in.h:46: error: previous definition of
‘IPPROTO_COMP’ was here
/usr/include/netinet/in.h:84: error: redeclaration of enumerator
‘IPPROTO_SCTP’
/usr/include/linux/in.h:47: error: previous definition of
‘IPPROTO_SCTP’ was here
/usr/include/netinet/in.h:86: error: redeclaration of enumerator
‘IPPROTO_RAW’
/usr/include/linux/in.h:50: error: previous definition of
‘IPPROTO_RAW’ was here
/usr/include/netinet/in.h:89: error: redeclaration of enumerator
‘IPPROTO_MAX’
/usr/include/linux/in.h:52: error: previous definition of
‘IPPROTO_MAX’ was here
/usr/include/netinet/in.h:139: error: redefinition of ‘struct in_addr’
/usr/include/netinet/in.h:222: error: redefinition of ‘struct
sockaddr_in’
/usr/include/netinet/in.h:248: error: redefinition of ‘struct ip_mreq’
/usr/include/netinet/in.h:257: error: redefinition of ‘struct
ip_mreq_source’
/usr/include/netinet/in.h:284: error: redefinition of ‘struct
group_req’
/usr/include/netinet/in.h:293: error: redefinition of ‘struct
group_source_req’
/usr/include/netinet/in.h:307: error: redefinition of ‘struct
ip_msfilter’
/usr/include/netinet/in.h:328: error: redefinition of ‘struct
group_filter’
In file included from /usr/include/netinet/in.h:352,
from /usr/include/netdb.h:28,
from udpnochecksum.c:6:
/usr/include/bits/in.h:93: error: redefinition of ‘struct ip_mreqn’
/usr/include/bits/in.h:101: error: redefinition of ‘struct in_pktinfo’
Any ideas ?
MR