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

Function close_flowset

freebsd/netgraph/netflow/netflow_v9.c:171–193  ·  view source on GitHub ↗

Closes current data flowset */

Source from the content-addressed store, hash-verified

169
170/* Closes current data flowset */
171static void inline
172close_flowset(struct mbuf *m, struct netflow_v9_packet_opt *t)
173{
174 struct mbuf *m_old;
175 uint32_t zero = 0;
176 int offset = 0;
177 uint16_t *flowset_length, len;
178
179 /* Hack to ensure we are not crossing mbuf boundary, length is uint16_t */
180 m_old = m_getptr(m, t->flow_header + offsetof(struct netflow_v9_flowset_header, length), &offset);
181 flowset_length = (uint16_t *)(mtod(m_old, char *) + offset);
182
183 len = (uint16_t)(m_pktlen(m) - t->flow_header);
184 /* Align on 4-byte boundary (RFC 3954, Clause 5.3) */
185 if (len % 4) {
186 if (m_append(m, 4 - (len % 4), (void *)&zero) != 1)
187 panic("ng_netflow: m_append() failed!");
188
189 len += 4 - (len % 4);
190 }
191
192 *flowset_length = htons(len);
193}
194
195/*
196 * Non-static functions called from ng_netflow.c

Callers 2

export9_sendFunction · 0.85
export9_addFunction · 0.85

Calls 3

m_getptrFunction · 0.85
m_appendFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected