diff options
author | andre <andre@FreeBSD.org> | 2005-09-26 20:25:16 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2005-09-26 20:25:16 +0000 |
commit | bedcd4ace8e6c1ce8c4308a2e5dd2e0a92d9ac06 (patch) | |
tree | a3737bbb5bd709abc559f3b94c77fac68eb192c2 /sys/netinet/ip_output.c | |
parent | 4eeb530ac72e50536d9d5f48d9cba224a2f48e77 (diff) | |
download | FreeBSD-src-bedcd4ace8e6c1ce8c4308a2e5dd2e0a92d9ac06.zip FreeBSD-src-bedcd4ace8e6c1ce8c4308a2e5dd2e0a92d9ac06.tar.gz |
Implement IP_DONTFRAG IP socket option enabling the Don't Fragment
flag on IP packets. Currently this option is only repected on udp
and raw ip sockets. On tcp sockets the DF flag is controlled by the
path MTU discovery option.
Sending a packet larger than the MTU size of the egress interface
returns an EMSGSIZE error.
Discussed with: rwatson
Sponsored by: TCP/IP Optimization Fundraise 2005
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r-- | sys/netinet/ip_output.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 900cd1f..eac1955 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -142,7 +142,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, #endif /* FAST_IPSEC */ M_ASSERTPKTHDR(m); - + if (ro == NULL) { ro = &iproute; bzero(ro, sizeof (*ro)); @@ -1197,6 +1197,7 @@ ip_ctloutput(so, sopt) case IP_RECVIF: case IP_FAITH: case IP_ONESBCAST: + case IP_DONTFRAG: error = sooptcopyin(sopt, &optval, sizeof optval, sizeof optval); if (error) @@ -1254,6 +1255,9 @@ ip_ctloutput(so, sopt) case IP_ONESBCAST: OPTSET(INP_ONESBCAST); break; + case IP_DONTFRAG: + OPTSET(INP_DONTFRAG); + break; } break; #undef OPTSET @@ -1351,6 +1355,7 @@ ip_ctloutput(so, sopt) case IP_PORTRANGE: case IP_FAITH: case IP_ONESBCAST: + case IP_DONTFRAG: switch (sopt->sopt_name) { case IP_TOS: @@ -1403,6 +1408,9 @@ ip_ctloutput(so, sopt) case IP_ONESBCAST: optval = OPTBIT(INP_ONESBCAST); break; + case IP_DONTFRAG: + optval = OPTBIT(INP_DONTFRAG); + break; } error = sooptcopyout(sopt, &optval, sizeof optval); break; |