Lines Matching refs:ep

165 	struct encaptab *ep, *match;
194 for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) {
195 if (ep->af != AF_INET)
197 if (ep->proto >= 0 && ep->proto != proto)
199 if (ep->func)
200 prio = (*ep->func)(m, off, proto, ep->arg);
206 prio = mask_match(ep, (struct sockaddr *)&d,
232 match = ep;
272 struct encaptab *ep, *match;
290 for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) {
291 if (ep->af != AF_INET6)
293 if (ep->proto >= 0 && ep->proto != proto)
295 if (ep->func)
296 prio = (*ep->func)(m, *offp, proto, ep->arg);
302 prio = mask_match(ep, (struct sockaddr *)&d,
311 match = ep;
333 encap_add(ep)
334 struct encaptab *ep;
337 LIST_INSERT_HEAD(&encaptab, ep, chain);
354 struct encaptab *ep;
358 if (sp->sa_len > sizeof(ep->src) || dp->sa_len > sizeof(ep->dst)) {
372 for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) {
373 if (ep->af != af)
375 if (ep->proto != proto)
377 if (ep->src.ss_len != sp->sa_len ||
378 bcmp(&ep->src, sp, sp->sa_len) != 0 ||
379 bcmp(&ep->srcmask, sm, sp->sa_len) != 0)
381 if (ep->dst.ss_len != dp->sa_len ||
382 bcmp(&ep->dst, dp, dp->sa_len) != 0 ||
383 bcmp(&ep->dstmask, dm, dp->sa_len) != 0)
390 ep = _MALLOC(sizeof(*ep), M_NETADDR, M_WAITOK); /*XXX*/
391 if (ep == NULL) {
395 bzero(ep, sizeof(*ep));
397 ep->af = af;
398 ep->proto = proto;
399 bcopy(sp, &ep->src, sp->sa_len);
400 bcopy(sm, &ep->srcmask, sp->sa_len);
401 bcopy(dp, &ep->dst, dp->sa_len);
402 bcopy(dm, &ep->dstmask, dp->sa_len);
403 ep->psw = psw;
404 ep->arg = arg;
406 encap_add(ep);
409 return ep;
423 struct encaptab *ep;
432 ep = _MALLOC(sizeof(*ep), M_NETADDR, M_WAITOK); /*XXX*/
433 if (ep == NULL) {
437 bzero(ep, sizeof(*ep));
439 ep->af = af;
440 ep->proto = proto;
441 ep->func = func;
442 ep->psw = psw;
443 ep->arg = arg;
445 encap_add(ep);
448 return ep;
458 const struct encaptab *ep = cookie;
462 if (p == ep) {
473 mask_match(ep, sp, dp)
474 const struct encaptab *ep;
487 if (sp->sa_family != ep->af || dp->sa_family != ep->af)
489 if (sp->sa_len != ep->src.ss_len || dp->sa_len != ep->dst.ss_len)
495 q = (const u_int8_t *)&ep->srcmask;
504 q = (const u_int8_t *)&ep->dstmask;
518 if (bcmp(&s, &ep->src, ep->src.ss_len) == 0 &&
519 bcmp(&d, &ep->dst, ep->dst.ss_len) == 0) {
532 const struct encaptab *ep)
542 et->arg = ep->arg;