Lines Matching defs:conf
56 struct ng_patch_config *conf;
74 const struct ng_patch_config *conf;
76 conf = (const struct ng_patch_config *)(buf -
79 return (conf->count);
212 struct ng_patch_config *conf, *newconf;
225 if (privp->conf == NULL)
229 NG_PATCH_CONF_SIZE(privp->conf->count), M_WAITOK);
234 bcopy(privp->conf, resp->data,
235 NG_PATCH_CONF_SIZE(privp->conf->count));
237 conf = (struct ng_patch_config *) resp->data;
239 for (i = 0; i < conf->count; i++) {
240 switch (conf->ops[i].length)
243 conf->ops[i].val.v8 = conf->ops[i].val.v1;
246 conf->ops[i].val.v8 = conf->ops[i].val.v2;
249 conf->ops[i].val.v8 = conf->ops[i].val.v4;
259 conf = (struct ng_patch_config *) msg->data;
262 msg->header.arglen < NG_PATCH_CONF_SIZE(conf->count))
265 for (i = 0; i < conf->count; i++) {
266 switch (conf->ops[i].length)
269 conf->ops[i].val.v1 = (uint8_t) conf->ops[i].val.v8;
272 conf->ops[i].val.v2 = (uint16_t) conf->ops[i].val.v8;
275 conf->ops[i].val.v4 = (uint32_t) conf->ops[i].val.v8;
284 conf->csum_flags &= NG_PATCH_CSUM_IPV4|NG_PATCH_CSUM_IPV6;
285 conf->relative_offset = !!conf->relative_offset;
287 newconf = malloc(NG_PATCH_CONF_SIZE(conf->count), M_NETGRAPH, M_WAITOK | M_ZERO);
289 bcopy(conf, newconf, NG_PATCH_CONF_SIZE(conf->count));
291 if (privp->conf)
292 free(privp->conf, M_NETGRAPH);
294 privp->conf = newconf;
359 for (i = 0; i < privp->conf->count; i++) {
360 offset = global_offset + privp->conf->ops[i].offset;
362 if (offset + privp->conf->ops[i].length > m->m_pkthdr.len)
366 if (privp->conf->ops[i].mode != NG_PATCH_MODE_SET)
367 m_copydata(m, offset, privp->conf->ops[i].length, (caddr_t) &val);
369 switch (privp->conf->ops[i].length)
372 switch (privp->conf->ops[i].mode)
375 val.v1 = privp->conf->ops[i].val.v1;
378 val.v1 += privp->conf->ops[i].val.v1;
381 val.v1 -= privp->conf->ops[i].val.v1;
384 val.v1 *= privp->conf->ops[i].val.v1;
387 val.v1 /= privp->conf->ops[i].val.v1;
393 val.v1 &= privp->conf->ops[i].val.v1;
396 val.v1 |= privp->conf->ops[i].val.v1;
399 val.v1 ^= privp->conf->ops[i].val.v1;
402 val.v1 <<= privp->conf->ops[i].val.v1;
405 val.v1 >>= privp->conf->ops[i].val.v1;
413 switch (privp->conf->ops[i].mode)
416 val.v2 = privp->conf->ops[i].val.v2;
419 val.v2 += privp->conf->ops[i].val.v2;
422 val.v2 -= privp->conf->ops[i].val.v2;
425 val.v2 *= privp->conf->ops[i].val.v2;
428 val.v2 /= privp->conf->ops[i].val.v2;
434 val.v2 &= privp->conf->ops[i].val.v2;
437 val.v2 |= privp->conf->ops[i].val.v2;
440 val.v2 ^= privp->conf->ops[i].val.v2;
443 val.v2 <<= privp->conf->ops[i].val.v2;
446 val.v2 >>= privp->conf->ops[i].val.v2;
457 switch (privp->conf->ops[i].mode)
460 val.v4 = privp->conf->ops[i].val.v4;
463 val.v4 += privp->conf->ops[i].val.v4;
466 val.v4 -= privp->conf->ops[i].val.v4;
469 val.v4 *= privp->conf->ops[i].val.v4;
472 val.v4 /= privp->conf->ops[i].val.v4;
478 val.v4 &= privp->conf->ops[i].val.v4;
481 val.v4 |= privp->conf->ops[i].val.v4;
484 val.v4 ^= privp->conf->ops[i].val.v4;
487 val.v4 <<= privp->conf->ops[i].val.v4;
490 val.v4 >>= privp->conf->ops[i].val.v4;
501 switch (privp->conf->ops[i].mode)
504 val.v8 = privp->conf->ops[i].val.v8;
507 val.v8 += privp->conf->ops[i].val.v8;
510 val.v8 -= privp->conf->ops[i].val.v8;
513 val.v8 *= privp->conf->ops[i].val.v8;
516 val.v8 /= privp->conf->ops[i].val.v8;
522 val.v8 &= privp->conf->ops[i].val.v8;
525 val.v8 |= privp->conf->ops[i].val.v8;
528 val.v8 ^= privp->conf->ops[i].val.v8;
531 val.v8 <<= privp->conf->ops[i].val.v8;
534 val.v8 >>= privp->conf->ops[i].val.v8;
543 m_copyback(m, offset, privp->conf->ops[i].length, (caddr_t) &val);
578 if (priv->conf && hook == priv->in &&
585 if (priv->conf->relative_offset) {
626 m->m_pkthdr.csum_flags |= priv->conf->csum_flags;
667 if (privdata->conf != NULL)
668 free(privdata->conf, M_NETGRAPH);