Closes current data flowset */
| 169 | |
| 170 | /* Closes current data flowset */ |
| 171 | static void inline |
| 172 | close_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 |
no test coverage detected