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

Function ng_car_rcvdata

freebsd/netgraph/ng_car.c:259–291  ·  view source on GitHub ↗

* Data has arrived. */

Source from the content-addressed store, hash-verified

257 * Data has arrived.
258 */
259static int
260ng_car_rcvdata(hook_p hook, item_p item )
261{
262 struct hookinfo *const hinfo = NG_HOOK_PRIVATE(hook);
263 struct mbuf *m;
264 int error = 0;
265 u_int len;
266
267 /* If queue is not empty now then enqueue packet. */
268 if (hinfo->q_first != hinfo->q_last) {
269 ng_car_enqueue(hinfo, item);
270 return (0);
271 }
272
273 m = NGI_M(item);
274
275#define NG_CAR_PERFORM_MATCH_ACTION(a) \
276 do { \
277 switch (a) { \
278 case NG_CAR_ACTION_FORWARD: \
279 /* Do nothing. */ \
280 break; \
281 case NG_CAR_ACTION_MARK: \
282 /* XXX find a way to mark packets (mbuf tag?) */ \
283 ++hinfo->stats.errors; \
284 break; \
285 case NG_CAR_ACTION_DROP: \
286 default: \
287 /* Drop packet and return. */ \
288 NG_FREE_ITEM(item); \
289 ++hinfo->stats.dropped_pkts; \
290 return (0); \
291 } \
292 } while (0)
293
294 /* Packet is counted as 128 tokens for better resolution */

Callers

nothing calls this directly

Calls 1

ng_car_enqueueFunction · 0.85

Tested by

no test coverage detected