diff options
author | tuexen <tuexen@FreeBSD.org> | 2012-06-12 14:02:38 +0000 |
---|---|---|
committer | tuexen <tuexen@FreeBSD.org> | 2012-06-12 14:02:38 +0000 |
commit | 32041f44edbadf78cfaf57b4d6a30f5c41b4732d (patch) | |
tree | a867871148d8c6679305e2f7f21287027fb6f717 /sys/netinet/ip_input.c | |
parent | 66a991aeee1041abe4bfaca27b4d3d2ddaee1161 (diff) | |
download | FreeBSD-src-32041f44edbadf78cfaf57b4d6a30f5c41b4732d.zip FreeBSD-src-32041f44edbadf78cfaf57b4d6a30f5c41b4732d.tar.gz |
Add a IP_RECVTOS socket option to receive for received UDP/IPv4
packets a cmsg of type IP_RECVTOS which contains the TOS byte.
Much like IP_RECVTTL does for TTL. This allows to implement a
protocol on top of UDP and implementing ECN.
MFC after: 3 days
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r-- | sys/netinet/ip_input.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 728b50b..ab78fa2 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1684,6 +1684,12 @@ makedummy: if (*mp) mp = &(*mp)->m_next; } + if (inp->inp_flags & INP_RECVTOS) { + *mp = sbcreatecontrol((caddr_t) &ip->ip_tos, + sizeof(u_char), IP_RECVTOS, IPPROTO_IP); + if (*mp) + mp = &(*mp)->m_next; + } } /* |