2 * Copyright (C) 2016 by Open Source Routing.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; see the file COPYING; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
33 static int ldp_config_write(struct vty
*);
34 static void ldp_af_iface_config_write(struct vty
*, int);
35 static void ldp_af_config_write(struct vty
*, int, struct ldpd_conf
*,
36 struct ldpd_af_conf
*);
37 static int ldp_l2vpn_config_write(struct vty
*);
38 static void ldp_l2vpn_pw_config_write(struct vty
*, struct l2vpn_pw
*);
39 static int ldp_vty_get_af(struct vty
*);
40 static int ldp_iface_is_configured(struct ldpd_conf
*, const char *);
42 struct cmd_node ldp_node
= {
45 .parent_node
= CONFIG_NODE
,
46 .prompt
= "%s(config-ldp)# ",
47 .config_write
= ldp_config_write
,
50 struct cmd_node ldp_ipv4_node
= {
52 .node
= LDP_IPV4_NODE
,
53 .parent_node
= LDP_NODE
,
54 .prompt
= "%s(config-ldp-af)# ",
57 struct cmd_node ldp_ipv6_node
= {
59 .node
= LDP_IPV6_NODE
,
60 .parent_node
= LDP_NODE
,
61 .prompt
= "%s(config-ldp-af)# ",
64 struct cmd_node ldp_ipv4_iface_node
= {
65 .name
= "ldp ipv4 interface",
66 .node
= LDP_IPV4_IFACE_NODE
,
67 .parent_node
= LDP_IPV4_NODE
,
68 .prompt
= "%s(config-ldp-af-if)# ",
71 struct cmd_node ldp_ipv6_iface_node
= {
72 .name
= "ldp ipv6 interface",
73 .node
= LDP_IPV6_IFACE_NODE
,
74 .parent_node
= LDP_IPV6_NODE
,
75 .prompt
= "%s(config-ldp-af-if)# ",
78 struct cmd_node ldp_l2vpn_node
= {
80 .node
= LDP_L2VPN_NODE
,
81 .parent_node
= CONFIG_NODE
,
82 .prompt
= "%s(config-l2vpn)# ",
83 .config_write
= ldp_l2vpn_config_write
,
86 struct cmd_node ldp_pseudowire_node
= {
88 .node
= LDP_PSEUDOWIRE_NODE
,
89 .parent_node
= LDP_L2VPN_NODE
,
90 .prompt
= "%s(config-l2vpn-pw)# ",
94 ldp_get_address(const char *str
, int *af
, union ldpd_addr
*addr
)
96 if (!str
|| !af
|| !addr
)
99 memset(addr
, 0, sizeof(*addr
));
101 if (inet_pton(AF_INET
, str
, &addr
->v4
) == 1) {
106 if (inet_pton(AF_INET6
, str
, &addr
->v6
) == 1) {
115 ldp_af_iface_config_write(struct vty
*vty
, int af
)
120 RB_FOREACH(iface
, iface_head
, &ldpd_conf
->iface_tree
) {
121 ia
= iface_af_get(iface
, af
);
125 vty_out (vty
, " !\n");
126 vty_out (vty
, " interface %s\n", iface
->name
);
128 if (ia
->hello_holdtime
!= LINK_DFLT_HOLDTIME
&&
129 ia
->hello_holdtime
!= 0)
130 vty_out (vty
, " discovery hello holdtime %u\n",
132 if (ia
->hello_interval
!= DEFAULT_HELLO_INTERVAL
&&
133 ia
->hello_interval
!= 0)
134 vty_out (vty
, " discovery hello interval %u\n",
140 ldp_af_config_write(struct vty
*vty
, int af
, struct ldpd_conf
*conf
,
141 struct ldpd_af_conf
*af_conf
)
145 if (!(af_conf
->flags
& F_LDPD_AF_ENABLED
))
148 vty_out (vty
, " !\n");
149 vty_out (vty
, " address-family %s\n", af_name(af
));
151 if (af_conf
->lhello_holdtime
!= LINK_DFLT_HOLDTIME
&&
152 af_conf
->lhello_holdtime
!= 0 )
153 vty_out (vty
, " discovery hello holdtime %u\n",
154 af_conf
->lhello_holdtime
);
155 if (af_conf
->lhello_interval
!= DEFAULT_HELLO_INTERVAL
&&
156 af_conf
->lhello_interval
!= 0)
157 vty_out (vty
, " discovery hello interval %u\n",
158 af_conf
->lhello_interval
);
160 if (af_conf
->flags
& F_LDPD_AF_THELLO_ACCEPT
) {
161 vty_out(vty
, " discovery targeted-hello accept");
162 if (af_conf
->acl_thello_accept_from
[0] != '\0')
163 vty_out(vty
, " from %s",
164 af_conf
->acl_thello_accept_from
);
168 if (af_conf
->thello_holdtime
!= TARGETED_DFLT_HOLDTIME
&&
169 af_conf
->thello_holdtime
!= 0)
170 vty_out (vty
, " discovery targeted-hello holdtime %u\n",
171 af_conf
->thello_holdtime
);
172 if (af_conf
->thello_interval
!= DEFAULT_HELLO_INTERVAL
&&
173 af_conf
->thello_interval
!= 0)
174 vty_out (vty
, " discovery targeted-hello interval %u\n",
175 af_conf
->thello_interval
);
177 if (ldp_addrisset(af
, &af_conf
->trans_addr
))
178 vty_out (vty
, " discovery transport-address %s\n",
179 log_addr(af
, &af_conf
->trans_addr
));
182 " ! Incomplete config, specify a discovery transport-address\n");
184 if ((af_conf
->flags
& F_LDPD_AF_ALLOCHOSTONLY
) ||
185 af_conf
->acl_label_allocate_for
[0] != '\0') {
186 vty_out(vty
, " label local allocate");
187 if (af_conf
->flags
& F_LDPD_AF_ALLOCHOSTONLY
)
188 vty_out(vty
, " host-routes");
190 vty_out(vty
, " for %s",
191 af_conf
->acl_label_allocate_for
);
195 if (af_conf
->acl_label_advertise_for
[0] != '\0' ||
196 af_conf
->acl_label_advertise_to
[0] != '\0') {
197 vty_out(vty
, " label local advertise");
198 if (af_conf
->acl_label_advertise_to
[0] != '\0')
199 vty_out(vty
, " to %s",
200 af_conf
->acl_label_advertise_to
);
201 if (af_conf
->acl_label_advertise_for
[0] != '\0')
202 vty_out(vty
, " for %s",
203 af_conf
->acl_label_advertise_for
);
207 if (af_conf
->flags
& F_LDPD_AF_EXPNULL
) {
208 vty_out(vty
, " label local advertise explicit-null");
209 if (af_conf
->acl_label_expnull_for
[0] != '\0')
210 vty_out(vty
, " for %s",
211 af_conf
->acl_label_expnull_for
);
215 if (af_conf
->acl_label_accept_for
[0] != '\0' ||
216 af_conf
->acl_label_accept_from
[0] != '\0') {
217 vty_out(vty
, " label remote accept");
218 if (af_conf
->acl_label_accept_from
[0] != '\0')
219 vty_out(vty
, " from %s",
220 af_conf
->acl_label_accept_from
);
221 if (af_conf
->acl_label_accept_for
[0] != '\0')
222 vty_out(vty
, " for %s",
223 af_conf
->acl_label_accept_for
);
227 if (af_conf
->flags
& F_LDPD_AF_NO_GTSM
)
228 vty_out (vty
, " ttl-security disable\n");
230 if (af_conf
->keepalive
!= DEFAULT_KEEPALIVE
)
231 vty_out (vty
, " session holdtime %u\n",af_conf
->keepalive
);
233 RB_FOREACH(tnbr
, tnbr_head
, &ldpd_conf
->tnbr_tree
) {
234 if (tnbr
->af
== af
) {
235 vty_out (vty
, " !\n");
236 vty_out (vty
, " neighbor %s targeted\n",
237 log_addr(tnbr
->af
, &tnbr
->addr
));
241 ldp_af_iface_config_write(vty
, af
);
243 vty_out(vty
, " !\n");
244 vty_out(vty
, " exit-address-family\n");
248 ldp_config_write(struct vty
*vty
)
250 struct nbr_params
*nbrp
;
252 if (!(ldpd_conf
->flags
& F_LDPD_ENABLED
))
255 vty_out (vty
, "mpls ldp\n");
257 if (ldpd_conf
->rtr_id
.s_addr
!= INADDR_ANY
)
258 vty_out(vty
, " router-id %s\n", inet_ntoa(ldpd_conf
->rtr_id
));
260 if (ldpd_conf
->lhello_holdtime
!= LINK_DFLT_HOLDTIME
&&
261 ldpd_conf
->lhello_holdtime
!= 0)
262 vty_out (vty
, " discovery hello holdtime %u\n",
263 ldpd_conf
->lhello_holdtime
);
264 if (ldpd_conf
->lhello_interval
!= DEFAULT_HELLO_INTERVAL
&&
265 ldpd_conf
->lhello_interval
!= 0)
266 vty_out (vty
, " discovery hello interval %u\n",
267 ldpd_conf
->lhello_interval
);
269 if (ldpd_conf
->thello_holdtime
!= TARGETED_DFLT_HOLDTIME
&&
270 ldpd_conf
->thello_holdtime
!= 0)
271 vty_out (vty
, " discovery targeted-hello holdtime %u\n",
272 ldpd_conf
->thello_holdtime
);
273 if (ldpd_conf
->thello_interval
!= DEFAULT_HELLO_INTERVAL
&&
274 ldpd_conf
->thello_interval
!= 0)
275 vty_out (vty
, " discovery targeted-hello interval %u\n",
276 ldpd_conf
->thello_interval
);
278 if (ldpd_conf
->trans_pref
== DUAL_STACK_LDPOV4
)
280 " dual-stack transport-connection prefer ipv4\n");
282 if (ldpd_conf
->flags
& F_LDPD_DS_CISCO_INTEROP
)
283 vty_out (vty
, " dual-stack cisco-interop\n");
285 if (ldpd_conf
->flags
& F_LDPD_ORDERED_CONTROL
)
286 vty_out (vty
, " ordered-control\n");
288 RB_FOREACH(nbrp
, nbrp_head
, &ldpd_conf
->nbrp_tree
) {
289 if (nbrp
->flags
& F_NBRP_KEEPALIVE
)
290 vty_out (vty
, " neighbor %s session holdtime %u\n",
291 inet_ntoa(nbrp
->lsr_id
),nbrp
->keepalive
);
293 if (nbrp
->flags
& F_NBRP_GTSM
) {
294 if (nbrp
->gtsm_enabled
)
295 vty_out (vty
, " neighbor %s ttl-security hops %u\n", inet_ntoa(nbrp
->lsr_id
),
298 vty_out (vty
, " neighbor %s ttl-security disable\n",inet_ntoa(nbrp
->lsr_id
));
301 if (nbrp
->auth
.method
== AUTH_MD5SIG
)
302 vty_out (vty
, " neighbor %s password %s\n",
303 inet_ntoa(nbrp
->lsr_id
),nbrp
->auth
.md5key
);
306 ldp_af_config_write(vty
, AF_INET
, ldpd_conf
, &ldpd_conf
->ipv4
);
307 ldp_af_config_write(vty
, AF_INET6
, ldpd_conf
, &ldpd_conf
->ipv6
);
308 vty_out (vty
, " !\n");
309 vty_out (vty
, "!\n");
315 ldp_l2vpn_pw_config_write(struct vty
*vty
, struct l2vpn_pw
*pw
)
317 int missing_lsrid
= 0;
318 int missing_pwid
= 0;
320 vty_out (vty
, " !\n");
321 vty_out (vty
, " member pseudowire %s\n", pw
->ifname
);
323 if (pw
->lsr_id
.s_addr
!= INADDR_ANY
)
324 vty_out (vty
, " neighbor lsr-id %s\n",inet_ntoa(pw
->lsr_id
));
328 if (pw
->flags
& F_PW_STATIC_NBR_ADDR
)
329 vty_out (vty
, " neighbor address %s\n",
330 log_addr(pw
->af
, &pw
->addr
));
333 vty_out (vty
, " pw-id %u\n", pw
->pwid
);
337 if (!(pw
->flags
& F_PW_CWORD_CONF
))
338 vty_out (vty
, " control-word exclude\n");
340 if (!(pw
->flags
& F_PW_STATUSTLV_CONF
))
341 vty_out (vty
, " pw-status disable\n");
345 " ! Incomplete config, specify a neighbor lsr-id\n");
347 vty_out (vty
," ! Incomplete config, specify a pw-id\n");
351 ldp_l2vpn_config_write(struct vty
*vty
)
354 struct l2vpn_if
*lif
;
357 RB_FOREACH(l2vpn
, l2vpn_head
, &ldpd_conf
->l2vpn_tree
) {
358 vty_out (vty
, "l2vpn %s type vpls\n", l2vpn
->name
);
360 if (l2vpn
->pw_type
!= DEFAULT_PW_TYPE
)
361 vty_out (vty
, " vc type ethernet-tagged\n");
363 if (l2vpn
->mtu
!= DEFAULT_L2VPN_MTU
)
364 vty_out (vty
, " mtu %u\n", l2vpn
->mtu
);
366 if (l2vpn
->br_ifname
[0] != '\0')
367 vty_out (vty
, " bridge %s\n",l2vpn
->br_ifname
);
369 RB_FOREACH(lif
, l2vpn_if_head
, &l2vpn
->if_tree
)
370 vty_out (vty
, " member interface %s\n",lif
->ifname
);
372 RB_FOREACH(pw
, l2vpn_pw_head
, &l2vpn
->pw_tree
)
373 ldp_l2vpn_pw_config_write(vty
, pw
);
374 RB_FOREACH(pw
, l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
)
375 ldp_l2vpn_pw_config_write(vty
, pw
);
377 vty_out (vty
, " !\n");
378 vty_out (vty
, "!\n");
385 ldp_vty_get_af(struct vty
*vty
)
389 case LDP_IPV4_IFACE_NODE
:
392 case LDP_IPV6_IFACE_NODE
:
395 fatalx("ldp_vty_get_af: unexpected node");
400 ldp_iface_is_configured(struct ldpd_conf
*xconf
, const char *ifname
)
404 if (if_lookup_name(xconf
, ifname
))
407 RB_FOREACH(l2vpn
, l2vpn_head
, &xconf
->l2vpn_tree
) {
408 if (l2vpn_if_find(l2vpn
, ifname
))
410 if (l2vpn_pw_find(l2vpn
, ifname
))
418 ldp_vty_mpls_ldp(struct vty
*vty
, const char *negate
)
421 vty_conf
->flags
&= ~F_LDPD_ENABLED
;
423 vty
->node
= LDP_NODE
;
424 vty_conf
->flags
|= F_LDPD_ENABLED
;
427 ldp_config_apply(vty
, vty_conf
);
429 return (CMD_SUCCESS
);
433 ldp_vty_address_family(struct vty
*vty
, const char *negate
, const char *af_str
)
435 struct ldpd_af_conf
*af_conf
;
439 return (CMD_WARNING_CONFIG_FAILED
);
441 if (strcmp(af_str
, "ipv4") == 0) {
443 af_conf
= &vty_conf
->ipv4
;
444 } else if (strcmp(af_str
, "ipv6") == 0) {
446 af_conf
= &vty_conf
->ipv6
;
448 return (CMD_WARNING_CONFIG_FAILED
);
451 af_conf
->flags
&= ~F_LDPD_AF_ENABLED
;
452 ldp_config_apply(vty
, vty_conf
);
453 return (CMD_SUCCESS
);
458 vty
->node
= LDP_IPV4_NODE
;
461 vty
->node
= LDP_IPV6_NODE
;
464 fatalx("ldp_vty_address_family: unknown af");
466 af_conf
->flags
|= F_LDPD_AF_ENABLED
;
468 ldp_config_apply(vty
, vty_conf
);
470 return (CMD_SUCCESS
);
473 int ldp_vty_disc_holdtime(struct vty
*vty
, const char *negate
,
474 enum hello_type hello_type
, long secs
)
476 struct ldpd_af_conf
*af_conf
;
484 switch (hello_type
) {
486 vty_conf
->lhello_holdtime
= LINK_DFLT_HOLDTIME
;
489 vty_conf
->thello_holdtime
=
490 TARGETED_DFLT_HOLDTIME
;
494 switch (hello_type
) {
496 vty_conf
->lhello_holdtime
= secs
;
499 vty_conf
->thello_holdtime
= secs
;
503 ldp_config_apply(vty
, vty_conf
);
507 af
= ldp_vty_get_af(vty
);
508 af_conf
= ldp_af_conf_get(vty_conf
, af
);
511 switch (hello_type
) {
513 af_conf
->lhello_holdtime
= 0;
516 af_conf
->thello_holdtime
= 0;
520 switch (hello_type
) {
522 af_conf
->lhello_holdtime
= secs
;
525 af_conf
->thello_holdtime
= secs
;
529 ldp_config_apply(vty
, vty_conf
);
531 case LDP_IPV4_IFACE_NODE
:
532 case LDP_IPV6_IFACE_NODE
:
533 af
= ldp_vty_get_af(vty
);
534 iface
= VTY_GET_CONTEXT(iface
);
535 VTY_CHECK_CONTEXT(iface
);
537 ia
= iface_af_get(iface
, af
);
539 ia
->hello_holdtime
= 0;
541 ia
->hello_holdtime
= secs
;
543 ldp_config_apply(vty
, vty_conf
);
546 fatalx("ldp_vty_disc_holdtime: unexpected node");
549 return (CMD_SUCCESS
);
553 ldp_vty_disc_interval(struct vty
*vty
, const char *negate
,
554 enum hello_type hello_type
, long secs
)
556 struct ldpd_af_conf
*af_conf
;
564 switch (hello_type
) {
566 vty_conf
->lhello_interval
=
567 DEFAULT_HELLO_INTERVAL
;
570 vty_conf
->thello_interval
=
571 DEFAULT_HELLO_INTERVAL
;
575 switch (hello_type
) {
577 vty_conf
->lhello_interval
= secs
;
580 vty_conf
->thello_interval
= secs
;
584 ldp_config_apply(vty
, vty_conf
);
588 af
= ldp_vty_get_af(vty
);
589 af_conf
= ldp_af_conf_get(vty_conf
, af
);
592 switch (hello_type
) {
594 af_conf
->lhello_interval
= 0;
597 af_conf
->thello_interval
= 0;
601 switch (hello_type
) {
603 af_conf
->lhello_interval
= secs
;
606 af_conf
->thello_interval
= secs
;
610 ldp_config_apply(vty
, vty_conf
);
612 case LDP_IPV4_IFACE_NODE
:
613 case LDP_IPV6_IFACE_NODE
:
614 af
= ldp_vty_get_af(vty
);
615 iface
= VTY_GET_CONTEXT(iface
);
616 VTY_CHECK_CONTEXT(iface
);
618 ia
= iface_af_get(iface
, af
);
620 ia
->hello_interval
= 0;
622 ia
->hello_interval
= secs
;
624 ldp_config_apply(vty
, vty_conf
);
627 fatalx("ldp_vty_disc_interval: unexpected node");
630 return (CMD_SUCCESS
);
634 ldp_vty_targeted_hello_accept(struct vty
*vty
, const char *negate
,
635 const char *acl_from_str
)
637 struct ldpd_af_conf
*af_conf
;
640 af
= ldp_vty_get_af(vty
);
641 af_conf
= ldp_af_conf_get(vty_conf
, af
);
644 af_conf
->flags
&= ~F_LDPD_AF_THELLO_ACCEPT
;
645 af_conf
->acl_thello_accept_from
[0] = '\0';
647 af_conf
->flags
|= F_LDPD_AF_THELLO_ACCEPT
;
649 strlcpy(af_conf
->acl_thello_accept_from
, acl_from_str
,
650 sizeof(af_conf
->acl_thello_accept_from
));
652 af_conf
->acl_thello_accept_from
[0] = '\0';
655 ldp_config_apply(vty
, vty_conf
);
657 return (CMD_SUCCESS
);
661 ldp_vty_nbr_session_holdtime(struct vty
*vty
, const char *negate
,
662 struct in_addr lsr_id
, long secs
)
664 struct nbr_params
*nbrp
;
666 if (bad_addr_v4(lsr_id
)) {
667 vty_out (vty
, "%% Malformed address\n");
668 return (CMD_WARNING_CONFIG_FAILED
);
671 nbrp
= nbr_params_find(vty_conf
, lsr_id
);
675 return (CMD_SUCCESS
);
678 nbrp
->flags
&= ~F_NBRP_KEEPALIVE
;
681 nbrp
= nbr_params_new(lsr_id
);
682 RB_INSERT(nbrp_head
, &vty_conf
->nbrp_tree
, nbrp
);
683 QOBJ_REG(nbrp
, nbr_params
);
684 } else if (nbrp
->keepalive
== secs
)
685 return (CMD_SUCCESS
);
687 nbrp
->keepalive
= secs
;
688 nbrp
->flags
|= F_NBRP_KEEPALIVE
;
691 ldp_config_apply(vty
, vty_conf
);
693 return (CMD_SUCCESS
);
697 ldp_vty_af_session_holdtime(struct vty
*vty
, const char *negate
, long secs
)
699 struct ldpd_af_conf
*af_conf
;
702 af
= ldp_vty_get_af(vty
);
703 af_conf
= ldp_af_conf_get(vty_conf
, af
);
706 af_conf
->keepalive
= DEFAULT_KEEPALIVE
;
708 af_conf
->keepalive
= secs
;
710 ldp_config_apply(vty
, vty_conf
);
712 return (CMD_SUCCESS
);
716 ldp_vty_interface(struct vty
*vty
, const char *negate
, const char *ifname
)
722 if (ifname
== NULL
) {
723 vty_out (vty
, "%% Missing IF name\n");
724 return (CMD_WARNING_CONFIG_FAILED
);
727 af
= ldp_vty_get_af(vty
);
728 iface
= if_lookup_name(vty_conf
, ifname
);
732 return (CMD_SUCCESS
);
734 ia
= iface_af_get(iface
, af
);
735 if (ia
->enabled
== 0)
736 return (CMD_SUCCESS
);
739 ia
->hello_holdtime
= 0;
740 ia
->hello_interval
= 0;
742 ldp_config_apply(vty
, vty_conf
);
744 return (CMD_SUCCESS
);
748 if (ldp_iface_is_configured(vty_conf
, ifname
)) {
749 vty_out (vty
,"%% Interface is already in use\n");
750 return (CMD_SUCCESS
);
753 iface
= if_new(ifname
);
754 ia
= iface_af_get(iface
, af
);
756 RB_INSERT(iface_head
, &vty_conf
->iface_tree
, iface
);
757 QOBJ_REG(iface
, iface
);
759 ldp_config_apply(vty
, vty_conf
);
761 ia
= iface_af_get(iface
, af
);
764 ldp_config_apply(vty
, vty_conf
);
770 VTY_PUSH_CONTEXT(LDP_IPV4_IFACE_NODE
, iface
);
773 VTY_PUSH_CONTEXT(LDP_IPV6_IFACE_NODE
, iface
);
779 return (CMD_SUCCESS
);
783 ldp_vty_trans_addr(struct vty
*vty
, const char *negate
, const char *addr_str
)
785 struct ldpd_af_conf
*af_conf
;
788 af
= ldp_vty_get_af(vty
);
789 af_conf
= ldp_af_conf_get(vty_conf
, af
);
792 memset(&af_conf
->trans_addr
, 0, sizeof(af_conf
->trans_addr
));
795 || inet_pton(af
, addr_str
, &af_conf
->trans_addr
) != 1
796 || bad_addr(af
, &af_conf
->trans_addr
)) {
797 vty_out (vty
, "%% Malformed address\n");
798 return (CMD_SUCCESS
);
802 ldp_config_apply(vty
, vty_conf
);
804 return (CMD_SUCCESS
);
808 ldp_vty_neighbor_targeted(struct vty
*vty
, const char *negate
, const char *addr_str
)
811 union ldpd_addr addr
;
814 af
= ldp_vty_get_af(vty
);
816 if (addr_str
== NULL
|| inet_pton(af
, addr_str
, &addr
) != 1 ||
817 bad_addr(af
, &addr
)) {
818 vty_out (vty
, "%% Malformed address\n");
819 return (CMD_WARNING_CONFIG_FAILED
);
821 if (af
== AF_INET6
&& IN6_IS_SCOPE_EMBED(&addr
.v6
)) {
822 vty_out (vty
, "%% Address can not be link-local\n");
823 return (CMD_WARNING_CONFIG_FAILED
);
826 tnbr
= tnbr_find(vty_conf
, af
, &addr
);
830 return (CMD_SUCCESS
);
833 RB_REMOVE(tnbr_head
, &vty_conf
->tnbr_tree
, tnbr
);
836 ldp_config_apply(vty
, vty_conf
);
838 return (CMD_SUCCESS
);
842 return (CMD_SUCCESS
);
844 tnbr
= tnbr_new(af
, &addr
);
845 tnbr
->flags
|= F_TNBR_CONFIGURED
;
846 RB_INSERT(tnbr_head
, &vty_conf
->tnbr_tree
, tnbr
);
847 QOBJ_REG(tnbr
, tnbr
);
849 ldp_config_apply(vty
, vty_conf
);
851 return (CMD_SUCCESS
);
855 ldp_vty_label_advertise(struct vty
*vty
, const char *negate
, const char *acl_to_str
,
856 const char *acl_for_str
)
858 struct ldpd_af_conf
*af_conf
;
861 af
= ldp_vty_get_af(vty
);
862 af_conf
= ldp_af_conf_get(vty_conf
, af
);
865 af_conf
->acl_label_advertise_to
[0] = '\0';
866 af_conf
->acl_label_advertise_for
[0] = '\0';
869 strlcpy(af_conf
->acl_label_advertise_to
, acl_to_str
,
870 sizeof(af_conf
->acl_label_advertise_to
));
872 af_conf
->acl_label_advertise_to
[0] = '\0';
874 strlcpy(af_conf
->acl_label_advertise_for
, acl_for_str
,
875 sizeof(af_conf
->acl_label_advertise_for
));
877 af_conf
->acl_label_advertise_for
[0] = '\0';
880 ldp_config_apply(vty
, vty_conf
);
882 return (CMD_SUCCESS
);
886 ldp_vty_label_allocate(struct vty
*vty
, const char *negate
, const char *host_routes
,
887 const char *acl_for_str
)
889 struct ldpd_af_conf
*af_conf
;
892 af
= ldp_vty_get_af(vty
);
893 af_conf
= ldp_af_conf_get(vty_conf
, af
);
895 af_conf
->flags
&= ~F_LDPD_AF_ALLOCHOSTONLY
;
896 af_conf
->acl_label_allocate_for
[0] = '\0';
899 af_conf
->flags
|= F_LDPD_AF_ALLOCHOSTONLY
;
901 strlcpy(af_conf
->acl_label_allocate_for
, acl_for_str
,
902 sizeof(af_conf
->acl_label_allocate_for
));
905 ldp_config_apply(vty
, vty_conf
);
907 return (CMD_SUCCESS
);
911 ldp_vty_label_expnull(struct vty
*vty
, const char *negate
, const char *acl_for_str
)
913 struct ldpd_af_conf
*af_conf
;
916 af
= ldp_vty_get_af(vty
);
917 af_conf
= ldp_af_conf_get(vty_conf
, af
);
920 af_conf
->flags
&= ~F_LDPD_AF_EXPNULL
;
921 af_conf
->acl_label_expnull_for
[0] = '\0';
923 af_conf
->flags
|= F_LDPD_AF_EXPNULL
;
925 strlcpy(af_conf
->acl_label_expnull_for
, acl_for_str
,
926 sizeof(af_conf
->acl_label_expnull_for
));
928 af_conf
->acl_label_expnull_for
[0] = '\0';
931 ldp_config_apply(vty
, vty_conf
);
933 return (CMD_SUCCESS
);
937 ldp_vty_label_accept(struct vty
*vty
, const char *negate
, const char *acl_from_str
,
938 const char *acl_for_str
)
940 struct ldpd_af_conf
*af_conf
;
943 af
= ldp_vty_get_af(vty
);
944 af_conf
= ldp_af_conf_get(vty_conf
, af
);
947 af_conf
->acl_label_accept_from
[0] = '\0';
948 af_conf
->acl_label_accept_for
[0] = '\0';
951 strlcpy(af_conf
->acl_label_accept_from
, acl_from_str
,
952 sizeof(af_conf
->acl_label_accept_from
));
954 af_conf
->acl_label_accept_from
[0] = '\0';
956 strlcpy(af_conf
->acl_label_accept_for
, acl_for_str
,
957 sizeof(af_conf
->acl_label_accept_for
));
959 af_conf
->acl_label_accept_for
[0] = '\0';
962 ldp_config_apply(vty
, vty_conf
);
964 return (CMD_SUCCESS
);
968 ldp_vty_ttl_security(struct vty
*vty
, const char *negate
)
970 struct ldpd_af_conf
*af_conf
;
973 af
= ldp_vty_get_af(vty
);
974 af_conf
= ldp_af_conf_get(vty_conf
, af
);
977 af_conf
->flags
&= ~F_LDPD_AF_NO_GTSM
;
979 af_conf
->flags
|= F_LDPD_AF_NO_GTSM
;
981 ldp_config_apply(vty
, vty_conf
);
983 return (CMD_SUCCESS
);
987 ldp_vty_router_id(struct vty
*vty
, const char *negate
, struct in_addr address
)
990 vty_conf
->rtr_id
.s_addr
= INADDR_ANY
;
992 if (bad_addr_v4(address
)) {
993 vty_out (vty
, "%% Malformed address\n");
994 return (CMD_SUCCESS
);
996 vty_conf
->rtr_id
= address
;
999 ldp_config_apply(vty
, vty_conf
);
1001 return (CMD_SUCCESS
);
1005 ldp_vty_ordered_control(struct vty
*vty
, const char *negate
)
1008 vty_conf
->flags
&= ~F_LDPD_ORDERED_CONTROL
;
1010 vty_conf
->flags
|= F_LDPD_ORDERED_CONTROL
;
1012 ldp_config_apply(vty
, vty_conf
);
1014 return (CMD_SUCCESS
);
1018 ldp_vty_ds_cisco_interop(struct vty
*vty
, const char * negate
)
1021 vty_conf
->flags
&= ~F_LDPD_DS_CISCO_INTEROP
;
1023 vty_conf
->flags
|= F_LDPD_DS_CISCO_INTEROP
;
1025 ldp_config_apply(vty
, vty_conf
);
1027 return (CMD_SUCCESS
);
1031 ldp_vty_trans_pref_ipv4(struct vty
*vty
, const char *negate
)
1034 vty_conf
->trans_pref
= DUAL_STACK_LDPOV6
;
1036 vty_conf
->trans_pref
= DUAL_STACK_LDPOV4
;
1038 ldp_config_apply(vty
, vty_conf
);
1040 return (CMD_SUCCESS
);
1044 ldp_vty_neighbor_password(struct vty
*vty
, const char *negate
, struct in_addr lsr_id
,
1045 const char *password_str
)
1047 size_t password_len
;
1048 struct nbr_params
*nbrp
;
1050 if (password_str
== NULL
) {
1051 vty_out (vty
, "%% Missing password\n");
1052 return (CMD_WARNING_CONFIG_FAILED
);
1055 if (bad_addr_v4(lsr_id
)) {
1056 vty_out (vty
, "%% Malformed address\n");
1057 return (CMD_WARNING_CONFIG_FAILED
);
1060 nbrp
= nbr_params_find(vty_conf
, lsr_id
);
1064 return (CMD_SUCCESS
);
1066 memset(&nbrp
->auth
, 0, sizeof(nbrp
->auth
));
1067 nbrp
->auth
.method
= AUTH_NONE
;
1070 nbrp
= nbr_params_new(lsr_id
);
1071 RB_INSERT(nbrp_head
, &vty_conf
->nbrp_tree
, nbrp
);
1072 QOBJ_REG(nbrp
, nbr_params
);
1073 } else if (nbrp
->auth
.method
== AUTH_MD5SIG
&&
1074 strcmp(nbrp
->auth
.md5key
, password_str
) == 0)
1075 return (CMD_SUCCESS
);
1077 password_len
= strlcpy(nbrp
->auth
.md5key
, password_str
,
1078 sizeof(nbrp
->auth
.md5key
));
1079 if (password_len
>= sizeof(nbrp
->auth
.md5key
))
1080 vty_out(vty
, "%% password has been truncated to %zu characters.", sizeof(nbrp
->auth
.md5key
) - 1);
1081 nbrp
->auth
.md5key_len
= strlen(nbrp
->auth
.md5key
);
1082 nbrp
->auth
.method
= AUTH_MD5SIG
;
1085 ldp_config_apply(vty
, vty_conf
);
1087 return (CMD_SUCCESS
);
1091 ldp_vty_neighbor_ttl_security(struct vty
*vty
, const char *negate
,
1092 struct in_addr lsr_id
, const char *hops_str
)
1094 struct nbr_params
*nbrp
;
1098 if (bad_addr_v4(lsr_id
)) {
1099 vty_out (vty
, "%% Malformed address\n");
1100 return (CMD_WARNING_CONFIG_FAILED
);
1104 hops
= strtol(hops_str
, &ep
, 10);
1105 if (*ep
!= '\0' || hops
< 1 || hops
> 254) {
1106 vty_out (vty
, "%% Invalid hop count\n");
1107 return (CMD_SUCCESS
);
1111 nbrp
= nbr_params_find(vty_conf
, lsr_id
);
1115 return (CMD_SUCCESS
);
1117 nbrp
->flags
&= ~(F_NBRP_GTSM
|F_NBRP_GTSM_HOPS
);
1118 nbrp
->gtsm_enabled
= 0;
1119 nbrp
->gtsm_hops
= 0;
1122 nbrp
= nbr_params_new(lsr_id
);
1123 RB_INSERT(nbrp_head
, &vty_conf
->nbrp_tree
, nbrp
);
1124 QOBJ_REG(nbrp
, nbr_params
);
1127 nbrp
->flags
|= F_NBRP_GTSM
;
1128 nbrp
->flags
&= ~F_NBRP_GTSM_HOPS
;
1130 nbrp
->gtsm_enabled
= 1;
1131 nbrp
->gtsm_hops
= hops
;
1132 nbrp
->flags
|= F_NBRP_GTSM_HOPS
;
1134 nbrp
->gtsm_enabled
= 0;
1137 ldp_config_apply(vty
, vty_conf
);
1139 return (CMD_SUCCESS
);
1143 ldp_vty_l2vpn(struct vty
*vty
, const char *negate
, const char *name_str
)
1145 struct l2vpn
*l2vpn
;
1146 struct l2vpn_if
*lif
;
1147 struct l2vpn_pw
*pw
;
1149 if (name_str
== NULL
) {
1150 vty_out (vty
, "%% Missing name\n");
1151 return (CMD_WARNING_CONFIG_FAILED
);
1154 l2vpn
= l2vpn_find(vty_conf
, name_str
);
1158 return (CMD_SUCCESS
);
1160 RB_FOREACH(lif
, l2vpn_if_head
, &l2vpn
->if_tree
)
1162 RB_FOREACH(pw
, l2vpn_pw_head
, &l2vpn
->pw_tree
)
1164 RB_FOREACH(pw
, l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
)
1167 RB_REMOVE(l2vpn_head
, &vty_conf
->l2vpn_tree
, l2vpn
);
1170 ldp_config_apply(vty
, vty_conf
);
1172 return (CMD_SUCCESS
);
1176 VTY_PUSH_CONTEXT(LDP_L2VPN_NODE
, l2vpn
);
1177 return (CMD_SUCCESS
);
1180 l2vpn
= l2vpn_new(name_str
);
1181 l2vpn
->type
= L2VPN_TYPE_VPLS
;
1182 RB_INSERT(l2vpn_head
, &vty_conf
->l2vpn_tree
, l2vpn
);
1183 QOBJ_REG(l2vpn
, l2vpn
);
1185 VTY_PUSH_CONTEXT(LDP_L2VPN_NODE
, l2vpn
);
1187 ldp_config_apply(vty
, vty_conf
);
1189 return (CMD_SUCCESS
);
1193 ldp_vty_l2vpn_bridge(struct vty
*vty
, const char *negate
, const char *ifname
)
1195 VTY_DECLVAR_CONTEXT(l2vpn
, l2vpn
);
1198 memset(l2vpn
->br_ifname
, 0, sizeof(l2vpn
->br_ifname
));
1200 if (ifname
== NULL
) {
1201 vty_out (vty
, "%% Missing IF name\n");
1202 return (CMD_WARNING_CONFIG_FAILED
);
1204 strlcpy(l2vpn
->br_ifname
, ifname
, sizeof(l2vpn
->br_ifname
));
1207 ldp_config_apply(vty
, vty_conf
);
1209 return (CMD_SUCCESS
);
1213 ldp_vty_l2vpn_mtu(struct vty
*vty
, const char *negate
, long mtu
)
1215 VTY_DECLVAR_CONTEXT(l2vpn
, l2vpn
);
1218 l2vpn
->mtu
= DEFAULT_L2VPN_MTU
;
1222 ldp_config_apply(vty
, vty_conf
);
1224 return (CMD_SUCCESS
);
1228 ldp_vty_l2vpn_pwtype(struct vty
*vty
, const char *negate
, const char *type_str
)
1230 VTY_DECLVAR_CONTEXT(l2vpn
, l2vpn
);
1233 if (type_str
== NULL
) {
1234 vty_out (vty
, "%% Missing type\n");
1235 return (CMD_WARNING_CONFIG_FAILED
);
1238 if (strcmp(type_str
, "ethernet") == 0)
1239 pw_type
= PW_TYPE_ETHERNET
;
1241 pw_type
= PW_TYPE_ETHERNET_TAGGED
;
1244 l2vpn
->pw_type
= DEFAULT_PW_TYPE
;
1246 l2vpn
->pw_type
= pw_type
;
1248 ldp_config_apply(vty
, vty_conf
);
1250 return (CMD_SUCCESS
);
1254 ldp_vty_l2vpn_interface(struct vty
*vty
, const char *negate
, const char *ifname
)
1256 VTY_DECLVAR_CONTEXT(l2vpn
, l2vpn
);
1257 struct l2vpn_if
*lif
;
1259 if (ifname
== NULL
) {
1260 vty_out (vty
, "%% Missing IF name\n");
1261 return (CMD_WARNING_CONFIG_FAILED
);
1264 lif
= l2vpn_if_find(l2vpn
, ifname
);
1268 return (CMD_SUCCESS
);
1271 RB_REMOVE(l2vpn_if_head
, &l2vpn
->if_tree
, lif
);
1274 ldp_config_apply(vty
, vty_conf
);
1276 return (CMD_SUCCESS
);
1280 return (CMD_SUCCESS
);
1282 if (ldp_iface_is_configured(vty_conf
, ifname
)) {
1283 vty_out (vty
, "%% Interface is already in use\n");
1284 return (CMD_SUCCESS
);
1287 lif
= l2vpn_if_new(l2vpn
, ifname
);
1288 RB_INSERT(l2vpn_if_head
, &l2vpn
->if_tree
, lif
);
1289 QOBJ_REG(lif
, l2vpn_if
);
1291 ldp_config_apply(vty
, vty_conf
);
1293 return (CMD_SUCCESS
);
1297 ldp_vty_l2vpn_pseudowire(struct vty
*vty
, const char *negate
, const char *ifname
)
1299 VTY_DECLVAR_CONTEXT(l2vpn
, l2vpn
);
1300 struct l2vpn_pw
*pw
;
1302 if (ifname
== NULL
) {
1303 vty_out (vty
, "%% Missing IF name\n");
1304 return (CMD_WARNING_CONFIG_FAILED
);
1307 pw
= l2vpn_pw_find(l2vpn
, ifname
);
1311 return (CMD_SUCCESS
);
1314 if (pw
->lsr_id
.s_addr
== INADDR_ANY
|| pw
->pwid
== 0)
1315 RB_REMOVE(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
, pw
);
1317 RB_REMOVE(l2vpn_pw_head
, &l2vpn
->pw_tree
, pw
);
1320 ldp_config_apply(vty
, vty_conf
);
1322 return (CMD_SUCCESS
);
1326 VTY_PUSH_CONTEXT_SUB(LDP_PSEUDOWIRE_NODE
, pw
);
1327 return (CMD_SUCCESS
);
1330 if (ldp_iface_is_configured(vty_conf
, ifname
)) {
1331 vty_out (vty
, "%% Interface is already in use\n");
1332 return (CMD_SUCCESS
);
1335 pw
= l2vpn_pw_new(l2vpn
, ifname
);
1336 pw
->flags
= F_PW_STATUSTLV_CONF
|F_PW_CWORD_CONF
;
1337 RB_INSERT(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
, pw
);
1338 QOBJ_REG(pw
, l2vpn_pw
);
1340 VTY_PUSH_CONTEXT_SUB(LDP_PSEUDOWIRE_NODE
, pw
);
1342 ldp_config_apply(vty
, vty_conf
);
1344 return (CMD_SUCCESS
);
1348 ldp_vty_l2vpn_pw_cword(struct vty
*vty
, const char *negate
, const char *preference_str
)
1350 VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw
, pw
);
1353 pw
->flags
|= F_PW_CWORD_CONF
;
1355 if (!preference_str
) {
1356 vty_out (vty
, "%% Missing preference\n");
1357 return (CMD_WARNING_CONFIG_FAILED
);
1359 if (preference_str
[0] == 'e')
1360 pw
->flags
&= ~F_PW_CWORD_CONF
;
1362 pw
->flags
|= F_PW_CWORD_CONF
;
1365 ldp_config_apply(vty
, vty_conf
);
1367 return (CMD_SUCCESS
);
1371 ldp_vty_l2vpn_pw_nbr_addr(struct vty
*vty
, const char *negate
, const char *addr_str
)
1373 VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw
, pw
);
1375 union ldpd_addr addr
;
1377 if (ldp_get_address(addr_str
, &af
, &addr
) == -1 ||
1378 bad_addr(af
, &addr
)) {
1379 vty_out (vty
, "%% Malformed address\n");
1380 return (CMD_WARNING_CONFIG_FAILED
);
1385 memset(&pw
->addr
, 0, sizeof(pw
->addr
));
1386 pw
->flags
&= ~F_PW_STATIC_NBR_ADDR
;
1390 pw
->flags
|= F_PW_STATIC_NBR_ADDR
;
1393 ldp_config_apply(vty
, vty_conf
);
1395 return (CMD_SUCCESS
);
1399 ldp_vty_l2vpn_pw_nbr_id(struct vty
*vty
, const char *negate
, struct in_addr lsr_id
)
1401 VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw
, pw
);
1403 if (bad_addr_v4(lsr_id
)) {
1404 vty_out (vty
, "%% Malformed address\n");
1405 return (CMD_WARNING_CONFIG_FAILED
);
1409 pw
->lsr_id
.s_addr
= INADDR_ANY
;
1411 pw
->lsr_id
= lsr_id
;
1413 ldp_config_apply(vty
, vty_conf
);
1415 return (CMD_SUCCESS
);
1419 ldp_vty_l2vpn_pw_pwid(struct vty
*vty
, const char *negate
, long pwid
)
1421 VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw
, pw
);
1428 ldp_config_apply(vty
, vty_conf
);
1430 return (CMD_SUCCESS
);
1434 ldp_vty_l2vpn_pw_pwstatus(struct vty
*vty
, const char *negate
)
1436 VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw
, pw
);
1439 pw
->flags
|= F_PW_STATUSTLV_CONF
;
1441 pw
->flags
&= ~F_PW_STATUSTLV_CONF
;
1443 ldp_config_apply(vty
, vty_conf
);
1445 return (CMD_SUCCESS
);
1449 iface_new_api(struct ldpd_conf
*conf
, const char *name
)
1451 const char *ifname
= name
;
1452 struct iface
*iface
;
1454 if (ldp_iface_is_configured(conf
, ifname
))
1457 iface
= if_new(name
);
1458 RB_INSERT(iface_head
, &conf
->iface_tree
, iface
);
1459 QOBJ_REG(iface
, iface
);
1464 iface_del_api(struct ldpd_conf
*conf
, struct iface
*iface
)
1467 RB_REMOVE(iface_head
, &conf
->iface_tree
, iface
);
1472 tnbr_new_api(struct ldpd_conf
*conf
, int af
, union ldpd_addr
*addr
)
1476 if (af
== AF_INET6
&& IN6_IS_SCOPE_EMBED(&addr
->v6
))
1479 if (tnbr_find(conf
, af
, addr
))
1482 tnbr
= tnbr_new(af
, addr
);
1483 tnbr
->flags
|= F_TNBR_CONFIGURED
;
1484 RB_INSERT(tnbr_head
, &conf
->tnbr_tree
, tnbr
);
1485 QOBJ_REG(tnbr
, tnbr
);
1490 tnbr_del_api(struct ldpd_conf
*conf
, struct tnbr
*tnbr
)
1493 RB_REMOVE(tnbr_head
, &conf
->tnbr_tree
, tnbr
);
1498 nbrp_new_api(struct ldpd_conf
*conf
, struct in_addr lsr_id
)
1500 struct nbr_params
*nbrp
;
1502 if (nbr_params_find(conf
, lsr_id
))
1505 nbrp
= nbr_params_new(lsr_id
);
1506 RB_INSERT(nbrp_head
, &conf
->nbrp_tree
, nbrp
);
1507 QOBJ_REG(nbrp
, nbr_params
);
1512 nbrp_del_api(struct ldpd_conf
*conf
, struct nbr_params
*nbrp
)
1515 RB_REMOVE(nbrp_head
, &conf
->nbrp_tree
, nbrp
);
1520 l2vpn_new_api(struct ldpd_conf
*conf
, const char *name
)
1522 struct l2vpn
*l2vpn
;
1524 if (l2vpn_find(conf
, name
))
1527 l2vpn
= l2vpn_new(name
);
1528 l2vpn
->type
= L2VPN_TYPE_VPLS
;
1529 RB_INSERT(l2vpn_head
, &conf
->l2vpn_tree
, l2vpn
);
1530 QOBJ_REG(l2vpn
, l2vpn
);
1535 l2vpn_del_api(struct ldpd_conf
*conf
, struct l2vpn
*l2vpn
)
1537 struct l2vpn_if
*lif
;
1538 struct l2vpn_pw
*pw
;
1540 while (!RB_EMPTY(l2vpn_if_head
, &l2vpn
->if_tree
)) {
1541 lif
= RB_ROOT(l2vpn_if_head
, &l2vpn
->if_tree
);
1544 RB_REMOVE(l2vpn_if_head
, &l2vpn
->if_tree
, lif
);
1547 while (!RB_EMPTY(l2vpn_pw_head
, &l2vpn
->pw_tree
)) {
1548 pw
= RB_ROOT(l2vpn_pw_head
, &l2vpn
->pw_tree
);
1551 RB_REMOVE(l2vpn_pw_head
, &l2vpn
->pw_tree
, pw
);
1554 while (!RB_EMPTY(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
)) {
1555 pw
= RB_ROOT(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
);
1558 RB_REMOVE(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
, pw
);
1562 RB_REMOVE(l2vpn_head
, &conf
->l2vpn_tree
, l2vpn
);
1567 l2vpn_if_new_api(struct ldpd_conf
*conf
, struct l2vpn
*l2vpn
,
1570 struct l2vpn_if
*lif
;
1572 if (ldp_iface_is_configured(conf
, ifname
))
1575 lif
= l2vpn_if_new(l2vpn
, ifname
);
1576 RB_INSERT(l2vpn_if_head
, &l2vpn
->if_tree
, lif
);
1577 QOBJ_REG(lif
, l2vpn_if
);
1582 l2vpn_if_del_api(struct l2vpn
*l2vpn
, struct l2vpn_if
*lif
)
1585 RB_REMOVE(l2vpn_if_head
, &l2vpn
->if_tree
, lif
);
1590 l2vpn_pw_new_api(struct ldpd_conf
*conf
, struct l2vpn
*l2vpn
,
1593 struct l2vpn_pw
*pw
;
1595 if (ldp_iface_is_configured(conf
, ifname
))
1598 pw
= l2vpn_pw_new(l2vpn
, ifname
);
1599 pw
->flags
= F_PW_STATUSTLV_CONF
|F_PW_CWORD_CONF
;
1600 RB_INSERT(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
, pw
);
1601 QOBJ_REG(pw
, l2vpn_pw
);
1606 l2vpn_pw_del_api(struct l2vpn
*l2vpn
, struct l2vpn_pw
*pw
)
1609 RB_REMOVE(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
, pw
);