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 "
296 "%u\n", inet_ntoa(nbrp
->lsr_id
),
299 vty_out (vty
, " neighbor %s ttl-security "
300 "disable\n",inet_ntoa(nbrp
->lsr_id
));
303 if (nbrp
->auth
.method
== AUTH_MD5SIG
)
304 vty_out (vty
, " neighbor %s password %s\n",
305 inet_ntoa(nbrp
->lsr_id
),nbrp
->auth
.md5key
);
308 ldp_af_config_write(vty
, AF_INET
, ldpd_conf
, &ldpd_conf
->ipv4
);
309 ldp_af_config_write(vty
, AF_INET6
, ldpd_conf
, &ldpd_conf
->ipv6
);
310 vty_out (vty
, " !\n");
311 vty_out (vty
, "!\n");
317 ldp_l2vpn_pw_config_write(struct vty
*vty
, struct l2vpn_pw
*pw
)
319 int missing_lsrid
= 0;
320 int missing_pwid
= 0;
322 vty_out (vty
, " !\n");
323 vty_out (vty
, " member pseudowire %s\n", pw
->ifname
);
325 if (pw
->lsr_id
.s_addr
!= INADDR_ANY
)
326 vty_out (vty
, " neighbor lsr-id %s\n",inet_ntoa(pw
->lsr_id
));
330 if (pw
->flags
& F_PW_STATIC_NBR_ADDR
)
331 vty_out (vty
, " neighbor address %s\n",
332 log_addr(pw
->af
, &pw
->addr
));
335 vty_out (vty
, " pw-id %u\n", pw
->pwid
);
339 if (!(pw
->flags
& F_PW_CWORD_CONF
))
340 vty_out (vty
, " control-word exclude\n");
342 if (!(pw
->flags
& F_PW_STATUSTLV_CONF
))
343 vty_out (vty
, " pw-status disable\n");
347 " ! Incomplete config, specify a neighbor lsr-id\n");
349 vty_out (vty
," ! Incomplete config, specify a pw-id\n");
353 ldp_l2vpn_config_write(struct vty
*vty
)
356 struct l2vpn_if
*lif
;
359 RB_FOREACH(l2vpn
, l2vpn_head
, &ldpd_conf
->l2vpn_tree
) {
360 vty_out (vty
, "l2vpn %s type vpls\n", l2vpn
->name
);
362 if (l2vpn
->pw_type
!= DEFAULT_PW_TYPE
)
363 vty_out (vty
, " vc type ethernet-tagged\n");
365 if (l2vpn
->mtu
!= DEFAULT_L2VPN_MTU
)
366 vty_out (vty
, " mtu %u\n", l2vpn
->mtu
);
368 if (l2vpn
->br_ifname
[0] != '\0')
369 vty_out (vty
, " bridge %s\n",l2vpn
->br_ifname
);
371 RB_FOREACH(lif
, l2vpn_if_head
, &l2vpn
->if_tree
)
372 vty_out (vty
, " member interface %s\n",lif
->ifname
);
374 RB_FOREACH(pw
, l2vpn_pw_head
, &l2vpn
->pw_tree
)
375 ldp_l2vpn_pw_config_write(vty
, pw
);
376 RB_FOREACH(pw
, l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
)
377 ldp_l2vpn_pw_config_write(vty
, pw
);
379 vty_out (vty
, " !\n");
380 vty_out (vty
, "!\n");
387 ldp_vty_get_af(struct vty
*vty
)
391 case LDP_IPV4_IFACE_NODE
:
394 case LDP_IPV6_IFACE_NODE
:
397 fatalx("ldp_vty_get_af: unexpected node");
402 ldp_iface_is_configured(struct ldpd_conf
*xconf
, const char *ifname
)
406 if (if_lookup_name(xconf
, ifname
))
409 RB_FOREACH(l2vpn
, l2vpn_head
, &xconf
->l2vpn_tree
) {
410 if (l2vpn_if_find(l2vpn
, ifname
))
412 if (l2vpn_pw_find(l2vpn
, ifname
))
420 ldp_vty_mpls_ldp(struct vty
*vty
, const char *negate
)
423 vty_conf
->flags
&= ~F_LDPD_ENABLED
;
425 vty
->node
= LDP_NODE
;
426 vty_conf
->flags
|= F_LDPD_ENABLED
;
429 ldp_config_apply(vty
, vty_conf
);
431 return (CMD_SUCCESS
);
435 ldp_vty_address_family(struct vty
*vty
, const char *negate
, const char *af_str
)
437 struct ldpd_af_conf
*af_conf
;
441 return (CMD_WARNING_CONFIG_FAILED
);
443 if (strcmp(af_str
, "ipv4") == 0) {
445 af_conf
= &vty_conf
->ipv4
;
446 } else if (strcmp(af_str
, "ipv6") == 0) {
448 af_conf
= &vty_conf
->ipv6
;
450 return (CMD_WARNING_CONFIG_FAILED
);
453 af_conf
->flags
&= ~F_LDPD_AF_ENABLED
;
454 ldp_config_apply(vty
, vty_conf
);
455 return (CMD_SUCCESS
);
460 vty
->node
= LDP_IPV4_NODE
;
463 vty
->node
= LDP_IPV6_NODE
;
466 fatalx("ldp_vty_address_family: unknown af");
468 af_conf
->flags
|= F_LDPD_AF_ENABLED
;
470 ldp_config_apply(vty
, vty_conf
);
472 return (CMD_SUCCESS
);
475 int ldp_vty_disc_holdtime(struct vty
*vty
, const char *negate
,
476 enum hello_type hello_type
, long secs
)
478 struct ldpd_af_conf
*af_conf
;
486 switch (hello_type
) {
488 vty_conf
->lhello_holdtime
= LINK_DFLT_HOLDTIME
;
491 vty_conf
->thello_holdtime
=
492 TARGETED_DFLT_HOLDTIME
;
496 switch (hello_type
) {
498 vty_conf
->lhello_holdtime
= secs
;
501 vty_conf
->thello_holdtime
= secs
;
505 ldp_config_apply(vty
, vty_conf
);
509 af
= ldp_vty_get_af(vty
);
510 af_conf
= ldp_af_conf_get(vty_conf
, af
);
513 switch (hello_type
) {
515 af_conf
->lhello_holdtime
= 0;
518 af_conf
->thello_holdtime
= 0;
522 switch (hello_type
) {
524 af_conf
->lhello_holdtime
= secs
;
527 af_conf
->thello_holdtime
= secs
;
531 ldp_config_apply(vty
, vty_conf
);
533 case LDP_IPV4_IFACE_NODE
:
534 case LDP_IPV6_IFACE_NODE
:
535 af
= ldp_vty_get_af(vty
);
536 iface
= VTY_GET_CONTEXT(iface
);
537 VTY_CHECK_CONTEXT(iface
);
539 ia
= iface_af_get(iface
, af
);
541 ia
->hello_holdtime
= 0;
543 ia
->hello_holdtime
= secs
;
545 ldp_config_apply(vty
, vty_conf
);
548 fatalx("ldp_vty_disc_holdtime: unexpected node");
551 return (CMD_SUCCESS
);
555 ldp_vty_disc_interval(struct vty
*vty
, const char *negate
,
556 enum hello_type hello_type
, long secs
)
558 struct ldpd_af_conf
*af_conf
;
566 switch (hello_type
) {
568 vty_conf
->lhello_interval
=
569 DEFAULT_HELLO_INTERVAL
;
572 vty_conf
->thello_interval
=
573 DEFAULT_HELLO_INTERVAL
;
577 switch (hello_type
) {
579 vty_conf
->lhello_interval
= secs
;
582 vty_conf
->thello_interval
= secs
;
586 ldp_config_apply(vty
, vty_conf
);
590 af
= ldp_vty_get_af(vty
);
591 af_conf
= ldp_af_conf_get(vty_conf
, af
);
594 switch (hello_type
) {
596 af_conf
->lhello_interval
= 0;
599 af_conf
->thello_interval
= 0;
603 switch (hello_type
) {
605 af_conf
->lhello_interval
= secs
;
608 af_conf
->thello_interval
= secs
;
612 ldp_config_apply(vty
, vty_conf
);
614 case LDP_IPV4_IFACE_NODE
:
615 case LDP_IPV6_IFACE_NODE
:
616 af
= ldp_vty_get_af(vty
);
617 iface
= VTY_GET_CONTEXT(iface
);
618 VTY_CHECK_CONTEXT(iface
);
620 ia
= iface_af_get(iface
, af
);
622 ia
->hello_interval
= 0;
624 ia
->hello_interval
= secs
;
626 ldp_config_apply(vty
, vty_conf
);
629 fatalx("ldp_vty_disc_interval: unexpected node");
632 return (CMD_SUCCESS
);
636 ldp_vty_targeted_hello_accept(struct vty
*vty
, const char *negate
,
637 const char *acl_from_str
)
639 struct ldpd_af_conf
*af_conf
;
642 af
= ldp_vty_get_af(vty
);
643 af_conf
= ldp_af_conf_get(vty_conf
, af
);
646 af_conf
->flags
&= ~F_LDPD_AF_THELLO_ACCEPT
;
647 af_conf
->acl_thello_accept_from
[0] = '\0';
649 af_conf
->flags
|= F_LDPD_AF_THELLO_ACCEPT
;
651 strlcpy(af_conf
->acl_thello_accept_from
, acl_from_str
,
652 sizeof(af_conf
->acl_thello_accept_from
));
654 af_conf
->acl_thello_accept_from
[0] = '\0';
657 ldp_config_apply(vty
, vty_conf
);
659 return (CMD_SUCCESS
);
663 ldp_vty_nbr_session_holdtime(struct vty
*vty
, const char *negate
,
664 struct in_addr lsr_id
, long secs
)
666 struct nbr_params
*nbrp
;
668 if (bad_addr_v4(lsr_id
)) {
669 vty_out (vty
, "%% Malformed address\n");
670 return (CMD_WARNING_CONFIG_FAILED
);
673 nbrp
= nbr_params_find(vty_conf
, lsr_id
);
677 return (CMD_SUCCESS
);
680 nbrp
->flags
&= ~F_NBRP_KEEPALIVE
;
683 nbrp
= nbr_params_new(lsr_id
);
684 RB_INSERT(nbrp_head
, &vty_conf
->nbrp_tree
, nbrp
);
685 QOBJ_REG(nbrp
, nbr_params
);
686 } else if (nbrp
->keepalive
== secs
)
687 return (CMD_SUCCESS
);
689 nbrp
->keepalive
= secs
;
690 nbrp
->flags
|= F_NBRP_KEEPALIVE
;
693 ldp_config_apply(vty
, vty_conf
);
695 return (CMD_SUCCESS
);
699 ldp_vty_af_session_holdtime(struct vty
*vty
, const char *negate
, long secs
)
701 struct ldpd_af_conf
*af_conf
;
704 af
= ldp_vty_get_af(vty
);
705 af_conf
= ldp_af_conf_get(vty_conf
, af
);
708 af_conf
->keepalive
= DEFAULT_KEEPALIVE
;
710 af_conf
->keepalive
= secs
;
712 ldp_config_apply(vty
, vty_conf
);
714 return (CMD_SUCCESS
);
718 ldp_vty_interface(struct vty
*vty
, const char *negate
, const char *ifname
)
724 if (ifname
== NULL
) {
725 vty_out (vty
, "%% Missing IF name\n");
726 return (CMD_WARNING_CONFIG_FAILED
);
729 af
= ldp_vty_get_af(vty
);
730 iface
= if_lookup_name(vty_conf
, ifname
);
734 return (CMD_SUCCESS
);
736 ia
= iface_af_get(iface
, af
);
737 if (ia
->enabled
== 0)
738 return (CMD_SUCCESS
);
741 ia
->hello_holdtime
= 0;
742 ia
->hello_interval
= 0;
744 ldp_config_apply(vty
, vty_conf
);
746 return (CMD_SUCCESS
);
750 if (ldp_iface_is_configured(vty_conf
, ifname
)) {
751 vty_out (vty
,"%% Interface is already in use\n");
752 return (CMD_SUCCESS
);
755 iface
= if_new(ifname
);
756 ia
= iface_af_get(iface
, af
);
758 RB_INSERT(iface_head
, &vty_conf
->iface_tree
, iface
);
759 QOBJ_REG(iface
, iface
);
761 ldp_config_apply(vty
, vty_conf
);
763 ia
= iface_af_get(iface
, af
);
766 ldp_config_apply(vty
, vty_conf
);
772 VTY_PUSH_CONTEXT(LDP_IPV4_IFACE_NODE
, iface
);
775 VTY_PUSH_CONTEXT(LDP_IPV6_IFACE_NODE
, iface
);
781 return (CMD_SUCCESS
);
785 ldp_vty_trans_addr(struct vty
*vty
, const char *negate
, const char *addr_str
)
787 struct ldpd_af_conf
*af_conf
;
790 af
= ldp_vty_get_af(vty
);
791 af_conf
= ldp_af_conf_get(vty_conf
, af
);
794 memset(&af_conf
->trans_addr
, 0, sizeof(af_conf
->trans_addr
));
797 || inet_pton(af
, addr_str
, &af_conf
->trans_addr
) != 1
798 || bad_addr(af
, &af_conf
->trans_addr
)) {
799 vty_out (vty
, "%% Malformed address\n");
800 return (CMD_SUCCESS
);
804 ldp_config_apply(vty
, vty_conf
);
806 return (CMD_SUCCESS
);
810 ldp_vty_neighbor_targeted(struct vty
*vty
, const char *negate
, const char *addr_str
)
813 union ldpd_addr addr
;
816 af
= ldp_vty_get_af(vty
);
818 if (addr_str
== NULL
|| inet_pton(af
, addr_str
, &addr
) != 1 ||
819 bad_addr(af
, &addr
)) {
820 vty_out (vty
, "%% Malformed address\n");
821 return (CMD_WARNING_CONFIG_FAILED
);
823 if (af
== AF_INET6
&& IN6_IS_SCOPE_EMBED(&addr
.v6
)) {
824 vty_out (vty
, "%% Address can not be link-local\n");
825 return (CMD_WARNING_CONFIG_FAILED
);
828 tnbr
= tnbr_find(vty_conf
, af
, &addr
);
832 return (CMD_SUCCESS
);
835 RB_REMOVE(tnbr_head
, &vty_conf
->tnbr_tree
, tnbr
);
838 ldp_config_apply(vty
, vty_conf
);
840 return (CMD_SUCCESS
);
844 return (CMD_SUCCESS
);
846 tnbr
= tnbr_new(af
, &addr
);
847 tnbr
->flags
|= F_TNBR_CONFIGURED
;
848 RB_INSERT(tnbr_head
, &vty_conf
->tnbr_tree
, tnbr
);
849 QOBJ_REG(tnbr
, tnbr
);
851 ldp_config_apply(vty
, vty_conf
);
853 return (CMD_SUCCESS
);
857 ldp_vty_label_advertise(struct vty
*vty
, const char *negate
, const char *acl_to_str
,
858 const char *acl_for_str
)
860 struct ldpd_af_conf
*af_conf
;
863 af
= ldp_vty_get_af(vty
);
864 af_conf
= ldp_af_conf_get(vty_conf
, af
);
867 af_conf
->acl_label_advertise_to
[0] = '\0';
868 af_conf
->acl_label_advertise_for
[0] = '\0';
871 strlcpy(af_conf
->acl_label_advertise_to
, acl_to_str
,
872 sizeof(af_conf
->acl_label_advertise_to
));
874 af_conf
->acl_label_advertise_to
[0] = '\0';
876 strlcpy(af_conf
->acl_label_advertise_for
, acl_for_str
,
877 sizeof(af_conf
->acl_label_advertise_for
));
879 af_conf
->acl_label_advertise_for
[0] = '\0';
882 ldp_config_apply(vty
, vty_conf
);
884 return (CMD_SUCCESS
);
888 ldp_vty_label_allocate(struct vty
*vty
, const char *negate
, const char *host_routes
,
889 const char *acl_for_str
)
891 struct ldpd_af_conf
*af_conf
;
894 af
= ldp_vty_get_af(vty
);
895 af_conf
= ldp_af_conf_get(vty_conf
, af
);
897 af_conf
->flags
&= ~F_LDPD_AF_ALLOCHOSTONLY
;
898 af_conf
->acl_label_allocate_for
[0] = '\0';
901 af_conf
->flags
|= F_LDPD_AF_ALLOCHOSTONLY
;
903 strlcpy(af_conf
->acl_label_allocate_for
, acl_for_str
,
904 sizeof(af_conf
->acl_label_allocate_for
));
907 ldp_config_apply(vty
, vty_conf
);
909 return (CMD_SUCCESS
);
913 ldp_vty_label_expnull(struct vty
*vty
, const char *negate
, const char *acl_for_str
)
915 struct ldpd_af_conf
*af_conf
;
918 af
= ldp_vty_get_af(vty
);
919 af_conf
= ldp_af_conf_get(vty_conf
, af
);
922 af_conf
->flags
&= ~F_LDPD_AF_EXPNULL
;
923 af_conf
->acl_label_expnull_for
[0] = '\0';
925 af_conf
->flags
|= F_LDPD_AF_EXPNULL
;
927 strlcpy(af_conf
->acl_label_expnull_for
, acl_for_str
,
928 sizeof(af_conf
->acl_label_expnull_for
));
930 af_conf
->acl_label_expnull_for
[0] = '\0';
933 ldp_config_apply(vty
, vty_conf
);
935 return (CMD_SUCCESS
);
939 ldp_vty_label_accept(struct vty
*vty
, const char *negate
, const char *acl_from_str
,
940 const char *acl_for_str
)
942 struct ldpd_af_conf
*af_conf
;
945 af
= ldp_vty_get_af(vty
);
946 af_conf
= ldp_af_conf_get(vty_conf
, af
);
949 af_conf
->acl_label_accept_from
[0] = '\0';
950 af_conf
->acl_label_accept_for
[0] = '\0';
953 strlcpy(af_conf
->acl_label_accept_from
, acl_from_str
,
954 sizeof(af_conf
->acl_label_accept_from
));
956 af_conf
->acl_label_accept_from
[0] = '\0';
958 strlcpy(af_conf
->acl_label_accept_for
, acl_for_str
,
959 sizeof(af_conf
->acl_label_accept_for
));
961 af_conf
->acl_label_accept_for
[0] = '\0';
964 ldp_config_apply(vty
, vty_conf
);
966 return (CMD_SUCCESS
);
970 ldp_vty_ttl_security(struct vty
*vty
, const char *negate
)
972 struct ldpd_af_conf
*af_conf
;
975 af
= ldp_vty_get_af(vty
);
976 af_conf
= ldp_af_conf_get(vty_conf
, af
);
979 af_conf
->flags
&= ~F_LDPD_AF_NO_GTSM
;
981 af_conf
->flags
|= F_LDPD_AF_NO_GTSM
;
983 ldp_config_apply(vty
, vty_conf
);
985 return (CMD_SUCCESS
);
989 ldp_vty_router_id(struct vty
*vty
, const char *negate
, struct in_addr address
)
992 vty_conf
->rtr_id
.s_addr
= INADDR_ANY
;
994 if (bad_addr_v4(address
)) {
995 vty_out (vty
, "%% Malformed address\n");
996 return (CMD_SUCCESS
);
998 vty_conf
->rtr_id
= address
;
1001 ldp_config_apply(vty
, vty_conf
);
1003 return (CMD_SUCCESS
);
1007 ldp_vty_ordered_control(struct vty
*vty
, const char *negate
)
1010 vty_conf
->flags
&= ~F_LDPD_ORDERED_CONTROL
;
1012 vty_conf
->flags
|= F_LDPD_ORDERED_CONTROL
;
1014 ldp_config_apply(vty
, vty_conf
);
1016 return (CMD_SUCCESS
);
1020 ldp_vty_ds_cisco_interop(struct vty
*vty
, const char * negate
)
1023 vty_conf
->flags
&= ~F_LDPD_DS_CISCO_INTEROP
;
1025 vty_conf
->flags
|= F_LDPD_DS_CISCO_INTEROP
;
1027 ldp_config_apply(vty
, vty_conf
);
1029 return (CMD_SUCCESS
);
1033 ldp_vty_trans_pref_ipv4(struct vty
*vty
, const char *negate
)
1036 vty_conf
->trans_pref
= DUAL_STACK_LDPOV6
;
1038 vty_conf
->trans_pref
= DUAL_STACK_LDPOV4
;
1040 ldp_config_apply(vty
, vty_conf
);
1042 return (CMD_SUCCESS
);
1046 ldp_vty_neighbor_password(struct vty
*vty
, const char *negate
, struct in_addr lsr_id
,
1047 const char *password_str
)
1049 size_t password_len
;
1050 struct nbr_params
*nbrp
;
1052 if (password_str
== NULL
) {
1053 vty_out (vty
, "%% Missing password\n");
1054 return (CMD_WARNING_CONFIG_FAILED
);
1057 if (bad_addr_v4(lsr_id
)) {
1058 vty_out (vty
, "%% Malformed address\n");
1059 return (CMD_WARNING_CONFIG_FAILED
);
1062 nbrp
= nbr_params_find(vty_conf
, lsr_id
);
1066 return (CMD_SUCCESS
);
1068 memset(&nbrp
->auth
, 0, sizeof(nbrp
->auth
));
1069 nbrp
->auth
.method
= AUTH_NONE
;
1072 nbrp
= nbr_params_new(lsr_id
);
1073 RB_INSERT(nbrp_head
, &vty_conf
->nbrp_tree
, nbrp
);
1074 QOBJ_REG(nbrp
, nbr_params
);
1075 } else if (nbrp
->auth
.method
== AUTH_MD5SIG
&&
1076 strcmp(nbrp
->auth
.md5key
, password_str
) == 0)
1077 return (CMD_SUCCESS
);
1079 password_len
= strlcpy(nbrp
->auth
.md5key
, password_str
,
1080 sizeof(nbrp
->auth
.md5key
));
1081 if (password_len
>= sizeof(nbrp
->auth
.md5key
))
1082 vty_out(vty
, "%% password has been truncated to %zu "
1083 "characters.", sizeof(nbrp
->auth
.md5key
) - 1);
1084 nbrp
->auth
.md5key_len
= strlen(nbrp
->auth
.md5key
);
1085 nbrp
->auth
.method
= AUTH_MD5SIG
;
1088 ldp_config_apply(vty
, vty_conf
);
1090 return (CMD_SUCCESS
);
1094 ldp_vty_neighbor_ttl_security(struct vty
*vty
, const char *negate
,
1095 struct in_addr lsr_id
, const char *hops_str
)
1097 struct nbr_params
*nbrp
;
1101 if (bad_addr_v4(lsr_id
)) {
1102 vty_out (vty
, "%% Malformed address\n");
1103 return (CMD_WARNING_CONFIG_FAILED
);
1107 hops
= strtol(hops_str
, &ep
, 10);
1108 if (*ep
!= '\0' || hops
< 1 || hops
> 254) {
1109 vty_out (vty
, "%% Invalid hop count\n");
1110 return (CMD_SUCCESS
);
1114 nbrp
= nbr_params_find(vty_conf
, lsr_id
);
1118 return (CMD_SUCCESS
);
1120 nbrp
->flags
&= ~(F_NBRP_GTSM
|F_NBRP_GTSM_HOPS
);
1121 nbrp
->gtsm_enabled
= 0;
1122 nbrp
->gtsm_hops
= 0;
1125 nbrp
= nbr_params_new(lsr_id
);
1126 RB_INSERT(nbrp_head
, &vty_conf
->nbrp_tree
, nbrp
);
1127 QOBJ_REG(nbrp
, nbr_params
);
1130 nbrp
->flags
|= F_NBRP_GTSM
;
1131 nbrp
->flags
&= ~F_NBRP_GTSM_HOPS
;
1133 nbrp
->gtsm_enabled
= 1;
1134 nbrp
->gtsm_hops
= hops
;
1135 nbrp
->flags
|= F_NBRP_GTSM_HOPS
;
1137 nbrp
->gtsm_enabled
= 0;
1140 ldp_config_apply(vty
, vty_conf
);
1142 return (CMD_SUCCESS
);
1146 ldp_vty_l2vpn(struct vty
*vty
, const char *negate
, const char *name_str
)
1148 struct l2vpn
*l2vpn
;
1149 struct l2vpn_if
*lif
;
1150 struct l2vpn_pw
*pw
;
1152 if (name_str
== NULL
) {
1153 vty_out (vty
, "%% Missing name\n");
1154 return (CMD_WARNING_CONFIG_FAILED
);
1157 l2vpn
= l2vpn_find(vty_conf
, name_str
);
1161 return (CMD_SUCCESS
);
1163 RB_FOREACH(lif
, l2vpn_if_head
, &l2vpn
->if_tree
)
1165 RB_FOREACH(pw
, l2vpn_pw_head
, &l2vpn
->pw_tree
)
1167 RB_FOREACH(pw
, l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
)
1170 RB_REMOVE(l2vpn_head
, &vty_conf
->l2vpn_tree
, l2vpn
);
1173 ldp_config_apply(vty
, vty_conf
);
1175 return (CMD_SUCCESS
);
1179 VTY_PUSH_CONTEXT(LDP_L2VPN_NODE
, l2vpn
);
1180 return (CMD_SUCCESS
);
1183 l2vpn
= l2vpn_new(name_str
);
1184 l2vpn
->type
= L2VPN_TYPE_VPLS
;
1185 RB_INSERT(l2vpn_head
, &vty_conf
->l2vpn_tree
, l2vpn
);
1186 QOBJ_REG(l2vpn
, l2vpn
);
1188 VTY_PUSH_CONTEXT(LDP_L2VPN_NODE
, l2vpn
);
1190 ldp_config_apply(vty
, vty_conf
);
1192 return (CMD_SUCCESS
);
1196 ldp_vty_l2vpn_bridge(struct vty
*vty
, const char *negate
, const char *ifname
)
1198 VTY_DECLVAR_CONTEXT(l2vpn
, l2vpn
);
1201 memset(l2vpn
->br_ifname
, 0, sizeof(l2vpn
->br_ifname
));
1203 if (ifname
== NULL
) {
1204 vty_out (vty
, "%% Missing IF name\n");
1205 return (CMD_WARNING_CONFIG_FAILED
);
1207 strlcpy(l2vpn
->br_ifname
, ifname
, sizeof(l2vpn
->br_ifname
));
1210 ldp_config_apply(vty
, vty_conf
);
1212 return (CMD_SUCCESS
);
1216 ldp_vty_l2vpn_mtu(struct vty
*vty
, const char *negate
, long mtu
)
1218 VTY_DECLVAR_CONTEXT(l2vpn
, l2vpn
);
1221 l2vpn
->mtu
= DEFAULT_L2VPN_MTU
;
1225 ldp_config_apply(vty
, vty_conf
);
1227 return (CMD_SUCCESS
);
1231 ldp_vty_l2vpn_pwtype(struct vty
*vty
, const char *negate
, const char *type_str
)
1233 VTY_DECLVAR_CONTEXT(l2vpn
, l2vpn
);
1236 if (type_str
== NULL
) {
1237 vty_out (vty
, "%% Missing type\n");
1238 return (CMD_WARNING_CONFIG_FAILED
);
1241 if (strcmp(type_str
, "ethernet") == 0)
1242 pw_type
= PW_TYPE_ETHERNET
;
1244 pw_type
= PW_TYPE_ETHERNET_TAGGED
;
1247 l2vpn
->pw_type
= DEFAULT_PW_TYPE
;
1249 l2vpn
->pw_type
= pw_type
;
1251 ldp_config_apply(vty
, vty_conf
);
1253 return (CMD_SUCCESS
);
1257 ldp_vty_l2vpn_interface(struct vty
*vty
, const char *negate
, const char *ifname
)
1259 VTY_DECLVAR_CONTEXT(l2vpn
, l2vpn
);
1260 struct l2vpn_if
*lif
;
1262 if (ifname
== NULL
) {
1263 vty_out (vty
, "%% Missing IF name\n");
1264 return (CMD_WARNING_CONFIG_FAILED
);
1267 lif
= l2vpn_if_find(l2vpn
, ifname
);
1271 return (CMD_SUCCESS
);
1274 RB_REMOVE(l2vpn_if_head
, &l2vpn
->if_tree
, lif
);
1277 ldp_config_apply(vty
, vty_conf
);
1279 return (CMD_SUCCESS
);
1283 return (CMD_SUCCESS
);
1285 if (ldp_iface_is_configured(vty_conf
, ifname
)) {
1286 vty_out (vty
, "%% Interface is already in use\n");
1287 return (CMD_SUCCESS
);
1290 lif
= l2vpn_if_new(l2vpn
, ifname
);
1291 RB_INSERT(l2vpn_if_head
, &l2vpn
->if_tree
, lif
);
1292 QOBJ_REG(lif
, l2vpn_if
);
1294 ldp_config_apply(vty
, vty_conf
);
1296 return (CMD_SUCCESS
);
1300 ldp_vty_l2vpn_pseudowire(struct vty
*vty
, const char *negate
, const char *ifname
)
1302 VTY_DECLVAR_CONTEXT(l2vpn
, l2vpn
);
1303 struct l2vpn_pw
*pw
;
1305 if (ifname
== NULL
) {
1306 vty_out (vty
, "%% Missing IF name\n");
1307 return (CMD_WARNING_CONFIG_FAILED
);
1310 pw
= l2vpn_pw_find(l2vpn
, ifname
);
1314 return (CMD_SUCCESS
);
1317 if (pw
->lsr_id
.s_addr
== INADDR_ANY
|| pw
->pwid
== 0)
1318 RB_REMOVE(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
, pw
);
1320 RB_REMOVE(l2vpn_pw_head
, &l2vpn
->pw_tree
, pw
);
1323 ldp_config_apply(vty
, vty_conf
);
1325 return (CMD_SUCCESS
);
1329 VTY_PUSH_CONTEXT_SUB(LDP_PSEUDOWIRE_NODE
, pw
);
1330 return (CMD_SUCCESS
);
1333 if (ldp_iface_is_configured(vty_conf
, ifname
)) {
1334 vty_out (vty
, "%% Interface is already in use\n");
1335 return (CMD_SUCCESS
);
1338 pw
= l2vpn_pw_new(l2vpn
, ifname
);
1339 pw
->flags
= F_PW_STATUSTLV_CONF
|F_PW_CWORD_CONF
;
1340 RB_INSERT(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
, pw
);
1341 QOBJ_REG(pw
, l2vpn_pw
);
1343 VTY_PUSH_CONTEXT_SUB(LDP_PSEUDOWIRE_NODE
, pw
);
1345 ldp_config_apply(vty
, vty_conf
);
1347 return (CMD_SUCCESS
);
1351 ldp_vty_l2vpn_pw_cword(struct vty
*vty
, const char *negate
, const char *preference_str
)
1353 VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw
, pw
);
1356 pw
->flags
|= F_PW_CWORD_CONF
;
1358 if (!preference_str
) {
1359 vty_out (vty
, "%% Missing preference\n");
1360 return (CMD_WARNING_CONFIG_FAILED
);
1362 if (preference_str
[0] == 'e')
1363 pw
->flags
&= ~F_PW_CWORD_CONF
;
1365 pw
->flags
|= F_PW_CWORD_CONF
;
1368 ldp_config_apply(vty
, vty_conf
);
1370 return (CMD_SUCCESS
);
1374 ldp_vty_l2vpn_pw_nbr_addr(struct vty
*vty
, const char *negate
, const char *addr_str
)
1376 VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw
, pw
);
1378 union ldpd_addr addr
;
1380 if (ldp_get_address(addr_str
, &af
, &addr
) == -1 ||
1381 bad_addr(af
, &addr
)) {
1382 vty_out (vty
, "%% Malformed address\n");
1383 return (CMD_WARNING_CONFIG_FAILED
);
1388 memset(&pw
->addr
, 0, sizeof(pw
->addr
));
1389 pw
->flags
&= ~F_PW_STATIC_NBR_ADDR
;
1393 pw
->flags
|= F_PW_STATIC_NBR_ADDR
;
1396 ldp_config_apply(vty
, vty_conf
);
1398 return (CMD_SUCCESS
);
1402 ldp_vty_l2vpn_pw_nbr_id(struct vty
*vty
, const char *negate
, struct in_addr lsr_id
)
1404 VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw
, pw
);
1406 if (bad_addr_v4(lsr_id
)) {
1407 vty_out (vty
, "%% Malformed address\n");
1408 return (CMD_WARNING_CONFIG_FAILED
);
1412 pw
->lsr_id
.s_addr
= INADDR_ANY
;
1414 pw
->lsr_id
= lsr_id
;
1416 ldp_config_apply(vty
, vty_conf
);
1418 return (CMD_SUCCESS
);
1422 ldp_vty_l2vpn_pw_pwid(struct vty
*vty
, const char *negate
, long pwid
)
1424 VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw
, pw
);
1431 ldp_config_apply(vty
, vty_conf
);
1433 return (CMD_SUCCESS
);
1437 ldp_vty_l2vpn_pw_pwstatus(struct vty
*vty
, const char *negate
)
1439 VTY_DECLVAR_CONTEXT_SUB(l2vpn_pw
, pw
);
1442 pw
->flags
|= F_PW_STATUSTLV_CONF
;
1444 pw
->flags
&= ~F_PW_STATUSTLV_CONF
;
1446 ldp_config_apply(vty
, vty_conf
);
1448 return (CMD_SUCCESS
);
1452 iface_new_api(struct ldpd_conf
*conf
, const char *name
)
1454 const char *ifname
= name
;
1455 struct iface
*iface
;
1457 if (ldp_iface_is_configured(conf
, ifname
))
1460 iface
= if_new(name
);
1461 RB_INSERT(iface_head
, &conf
->iface_tree
, iface
);
1462 QOBJ_REG(iface
, iface
);
1467 iface_del_api(struct ldpd_conf
*conf
, struct iface
*iface
)
1470 RB_REMOVE(iface_head
, &conf
->iface_tree
, iface
);
1475 tnbr_new_api(struct ldpd_conf
*conf
, int af
, union ldpd_addr
*addr
)
1479 if (af
== AF_INET6
&& IN6_IS_SCOPE_EMBED(&addr
->v6
))
1482 if (tnbr_find(conf
, af
, addr
))
1485 tnbr
= tnbr_new(af
, addr
);
1486 tnbr
->flags
|= F_TNBR_CONFIGURED
;
1487 RB_INSERT(tnbr_head
, &conf
->tnbr_tree
, tnbr
);
1488 QOBJ_REG(tnbr
, tnbr
);
1493 tnbr_del_api(struct ldpd_conf
*conf
, struct tnbr
*tnbr
)
1496 RB_REMOVE(tnbr_head
, &conf
->tnbr_tree
, tnbr
);
1501 nbrp_new_api(struct ldpd_conf
*conf
, struct in_addr lsr_id
)
1503 struct nbr_params
*nbrp
;
1505 if (nbr_params_find(conf
, lsr_id
))
1508 nbrp
= nbr_params_new(lsr_id
);
1509 RB_INSERT(nbrp_head
, &conf
->nbrp_tree
, nbrp
);
1510 QOBJ_REG(nbrp
, nbr_params
);
1515 nbrp_del_api(struct ldpd_conf
*conf
, struct nbr_params
*nbrp
)
1518 RB_REMOVE(nbrp_head
, &conf
->nbrp_tree
, nbrp
);
1523 l2vpn_new_api(struct ldpd_conf
*conf
, const char *name
)
1525 struct l2vpn
*l2vpn
;
1527 if (l2vpn_find(conf
, name
))
1530 l2vpn
= l2vpn_new(name
);
1531 l2vpn
->type
= L2VPN_TYPE_VPLS
;
1532 RB_INSERT(l2vpn_head
, &conf
->l2vpn_tree
, l2vpn
);
1533 QOBJ_REG(l2vpn
, l2vpn
);
1538 l2vpn_del_api(struct ldpd_conf
*conf
, struct l2vpn
*l2vpn
)
1540 struct l2vpn_if
*lif
;
1541 struct l2vpn_pw
*pw
;
1543 while (!RB_EMPTY(l2vpn_if_head
, &l2vpn
->if_tree
)) {
1544 lif
= RB_ROOT(l2vpn_if_head
, &l2vpn
->if_tree
);
1547 RB_REMOVE(l2vpn_if_head
, &l2vpn
->if_tree
, lif
);
1550 while (!RB_EMPTY(l2vpn_pw_head
, &l2vpn
->pw_tree
)) {
1551 pw
= RB_ROOT(l2vpn_pw_head
, &l2vpn
->pw_tree
);
1554 RB_REMOVE(l2vpn_pw_head
, &l2vpn
->pw_tree
, pw
);
1557 while (!RB_EMPTY(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
)) {
1558 pw
= RB_ROOT(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
);
1561 RB_REMOVE(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
, pw
);
1565 RB_REMOVE(l2vpn_head
, &conf
->l2vpn_tree
, l2vpn
);
1570 l2vpn_if_new_api(struct ldpd_conf
*conf
, struct l2vpn
*l2vpn
,
1573 struct l2vpn_if
*lif
;
1575 if (ldp_iface_is_configured(conf
, ifname
))
1578 lif
= l2vpn_if_new(l2vpn
, ifname
);
1579 RB_INSERT(l2vpn_if_head
, &l2vpn
->if_tree
, lif
);
1580 QOBJ_REG(lif
, l2vpn_if
);
1585 l2vpn_if_del_api(struct l2vpn
*l2vpn
, struct l2vpn_if
*lif
)
1588 RB_REMOVE(l2vpn_if_head
, &l2vpn
->if_tree
, lif
);
1593 l2vpn_pw_new_api(struct ldpd_conf
*conf
, struct l2vpn
*l2vpn
,
1596 struct l2vpn_pw
*pw
;
1598 if (ldp_iface_is_configured(conf
, ifname
))
1601 pw
= l2vpn_pw_new(l2vpn
, ifname
);
1602 pw
->flags
= F_PW_STATUSTLV_CONF
|F_PW_CWORD_CONF
;
1603 RB_INSERT(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
, pw
);
1604 QOBJ_REG(pw
, l2vpn_pw
);
1609 l2vpn_pw_del_api(struct l2vpn
*l2vpn
, struct l2vpn_pw
*pw
)
1612 RB_REMOVE(l2vpn_pw_head
, &l2vpn
->pw_inactive_tree
, pw
);