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

Function ip_savecontrol

freebsd/netinet/ip_input.c:1135–1339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1133 (((sp->so_options & SO_TIMESTAMP) && (sp->so_ts_clock == ct)) ? 1 : 0)
1134
1135void
1136ip_savecontrol(struct inpcb *inp, struct mbuf **mp, struct ip *ip,
1137 struct mbuf *m)
1138{
1139 bool stamped;
1140
1141 stamped = false;
1142 if ((inp->inp_socket->so_options & SO_BINTIME) ||
1143 CHECK_SO_CT(inp->inp_socket, SO_TS_BINTIME)) {
1144 struct bintime boottimebin, bt;
1145 struct timespec ts1;
1146
1147 if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR |
1148 M_TSTMP)) {
1149 mbuf_tstmp2timespec(m, &ts1);
1150 timespec2bintime(&ts1, &bt);
1151 getboottimebin(&boottimebin);
1152 bintime_add(&bt, &boottimebin);
1153 } else {
1154 bintime(&bt);
1155 }
1156 *mp = sbcreatecontrol((caddr_t)&bt, sizeof(bt),
1157 SCM_BINTIME, SOL_SOCKET);
1158 if (*mp != NULL) {
1159 mp = &(*mp)->m_next;
1160 stamped = true;
1161 }
1162 }
1163 if (CHECK_SO_CT(inp->inp_socket, SO_TS_REALTIME_MICRO)) {
1164 struct bintime boottimebin, bt1;
1165 struct timespec ts1;
1166 struct timeval tv;
1167
1168 if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR |
1169 M_TSTMP)) {
1170 mbuf_tstmp2timespec(m, &ts1);
1171 timespec2bintime(&ts1, &bt1);
1172 getboottimebin(&boottimebin);
1173 bintime_add(&bt1, &boottimebin);
1174 bintime2timeval(&bt1, &tv);
1175 } else {
1176 microtime(&tv);
1177 }
1178 *mp = sbcreatecontrol((caddr_t)&tv, sizeof(tv),
1179 SCM_TIMESTAMP, SOL_SOCKET);
1180 if (*mp != NULL) {
1181 mp = &(*mp)->m_next;
1182 stamped = true;
1183 }
1184 } else if (CHECK_SO_CT(inp->inp_socket, SO_TS_REALTIME)) {
1185 struct bintime boottimebin;
1186 struct timespec ts, ts1;
1187
1188 if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR |
1189 M_TSTMP)) {
1190 mbuf_tstmp2timespec(m, &ts);
1191 getboottimebin(&boottimebin);
1192 bintime2timespec(&boottimebin, &ts1);

Callers 2

udp_appendFunction · 0.85
rip_appendFunction · 0.85

Calls 14

timespec2bintimeFunction · 0.85
getboottimebinFunction · 0.85
bintime_addFunction · 0.85
sbcreatecontrolFunction · 0.85
bintime2timevalFunction · 0.85
microtimeFunction · 0.85
bintime2timespecFunction · 0.85
nanotimeFunction · 0.85
nanouptimeFunction · 0.85
bzeroFunction · 0.85
ip_srcrouteFunction · 0.85
rss_hash2bucketFunction · 0.85

Tested by

no test coverage detected