Lines Matching refs:ep

125 	struct encaptab *ep, *match;
143 LIST_FOREACH(ep, &encaptab, chain) {
144 if (ep->af != AF_INET)
146 if (ep->proto >= 0 && ep->proto != proto)
148 if (ep->func)
149 prio = (*ep->func)(m, off, proto, ep->arg);
155 prio = mask_match(ep, (struct sockaddr *)&d,
181 match = ep;
210 struct encaptab *ep, *match;
227 LIST_FOREACH(ep, &encaptab, chain) {
228 if (ep->af != AF_INET6)
230 if (ep->proto >= 0 && ep->proto != proto)
232 if (ep->func)
233 prio = (*ep->func)(m, *offp, proto, ep->arg);
239 prio = mask_match(ep, (struct sockaddr *)&d,
248 match = ep;
272 encap_add(struct encaptab *ep)
276 LIST_INSERT_HEAD(&encaptab, ep, chain);
289 struct encaptab *ep;
292 if (sp->sa_len > sizeof(ep->src) || dp->sa_len > sizeof(ep->dst))
301 LIST_FOREACH(ep, &encaptab, chain) {
302 if (ep->af != af)
304 if (ep->proto != proto)
306 if (ep->src.ss_len != sp->sa_len ||
307 bcmp(&ep->src, sp, sp->sa_len) != 0 ||
308 bcmp(&ep->srcmask, sm, sp->sa_len) != 0)
310 if (ep->dst.ss_len != dp->sa_len ||
311 bcmp(&ep->dst, dp, dp->sa_len) != 0 ||
312 bcmp(&ep->dstmask, dm, dp->sa_len) != 0)
319 ep = malloc(sizeof(*ep), M_NETADDR, M_NOWAIT); /*XXX*/
320 if (ep == NULL) {
324 bzero(ep, sizeof(*ep));
326 ep->af = af;
327 ep->proto = proto;
328 bcopy(sp, &ep->src, sp->sa_len);
329 bcopy(sm, &ep->srcmask, sp->sa_len);
330 bcopy(dp, &ep->dst, dp->sa_len);
331 bcopy(dm, &ep->dstmask, dp->sa_len);
332 ep->psw = psw;
333 ep->arg = arg;
335 encap_add(ep);
337 return (ep);
345 struct encaptab *ep;
351 ep = malloc(sizeof(*ep), M_NETADDR, M_NOWAIT); /*XXX*/
352 if (ep == NULL)
354 bzero(ep, sizeof(*ep));
356 ep->af = af;
357 ep->proto = proto;
358 ep->func = func;
359 ep->psw = psw;
360 ep->arg = arg;
363 encap_add(ep);
365 return (ep);
371 const struct encaptab *ep = cookie;
376 if (p == ep) {
389 mask_match(const struct encaptab *ep, const struct sockaddr *sp,
401 if (sp->sa_family != ep->af || dp->sa_family != ep->af)
403 if (sp->sa_len != ep->src.ss_len || dp->sa_len != ep->dst.ss_len)
409 q = (const u_int8_t *)&ep->srcmask;
418 q = (const u_int8_t *)&ep->dstmask;
432 if (bcmp(&s, &ep->src, ep->src.ss_len) == 0 &&
433 bcmp(&d, &ep->dst, ep->dst.ss_len) == 0) {
440 encap_fillarg(struct mbuf *m, const struct encaptab *ep)
446 *(void**)(tag+1) = ep->arg;