MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ip6_savecontrol_v4

Function ip6_savecontrol_v4

freebsd/netinet6/ip6_input.c:1176–1373  ·  view source on GitHub ↗

* Create the "control" list for this pcb. * These functions will not modify mbuf chain at all. * * The routine will be called from upper layer handlers like tcp6_input(). * Thus the routine assumes that the caller (tcp6_input) have already * called m_pullup() and all the extension headers are located in the * very first mbuf on the mbuf chain. * * ip6_savecontrol_v4 will handle those optio

Source from the content-addressed store, hash-verified

1174 * options and handle the v6-only ones itself.
1175 */
1176struct mbuf **
1177ip6_savecontrol_v4(struct inpcb *inp, struct mbuf *m, struct mbuf **mp,
1178 int *v4only)
1179{
1180 struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
1181
1182#ifdef SO_TIMESTAMP
1183 if ((inp->inp_socket->so_options & SO_TIMESTAMP) != 0) {
1184 union {
1185 struct timeval tv;
1186 struct bintime bt;
1187 struct timespec ts;
1188 } t;
1189 struct bintime boottimebin, bt1;
1190 struct timespec ts1;
1191 bool stamped;
1192
1193 stamped = false;
1194 switch (inp->inp_socket->so_ts_clock) {
1195 case SO_TS_REALTIME_MICRO:
1196 if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR |
1197 M_TSTMP)) {
1198 mbuf_tstmp2timespec(m, &ts1);
1199 timespec2bintime(&ts1, &bt1);
1200 getboottimebin(&boottimebin);
1201 bintime_add(&bt1, &boottimebin);
1202 bintime2timeval(&bt1, &t.tv);
1203 } else {
1204 microtime(&t.tv);
1205 }
1206 *mp = sbcreatecontrol((caddr_t) &t.tv, sizeof(t.tv),
1207 SCM_TIMESTAMP, SOL_SOCKET);
1208 if (*mp != NULL) {
1209 mp = &(*mp)->m_next;
1210 stamped = true;
1211 }
1212 break;
1213
1214 case SO_TS_BINTIME:
1215 if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR |
1216 M_TSTMP)) {
1217 mbuf_tstmp2timespec(m, &ts1);
1218 timespec2bintime(&ts1, &t.bt);
1219 getboottimebin(&boottimebin);
1220 bintime_add(&t.bt, &boottimebin);
1221 } else {
1222 bintime(&t.bt);
1223 }
1224 *mp = sbcreatecontrol((caddr_t)&t.bt, sizeof(t.bt),
1225 SCM_BINTIME, SOL_SOCKET);
1226 if (*mp != NULL) {
1227 mp = &(*mp)->m_next;
1228 stamped = true;
1229 }
1230 break;
1231
1232 case SO_TS_REALTIME:
1233 if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR |

Callers 2

udp_appendFunction · 0.85
ip6_savecontrolFunction · 0.85

Calls 14

timespec2bintimeFunction · 0.85
getboottimebinFunction · 0.85
bintime_addFunction · 0.85
bintime2timevalFunction · 0.85
microtimeFunction · 0.85
sbcreatecontrolFunction · 0.85
bintime2timespecFunction · 0.85
nanotimeFunction · 0.85
nanouptimeFunction · 0.85
bzeroFunction · 0.85
in6_clearscopeFunction · 0.85
bintimeClass · 0.70

Tested by

no test coverage detected