Lines Matching refs:pw

70 	struct l2vpn_pw		*pw;
76 while ((pw = LIST_FIRST(&l2vpn->pw_list)) != NULL) {
77 LIST_REMOVE(pw, entry);
78 free(pw);
87 struct l2vpn_pw *pw;
89 LIST_FOREACH(pw, &l2vpn->pw_list, entry)
90 l2vpn_pw_init(pw);
96 struct l2vpn_pw *pw;
98 LIST_FOREACH(pw, &l2vpn->pw_list, entry)
99 l2vpn_pw_exit(pw);
135 struct l2vpn_pw *pw;
142 LIST_FOREACH(pw, &l2vpn->pw_list, entry) {
143 nbr = nbr_find_ldpid(pw->lsr_id.s_addr);
152 fec.fec.pwid.pwid = pw->pwid;
161 struct l2vpn_pw *pw;
163 if ((pw = calloc(1, sizeof(*pw))) == NULL)
166 pw->l2vpn = l2vpn;
167 strlcpy(pw->ifname, kif->ifname, sizeof(pw->ifname));
168 pw->ifindex = kif->ifindex;
170 return (pw);
176 struct l2vpn_pw *pw;
178 LIST_FOREACH(pw, &l2vpn->pw_list, entry)
179 if (pw->ifindex == ifindex)
180 return (pw);
186 l2vpn_pw_init(struct l2vpn_pw *pw)
190 l2vpn_pw_reset(pw);
192 l2vpn_pw_fec(pw, &fec);
193 lde_kernel_insert(&fec, AF_INET, (union ldpd_addr*)&pw->lsr_id, 0,
194 0, (void *)pw);
198 l2vpn_pw_exit(struct l2vpn_pw *pw)
202 l2vpn_pw_fec(pw, &fec);
203 lde_kernel_remove(&fec, AF_INET, (union ldpd_addr*)&pw->lsr_id, 0);
207 l2vpn_pw_fec(struct l2vpn_pw *pw, struct fec *fec)
211 fec->u.pwid.type = pw->l2vpn->pw_type;
212 fec->u.pwid.pwid = pw->pwid;
213 fec->u.pwid.lsr_id = pw->lsr_id;
217 l2vpn_pw_reset(struct l2vpn_pw *pw)
219 pw->remote_group = 0;
220 pw->remote_mtu = 0;
221 pw->remote_status = 0;
223 if (pw->flags & F_PW_CWORD_CONF)
224 pw->flags |= F_PW_CWORD;
226 pw->flags &= ~F_PW_CWORD;
228 if (pw->flags & F_PW_STATUSTLV_CONF)
229 pw->flags |= F_PW_STATUSTLV;
231 pw->flags &= ~F_PW_STATUSTLV;
235 l2vpn_pw_ok(struct l2vpn_pw *pw, struct fec_nh *fnh)
245 if (pw->l2vpn->mtu != pw->remote_mtu)
248 /* check pw status if applicable */
249 if ((pw->flags & F_PW_STATUSTLV) &&
250 pw->remote_status != PW_FORWARDING)
255 switch (pw->af) {
258 fec.u.ipv4.prefix = pw->addr.v4;
263 fec.u.ipv6.prefix = pw->addr.v6;
287 struct l2vpn_pw *pw;
292 pw = (struct l2vpn_pw *) fn->data;
293 if (pw == NULL)
303 !(pw->flags & F_PW_CWORD_CONF)) {
307 (pw->flags & F_PW_CWORD_CONF)) {
314 pw->flags &= ~F_PW_CWORD;
318 if (pw->flags & F_PW_CWORD_CONF)
319 pw->flags |= F_PW_CWORD;
324 pw->flags &= ~F_PW_CWORD;
329 pw->flags &= ~F_PW_STATUSTLV;
375 struct l2vpn_pw *pw;
389 pw = (struct l2vpn_pw *) fn->data;
390 if (pw == NULL)
398 if (pw->remote_status == nm->pw_status)
400 pw->remote_status = nm->pw_status;
402 if (l2vpn_pw_ok(pw, fnh))
415 struct l2vpn_pw *pw;
423 pw = (struct l2vpn_pw *) fn->data;
424 if (pw == NULL)
436 if (wcard->fec.pwid.group_id != pw->remote_group)
446 if (pw->remote_status == nm->pw_status)
448 pw->remote_status = nm->pw_status;
450 if (l2vpn_pw_ok(pw, fnh))
461 struct l2vpn_pw *pw;
467 LIST_FOREACH(pw, &l2vpn->pw_list, entry) {
468 if (af != pw->af || ldp_addrcmp(af, &pw->addr, addr))
471 l2vpn_pw_fec(pw, &fec);
476 &pw->lsr_id, 0);
480 if (l2vpn_pw_ok(pw, fnh))
492 struct l2vpn_pw *pw;
496 LIST_FOREACH(pw, &l2vpn->pw_list, entry) {
498 strlcpy(pwctl.ifname, pw->ifname,
500 pwctl.pwid = pw->pwid;
501 pwctl.lsr_id = pw->lsr_id;
502 pwctl.status = pw->flags & F_PW_STATUS_UP;
515 struct l2vpn_pw *pw;
532 pw = (struct l2vpn_pw *) fn->data;
533 if (pw) {
536 pwctl.local_ifmtu = pw->l2vpn->mtu;
552 } else if (pw) {
566 struct l2vpn_pw *pw;
568 LIST_FOREACH(pw, &l2vpn->pw_list, entry)
569 ldpe_l2vpn_pw_init(pw);
575 struct l2vpn_pw *pw;
577 LIST_FOREACH(pw, &l2vpn->pw_list, entry)
578 ldpe_l2vpn_pw_exit(pw);
582 ldpe_l2vpn_pw_init(struct l2vpn_pw *pw)
586 tnbr = tnbr_find(leconf, pw->af, &pw->addr);
588 tnbr = tnbr_new(leconf, pw->af, &pw->addr);
597 ldpe_l2vpn_pw_exit(struct l2vpn_pw *pw)
601 tnbr = tnbr_find(leconf, pw->af, &pw->addr);