Lines Matching defs:ep
164 struct encaptab *ep, *match;
190 for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) {
191 if (ep->af != AF_INET)
193 if (ep->proto >= 0 && ep->proto != proto)
195 if (ep->func)
196 prio = (*ep->func)(m, off, proto, ep->arg);
202 prio = mask_match(ep, (struct sockaddr *)&d,
228 match = ep;
270 struct encaptab *ep, *match;
288 for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) {
289 if (ep->af != AF_INET6)
291 if (ep->proto >= 0 && ep->proto != proto)
293 if (ep->func)
294 prio = (*ep->func)(m, *offp, proto, ep->arg);
300 prio = mask_match(ep, (struct sockaddr *)&d,
309 match = ep;
331 encap_add(ep)
332 struct encaptab *ep;
335 LIST_INSERT_HEAD(&encaptab, ep, chain);
352 struct encaptab *ep;
356 if (sp->sa_len > sizeof(ep->src) || dp->sa_len > sizeof(ep->dst)) {
370 for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) {
371 if (ep->af != af)
373 if (ep->proto != proto)
375 if (ep->src.ss_len != sp->sa_len ||
376 bcmp(&ep->src, sp, sp->sa_len) != 0 ||
377 bcmp(&ep->srcmask, sm, sp->sa_len) != 0)
379 if (ep->dst.ss_len != dp->sa_len ||
380 bcmp(&ep->dst, dp, dp->sa_len) != 0 ||
381 bcmp(&ep->dstmask, dm, dp->sa_len) != 0)
388 ep = _MALLOC(sizeof(*ep), M_NETADDR, M_WAITOK); /*XXX*/
389 if (ep == NULL) {
393 bzero(ep, sizeof(*ep));
395 ep->af = af;
396 ep->proto = proto;
397 bcopy(sp, &ep->src, sp->sa_len);
398 bcopy(sm, &ep->srcmask, sp->sa_len);
399 bcopy(dp, &ep->dst, dp->sa_len);
400 bcopy(dm, &ep->dstmask, dp->sa_len);
401 ep->psw = psw;
402 ep->arg = arg;
404 encap_add(ep);
407 return ep;
421 struct encaptab *ep;
430 ep = _MALLOC(sizeof(*ep), M_NETADDR, M_WAITOK); /*XXX*/
431 if (ep == NULL) {
435 bzero(ep, sizeof(*ep));
437 ep->af = af;
438 ep->proto = proto;
439 ep->func = func;
440 ep->psw = psw;
441 ep->arg = arg;
443 encap_add(ep);
446 return ep;
456 const struct encaptab *ep = cookie;
460 if (p == ep) {
471 mask_match(ep, sp, dp)
472 const struct encaptab *ep;
485 if (sp->sa_family != ep->af || dp->sa_family != ep->af)
487 if (sp->sa_len != ep->src.ss_len || dp->sa_len != ep->dst.ss_len)
493 q = (const u_int8_t *)&ep->srcmask;
502 q = (const u_int8_t *)&ep->dstmask;
516 if (bcmp(&s, &ep->src, ep->src.ss_len) == 0 &&
517 bcmp(&d, &ep->dst, ep->dst.ss_len) == 0) {
530 const struct encaptab *ep)
540 et->arg = ep->arg;