ip_input.c (338343) | ip_input.c (338617) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: stable/11/sys/netinet/ip_input.c 338343 2018-08-28 07:24:09Z ae $"); | 33__FBSDID("$FreeBSD: stable/11/sys/netinet/ip_input.c 338617 2018-09-12 18:52:18Z sobomax $"); |
34 35#include "opt_bootp.h" 36#include "opt_ipstealth.h" 37#include "opt_ipsec.h" 38#include "opt_route.h" 39#include "opt_rss.h" 40 41#include <sys/param.h> --- 1091 unchanged lines hidden (view full) --- 1133 ifa_free(&ia->ia_ifa); 1134 return; 1135 } 1136 if (ia != NULL) 1137 ifa_free(&ia->ia_ifa); 1138 icmp_error(mcopy, type, code, dest.s_addr, mtu); 1139} 1140 | 34 35#include "opt_bootp.h" 36#include "opt_ipstealth.h" 37#include "opt_ipsec.h" 38#include "opt_route.h" 39#include "opt_rss.h" 40 41#include <sys/param.h> --- 1091 unchanged lines hidden (view full) --- 1133 ifa_free(&ia->ia_ifa); 1134 return; 1135 } 1136 if (ia != NULL) 1137 ifa_free(&ia->ia_ifa); 1138 icmp_error(mcopy, type, code, dest.s_addr, mtu); 1139} 1140 |
1141#define CHECK_SO_CT(sp, ct) \ 1142 (((sp->so_options & SO_TIMESTAMP) && (sp->so_ts_clock == ct)) ? 1 : 0) 1143 |
|
1141void 1142ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip, 1143 struct mbuf *m) 1144{ 1145 | 1144void 1145ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip, 1146 struct mbuf *m) 1147{ 1148 |
1146 if (inp->inp_socket->so_options & (SO_BINTIME | SO_TIMESTAMP)) { | 1149 if ((inp->inp_socket->so_options & SO_BINTIME) || 1150 CHECK_SO_CT(inp->inp_socket, SO_TS_BINTIME)) { |
1147 struct bintime bt; 1148 1149 bintime(&bt); | 1151 struct bintime bt; 1152 1153 bintime(&bt); |
1150 if (inp->inp_socket->so_options & SO_BINTIME) { 1151 *mp = sbcreatecontrol((caddr_t)&bt, sizeof(bt), 1152 SCM_BINTIME, SOL_SOCKET); 1153 if (*mp) 1154 mp = &(*mp)->m_next; 1155 } 1156 if (inp->inp_socket->so_options & SO_TIMESTAMP) { 1157 struct timeval tv; | 1154 *mp = sbcreatecontrol((caddr_t)&bt, sizeof(bt), 1155 SCM_BINTIME, SOL_SOCKET); 1156 if (*mp) 1157 mp = &(*mp)->m_next; 1158 } 1159 if (CHECK_SO_CT(inp->inp_socket, SO_TS_REALTIME_MICRO)) { 1160 struct timeval tv; |
1158 | 1161 |
1159 bintime2timeval(&bt, &tv); 1160 *mp = sbcreatecontrol((caddr_t)&tv, sizeof(tv), 1161 SCM_TIMESTAMP, SOL_SOCKET); 1162 if (*mp) 1163 mp = &(*mp)->m_next; 1164 } | 1162 microtime(&tv); 1163 *mp = sbcreatecontrol((caddr_t)&tv, sizeof(tv), 1164 SCM_TIMESTAMP, SOL_SOCKET); 1165 if (*mp) 1166 mp = &(*mp)->m_next; 1167 } else if (CHECK_SO_CT(inp->inp_socket, SO_TS_REALTIME)) { 1168 struct timespec ts; 1169 1170 nanotime(&ts); 1171 *mp = sbcreatecontrol((caddr_t)&ts, sizeof(ts), 1172 SCM_REALTIME, SOL_SOCKET); 1173 if (*mp) 1174 mp = &(*mp)->m_next; 1175 } else if (CHECK_SO_CT(inp->inp_socket, SO_TS_MONOTONIC)) { 1176 struct timespec ts; 1177 1178 nanouptime(&ts); 1179 *mp = sbcreatecontrol((caddr_t)&ts, sizeof(ts), 1180 SCM_MONOTONIC, SOL_SOCKET); 1181 if (*mp) 1182 mp = &(*mp)->m_next; |
1165 } 1166 if (inp->inp_flags & INP_RECVDSTADDR) { 1167 *mp = sbcreatecontrol((caddr_t)&ip->ip_dst, 1168 sizeof(struct in_addr), IP_RECVDSTADDR, IPPROTO_IP); 1169 if (*mp) 1170 mp = &(*mp)->m_next; 1171 } 1172 if (inp->inp_flags & INP_RECVTTL) { --- 187 unchanged lines hidden --- | 1183 } 1184 if (inp->inp_flags & INP_RECVDSTADDR) { 1185 *mp = sbcreatecontrol((caddr_t)&ip->ip_dst, 1186 sizeof(struct in_addr), IP_RECVDSTADDR, IPPROTO_IP); 1187 if (*mp) 1188 mp = &(*mp)->m_next; 1189 } 1190 if (inp->inp_flags & INP_RECVTTL) { --- 187 unchanged lines hidden --- |