2 * Copyright (C) 2016 by Open Source Routing.
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
35 static int interface_config_write(struct vty
*);
36 static void ldp_af_iface_config_write(struct vty
*, int);
37 static void ldp_af_config_write(struct vty
*, int, struct ldpd_conf
*,
38 struct ldpd_af_conf
*);
39 static void ldp_l2vpn_pw_config_write(struct vty
*, struct l2vpn_pw
*);
40 static int ldp_vty_get_af(struct vty
*);
41 static int ldp_iface_is_configured(struct ldpd_conf
*, const char *);
42 static int ldp_vty_nbr_session_holdtime(struct vty
*, struct vty_arg
*[]);
43 static int ldp_vty_af_session_holdtime(struct vty
*, struct vty_arg
*[]);
45 static char vty_ifname
[IF_NAMESIZE
];
46 static char vty_l2vpn_name
[L2VPN_NAME_LEN
];
47 static char vty_pw_ifname
[IF_NAMESIZE
];
49 static struct cmd_node interface_node
=
56 struct cmd_node ldp_node
=
63 struct cmd_node ldp_ipv4_node
=
66 "%s(config-ldp-af)# ",
70 struct cmd_node ldp_ipv6_node
=
73 "%s(config-ldp-af)# ",
77 struct cmd_node ldp_ipv4_iface_node
=
80 "%s(config-ldp-af-if)# ",
84 struct cmd_node ldp_ipv6_iface_node
=
87 "%s(config-ldp-af-if)# ",
91 struct cmd_node ldp_l2vpn_node
=
98 struct cmd_node ldp_pseudowire_node
=
101 "%s(config-l2vpn-pw)# ",
106 ldp_get_address(const char *str
, int *af
, union ldpd_addr
*addr
)
108 memset(addr
, 0, sizeof(*addr
));
110 if (inet_pton(AF_INET
, str
, &addr
->v4
) == 1) {
115 if (inet_pton(AF_INET6
, str
, &addr
->v6
) == 1) {
124 interface_config_write(struct vty
*vty
)
126 struct listnode
*node
;
127 struct interface
*ifp
;
130 for (ALL_LIST_ELEMENTS_RO(vrf_iflist (VRF_DEFAULT
), node
, ifp
)) {
131 vty_out(vty
, "!%s", VTY_NEWLINE
);
132 vty_out(vty
, "interface %s%s", ifp
->name
, VTY_NEWLINE
);
134 vty_out(vty
, " description %s%s", ifp
->desc
,
144 ldp_af_iface_config_write(struct vty
*vty
, int af
)
149 LIST_FOREACH(iface
, &ldpd_conf
->iface_list
, entry
) {
150 ia
= iface_af_get(iface
, af
);
154 vty_out(vty
, " !%s", VTY_NEWLINE
);
155 vty_out(vty
, " interface %s%s", iface
->name
, VTY_NEWLINE
);
157 if (ia
->hello_holdtime
!= LINK_DFLT_HOLDTIME
&&
158 ia
->hello_holdtime
!= 0)
159 vty_out(vty
, " discovery hello holdtime %u%s",
160 ia
->hello_holdtime
, VTY_NEWLINE
);
161 if (ia
->hello_interval
!= DEFAULT_HELLO_INTERVAL
&&
162 ia
->hello_interval
!= 0)
163 vty_out(vty
, " discovery hello interval %u%s",
164 ia
->hello_interval
, VTY_NEWLINE
);
169 ldp_af_config_write(struct vty
*vty
, int af
, struct ldpd_conf
*conf
,
170 struct ldpd_af_conf
*af_conf
)
174 if (!(af_conf
->flags
& F_LDPD_AF_ENABLED
))
177 vty_out(vty
, " !%s", VTY_NEWLINE
);
178 vty_out(vty
, " address-family %s%s", af_name(af
), VTY_NEWLINE
);
180 if (af_conf
->lhello_holdtime
!= LINK_DFLT_HOLDTIME
&&
181 af_conf
->lhello_holdtime
!= 0 )
182 vty_out(vty
, " discovery hello holdtime %u%s",
183 af_conf
->lhello_holdtime
, VTY_NEWLINE
);
184 if (af_conf
->lhello_interval
!= DEFAULT_HELLO_INTERVAL
&&
185 af_conf
->lhello_interval
!= 0)
186 vty_out(vty
, " discovery hello interval %u%s",
187 af_conf
->lhello_interval
, VTY_NEWLINE
);
189 if (af_conf
->flags
& F_LDPD_AF_THELLO_ACCEPT
)
190 vty_out(vty
, " discovery targeted-hello accept%s",
193 if (af_conf
->thello_holdtime
!= TARGETED_DFLT_HOLDTIME
&&
194 af_conf
->thello_holdtime
!= 0)
195 vty_out(vty
, " discovery targeted-hello holdtime %u%s",
196 af_conf
->thello_holdtime
, VTY_NEWLINE
);
197 if (af_conf
->thello_interval
!= DEFAULT_HELLO_INTERVAL
&&
198 af_conf
->thello_interval
!= 0)
199 vty_out(vty
, " discovery targeted-hello interval %u%s",
200 af_conf
->thello_interval
, VTY_NEWLINE
);
202 if (ldp_addrisset(af
, &af_conf
->trans_addr
))
203 vty_out(vty
, " discovery transport-address %s%s",
204 log_addr(af
, &af_conf
->trans_addr
), VTY_NEWLINE
);
206 vty_out(vty
, " ! Incomplete config, specify a discovery "
207 "transport-address%s", VTY_NEWLINE
);
209 if (af_conf
->flags
& F_LDPD_AF_EXPNULL
)
210 vty_out(vty
, " label local advertise explicit-null%s",
213 if (af_conf
->flags
& F_LDPD_AF_NO_GTSM
)
214 vty_out(vty
, " ttl-security disable%s", VTY_NEWLINE
);
216 if (af_conf
->keepalive
!= DEFAULT_KEEPALIVE
)
217 vty_out(vty
, " session holdtime %u%s", af_conf
->keepalive
,
220 LIST_FOREACH(tnbr
, &ldpd_conf
->tnbr_list
, entry
) {
221 if (tnbr
->af
== af
) {
222 vty_out(vty
, " !%s", VTY_NEWLINE
);
223 vty_out(vty
, " neighbor %s targeted%s",
224 log_addr(tnbr
->af
, &tnbr
->addr
), VTY_NEWLINE
);
228 ldp_af_iface_config_write(vty
, af
);
230 vty_out(vty
, " !%s", VTY_NEWLINE
);
234 ldp_config_write(struct vty
*vty
)
236 struct nbr_params
*nbrp
;
238 if (!(ldpd_conf
->flags
& F_LDPD_ENABLED
))
241 vty_out(vty
, "mpls ldp%s", VTY_NEWLINE
);
243 if (ldpd_conf
->rtr_id
.s_addr
!= 0)
244 vty_out(vty
, " router-id %s%s",
245 inet_ntoa(ldpd_conf
->rtr_id
), VTY_NEWLINE
);
247 if (ldpd_conf
->lhello_holdtime
!= LINK_DFLT_HOLDTIME
&&
248 ldpd_conf
->lhello_holdtime
!= 0)
249 vty_out(vty
, " discovery hello holdtime %u%s",
250 ldpd_conf
->lhello_holdtime
, VTY_NEWLINE
);
251 if (ldpd_conf
->lhello_interval
!= DEFAULT_HELLO_INTERVAL
&&
252 ldpd_conf
->lhello_interval
!= 0)
253 vty_out(vty
, " discovery hello interval %u%s",
254 ldpd_conf
->lhello_interval
, VTY_NEWLINE
);
256 if (ldpd_conf
->thello_holdtime
!= TARGETED_DFLT_HOLDTIME
&&
257 ldpd_conf
->thello_holdtime
!= 0)
258 vty_out(vty
, " discovery targeted-hello holdtime %u%s",
259 ldpd_conf
->thello_holdtime
, VTY_NEWLINE
);
260 if (ldpd_conf
->thello_interval
!= DEFAULT_HELLO_INTERVAL
&&
261 ldpd_conf
->thello_interval
!= 0)
262 vty_out(vty
, " discovery targeted-hello interval %u%s",
263 ldpd_conf
->thello_interval
, VTY_NEWLINE
);
265 if (ldpd_conf
->trans_pref
== DUAL_STACK_LDPOV4
)
266 vty_out(vty
, " dual-stack transport-connection prefer ipv4%s",
269 if (ldpd_conf
->flags
& F_LDPD_DS_CISCO_INTEROP
)
270 vty_out(vty
, " dual-stack cisco-interop%s", VTY_NEWLINE
);
272 LIST_FOREACH(nbrp
, &ldpd_conf
->nbrp_list
, entry
) {
273 if (nbrp
->flags
& F_NBRP_KEEPALIVE
)
274 vty_out(vty
, " neighbor %s session holdtime %u%s",
275 inet_ntoa(nbrp
->lsr_id
), nbrp
->keepalive
,
278 if (nbrp
->flags
& F_NBRP_GTSM
) {
279 if (nbrp
->gtsm_enabled
)
280 vty_out(vty
, " neighbor %s ttl-security hops "
281 "%u%s", inet_ntoa(nbrp
->lsr_id
),
282 nbrp
->gtsm_hops
, VTY_NEWLINE
);
284 vty_out(vty
, " neighbor %s ttl-security "
285 "disable%s", inet_ntoa(nbrp
->lsr_id
),
289 if (nbrp
->auth
.method
== AUTH_MD5SIG
)
290 vty_out(vty
, " neighbor %s password %s%s",
291 inet_ntoa(nbrp
->lsr_id
), nbrp
->auth
.md5key
,
295 ldp_af_config_write(vty
, AF_INET
, ldpd_conf
, &ldpd_conf
->ipv4
);
296 ldp_af_config_write(vty
, AF_INET6
, ldpd_conf
, &ldpd_conf
->ipv6
);
297 vty_out(vty
, " !%s", VTY_NEWLINE
);
298 vty_out(vty
, "!%s", VTY_NEWLINE
);
304 ldp_l2vpn_pw_config_write(struct vty
*vty
, struct l2vpn_pw
*pw
)
306 int missing_lsrid
= 0;
307 int missing_pwid
= 0;
309 vty_out(vty
, " !%s", VTY_NEWLINE
);
310 vty_out(vty
, " member pseudowire %s%s", pw
->ifname
, VTY_NEWLINE
);
312 if (pw
->lsr_id
.s_addr
!= INADDR_ANY
)
313 vty_out(vty
, " neighbor lsr-id %s%s", inet_ntoa(pw
->lsr_id
),
318 if (pw
->flags
& F_PW_STATIC_NBR_ADDR
)
319 vty_out(vty
, " neighbor address %s%s", log_addr(pw
->af
,
320 &pw
->addr
), VTY_NEWLINE
);
323 vty_out(vty
, " pw-id %u%s", pw
->pwid
, VTY_NEWLINE
);
327 if (!(pw
->flags
& F_PW_CWORD_CONF
))
328 vty_out(vty
, " control-word exclude%s", VTY_NEWLINE
);
330 if (!(pw
->flags
& F_PW_STATUSTLV_CONF
))
331 vty_out(vty
, " pw-status disable%s", VTY_NEWLINE
);
334 vty_out(vty
, " ! Incomplete config, specify a neighbor "
335 "lsr-id%s", VTY_NEWLINE
);
337 vty_out(vty
, " ! Incomplete config, specify a pw-id%s",
342 ldp_l2vpn_config_write(struct vty
*vty
)
345 struct l2vpn_if
*lif
;
348 LIST_FOREACH(l2vpn
, &ldpd_conf
->l2vpn_list
, entry
) {
349 vty_out(vty
, "l2vpn %s type vpls%s", l2vpn
->name
, VTY_NEWLINE
);
351 if (l2vpn
->pw_type
!= DEFAULT_PW_TYPE
)
352 vty_out(vty
, " vc type ethernet-tagged%s", VTY_NEWLINE
);
354 if (l2vpn
->mtu
!= DEFAULT_L2VPN_MTU
)
355 vty_out(vty
, " mtu %u%s", l2vpn
->mtu
, VTY_NEWLINE
);
357 if (l2vpn
->br_ifname
[0] != '\0')
358 vty_out(vty
, " bridge %s%s", l2vpn
->br_ifname
,
361 LIST_FOREACH(lif
, &l2vpn
->if_list
, entry
)
362 vty_out(vty
, " member interface %s%s", lif
->ifname
,
365 LIST_FOREACH(pw
, &l2vpn
->pw_list
, entry
)
366 ldp_l2vpn_pw_config_write(vty
, pw
);
367 LIST_FOREACH(pw
, &l2vpn
->pw_inactive_list
, entry
)
368 ldp_l2vpn_pw_config_write(vty
, pw
);
370 vty_out(vty
, " !%s", VTY_NEWLINE
);
371 vty_out(vty
, "!%s", VTY_NEWLINE
);
378 ldp_vty_get_af(struct vty
*vty
)
382 case LDP_IPV4_IFACE_NODE
:
385 case LDP_IPV6_IFACE_NODE
:
388 fatalx("ldp_vty_get_af: unexpected node");
393 ldp_iface_is_configured(struct ldpd_conf
*xconf
, const char *ifname
)
397 if (if_lookup_name(xconf
, ifname
))
400 LIST_FOREACH(l2vpn
, &xconf
->l2vpn_list
, entry
) {
401 if (l2vpn_if_find_name(l2vpn
, ifname
))
403 if (l2vpn_pw_find_name(l2vpn
, ifname
))
411 ldp_vty_mpls_ldp(struct vty
*vty
, struct vty_arg
*args
[])
413 struct ldpd_conf
*vty_conf
;
416 vty_conf
= ldp_dup_config(ldpd_conf
);
418 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
421 vty_conf
->flags
&= ~F_LDPD_ENABLED
;
423 vty
->node
= LDP_NODE
;
424 vty_conf
->flags
|= F_LDPD_ENABLED
;
427 ldp_reload(vty_conf
);
429 return (CMD_SUCCESS
);
433 ldp_vty_address_family(struct vty
*vty
, struct vty_arg
*args
[])
435 struct ldpd_conf
*vty_conf
;
436 struct ldpd_af_conf
*af_conf
;
441 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
442 af_str
= vty_get_arg_value(args
, "address-family");
444 vty_conf
= ldp_dup_config(ldpd_conf
);
445 if (strcmp(af_str
, "ipv4") == 0) {
447 af_conf
= &vty_conf
->ipv4
;
448 } else if (strcmp(af_str
, "ipv6") == 0) {
450 af_conf
= &vty_conf
->ipv6
;
452 return (CMD_WARNING
);
455 af_conf
->flags
&= ~F_LDPD_AF_ENABLED
;
456 ldp_reload(vty_conf
);
457 return (CMD_SUCCESS
);
462 vty
->node
= LDP_IPV4_NODE
;
465 vty
->node
= LDP_IPV6_NODE
;
468 fatalx("ldp_vty_address_family: unknown af");
470 af_conf
->flags
|= F_LDPD_AF_ENABLED
;
472 ldp_reload(vty_conf
);
474 return (CMD_SUCCESS
);
478 ldp_vty_disc_holdtime(struct vty
*vty
, struct vty_arg
*args
[])
480 struct ldpd_conf
*vty_conf
;
481 struct ldpd_af_conf
*af_conf
;
487 enum hello_type hello_type
;
488 const char *seconds_str
;
489 const char *hello_type_str
;
492 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
493 seconds_str
= vty_get_arg_value(args
, "seconds");
494 hello_type_str
= vty_get_arg_value(args
, "hello_type");
496 secs
= strtol(seconds_str
, &ep
, 10);
497 if (*ep
!= '\0' || secs
< MIN_HOLDTIME
|| secs
> MAX_HOLDTIME
) {
498 vty_out(vty
, "%% Invalid holdtime%s", VTY_NEWLINE
);
499 return (CMD_WARNING
);
502 if (hello_type_str
[0] == 'h')
503 hello_type
= HELLO_LINK
;
505 hello_type
= HELLO_TARGETED
;
507 vty_conf
= ldp_dup_config(ldpd_conf
);
512 switch (hello_type
) {
514 vty_conf
->lhello_holdtime
= LINK_DFLT_HOLDTIME
;
517 vty_conf
->thello_holdtime
=
518 TARGETED_DFLT_HOLDTIME
;
522 switch (hello_type
) {
524 vty_conf
->lhello_holdtime
= secs
;
527 vty_conf
->thello_holdtime
= secs
;
534 af
= ldp_vty_get_af(vty
);
535 af_conf
= ldp_af_conf_get(vty_conf
, af
);
538 switch (hello_type
) {
540 af_conf
->lhello_holdtime
= 0;
543 af_conf
->thello_holdtime
= 0;
547 switch (hello_type
) {
549 af_conf
->lhello_holdtime
= secs
;
552 af_conf
->thello_holdtime
= secs
;
557 case LDP_IPV4_IFACE_NODE
:
558 case LDP_IPV6_IFACE_NODE
:
559 af
= ldp_vty_get_af(vty
);
560 iface
= if_lookup_name(vty_conf
, vty_ifname
);
561 ia
= iface_af_get(iface
, af
);
564 ia
->hello_holdtime
= 0;
566 ia
->hello_holdtime
= secs
;
569 fatalx("ldp_vty_disc_holdtime: unexpected node");
572 ldp_reload(vty_conf
);
574 return (CMD_SUCCESS
);
578 ldp_vty_disc_interval(struct vty
*vty
, struct vty_arg
*args
[])
580 struct ldpd_conf
*vty_conf
;
581 struct ldpd_af_conf
*af_conf
;
587 enum hello_type hello_type
;
588 const char *seconds_str
;
589 const char *hello_type_str
;
592 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
593 seconds_str
= vty_get_arg_value(args
, "seconds");
594 hello_type_str
= vty_get_arg_value(args
, "hello_type");
596 secs
= strtol(seconds_str
, &ep
, 10);
597 if (*ep
!= '\0' || secs
< MIN_HELLO_INTERVAL
||
598 secs
> MAX_HELLO_INTERVAL
) {
599 vty_out(vty
, "%% Invalid interval%s", VTY_NEWLINE
);
600 return (CMD_WARNING
);
603 if (hello_type_str
[0] == 'h')
604 hello_type
= HELLO_LINK
;
606 hello_type
= HELLO_TARGETED
;
608 vty_conf
= ldp_dup_config(ldpd_conf
);
613 switch (hello_type
) {
615 vty_conf
->lhello_interval
= LINK_DFLT_HOLDTIME
;
618 vty_conf
->thello_interval
=
619 TARGETED_DFLT_HOLDTIME
;
623 switch (hello_type
) {
625 vty_conf
->lhello_interval
= secs
;
628 vty_conf
->thello_interval
= secs
;
635 af
= ldp_vty_get_af(vty
);
636 af_conf
= ldp_af_conf_get(vty_conf
, af
);
639 switch (hello_type
) {
641 af_conf
->lhello_interval
= 0;
644 af_conf
->thello_interval
= 0;
648 switch (hello_type
) {
650 af_conf
->lhello_interval
= secs
;
653 af_conf
->thello_interval
= secs
;
658 case LDP_IPV4_IFACE_NODE
:
659 case LDP_IPV6_IFACE_NODE
:
660 af
= ldp_vty_get_af(vty
);
661 iface
= if_lookup_name(vty_conf
, vty_ifname
);
662 ia
= iface_af_get(iface
, af
);
665 ia
->hello_interval
= 0;
667 ia
->hello_interval
= secs
;
670 fatalx("ldp_vty_disc_interval: unexpected node");
673 ldp_reload(vty_conf
);
675 return (CMD_SUCCESS
);
679 ldp_vty_targeted_hello_accept(struct vty
*vty
, struct vty_arg
*args
[])
681 struct ldpd_conf
*vty_conf
;
682 struct ldpd_af_conf
*af_conf
;
686 vty_conf
= ldp_dup_config(ldpd_conf
);
688 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
690 af
= ldp_vty_get_af(vty
);
691 af_conf
= ldp_af_conf_get(vty_conf
, af
);
694 af_conf
->flags
&= ~F_LDPD_AF_THELLO_ACCEPT
;
696 af_conf
->flags
|= F_LDPD_AF_THELLO_ACCEPT
;
698 ldp_reload(vty_conf
);
700 return (CMD_SUCCESS
);
704 ldp_vty_nbr_session_holdtime(struct vty
*vty
, struct vty_arg
*args
[])
706 struct ldpd_conf
*vty_conf
;
709 struct in_addr lsr_id
;
710 struct nbr_params
*nbrp
;
711 const char *seconds_str
;
712 const char *lsr_id_str
;
715 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
716 seconds_str
= vty_get_arg_value(args
, "seconds");
717 lsr_id_str
= vty_get_arg_value(args
, "lsr_id");
719 if (inet_pton(AF_INET
, lsr_id_str
, &lsr_id
) != 1 ||
720 bad_addr_v4(lsr_id
)) {
721 vty_out(vty
, "%% Malformed address%s", VTY_NEWLINE
);
722 return (CMD_WARNING
);
725 vty_conf
= ldp_dup_config(ldpd_conf
);
726 nbrp
= nbr_params_find(vty_conf
, lsr_id
);
728 secs
= strtol(seconds_str
, &ep
, 10);
729 if (*ep
!= '\0' || secs
< MIN_KEEPALIVE
|| secs
> MAX_KEEPALIVE
) {
730 vty_out(vty
, "%% Invalid holdtime%s", VTY_NEWLINE
);
739 nbrp
->flags
&= ~F_NBRP_KEEPALIVE
;
742 nbrp
= nbr_params_new(lsr_id
);
743 LIST_INSERT_HEAD(&vty_conf
->nbrp_list
, nbrp
, entry
);
744 } else if (nbrp
->keepalive
== secs
)
747 nbrp
->keepalive
= secs
;
748 nbrp
->flags
|= F_NBRP_KEEPALIVE
;
751 ldp_reload(vty_conf
);
753 return (CMD_SUCCESS
);
756 ldp_clear_config(vty_conf
);
757 return (CMD_SUCCESS
);
761 ldp_vty_af_session_holdtime(struct vty
*vty
, struct vty_arg
*args
[])
763 struct ldpd_conf
*vty_conf
;
764 struct ldpd_af_conf
*af_conf
;
768 const char *seconds_str
;
771 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
772 seconds_str
= vty_get_arg_value(args
, "seconds");
774 secs
= strtol(seconds_str
, &ep
, 10);
775 if (*ep
!= '\0' || secs
< MIN_KEEPALIVE
|| secs
> MAX_KEEPALIVE
) {
776 vty_out(vty
, "%% Invalid holdtime%s", VTY_NEWLINE
);
777 return (CMD_SUCCESS
);
780 vty_conf
= ldp_dup_config(ldpd_conf
);
781 af
= ldp_vty_get_af(vty
);
782 af_conf
= ldp_af_conf_get(vty_conf
, af
);
785 af_conf
->keepalive
= DEFAULT_KEEPALIVE
;
787 af_conf
->keepalive
= secs
;
789 ldp_reload(vty_conf
);
791 return (CMD_SUCCESS
);
795 ldp_vty_session_holdtime(struct vty
*vty
, struct vty_arg
*args
[])
799 return (ldp_vty_nbr_session_holdtime(vty
, args
));
802 return (ldp_vty_af_session_holdtime(vty
, args
));
804 fatalx("ldp_vty_session_holdtime: unexpected node");
809 ldp_vty_interface(struct vty
*vty
, struct vty_arg
*args
[])
811 struct ldpd_conf
*vty_conf
;
815 struct interface
*ifp
;
820 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
821 ifname
= vty_get_arg_value(args
, "ifname");
823 vty_conf
= ldp_dup_config(ldpd_conf
);
824 af
= ldp_vty_get_af(vty
);
825 iface
= if_lookup_name(vty_conf
, ifname
);
831 ia
= iface_af_get(iface
, af
);
832 if (ia
->enabled
== 0)
836 ldp_reload(vty_conf
);
837 return (CMD_SUCCESS
);
842 vty
->node
= LDP_IPV4_IFACE_NODE
;
845 vty
->node
= LDP_IPV6_IFACE_NODE
;
850 strlcpy(vty_ifname
, ifname
, sizeof(vty_ifname
));
853 if (ldp_iface_is_configured(vty_conf
, ifname
)) {
854 vty_out(vty
, "%% Interface is already in use%s",
859 ifp
= if_lookup_by_name(ifname
);
860 memset(&kif
, 0, sizeof(kif
));
861 strlcpy(kif
.ifname
, ifname
, sizeof(kif
.ifname
));
863 kif
.ifindex
= ifp
->ifindex
;
864 kif
.flags
= ifp
->flags
;
866 iface
= if_new(&kif
);
868 ia
= iface_af_get(iface
, af
);
870 LIST_INSERT_HEAD(&vty_conf
->iface_list
, iface
, entry
);
872 memset(&kif
, 0, sizeof(kif
));
873 strlcpy(kif
.ifname
, ifname
, sizeof(kif
.ifname
));
875 ia
= iface_af_get(iface
, af
);
881 ldp_reload(vty_conf
);
882 return (CMD_SUCCESS
);
885 ldp_clear_config(vty_conf
);
886 return (CMD_SUCCESS
);
890 ldp_vty_trans_addr(struct vty
*vty
, struct vty_arg
*args
[])
892 struct ldpd_conf
*vty_conf
;
893 struct ldpd_af_conf
*af_conf
;
895 const char *addr_str
;
898 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
899 addr_str
= vty_get_arg_value(args
, "addr");
901 vty_conf
= ldp_dup_config(ldpd_conf
);
902 af
= ldp_vty_get_af(vty
);
903 af_conf
= ldp_af_conf_get(vty_conf
, af
);
906 memset(&af_conf
->trans_addr
, 0, sizeof(af_conf
->trans_addr
));
908 if (inet_pton(af
, addr_str
, &af_conf
->trans_addr
) != 1 ||
909 bad_addr(af
, &af_conf
->trans_addr
)) {
910 vty_out(vty
, "%% Malformed address%s", VTY_NEWLINE
);
915 ldp_reload(vty_conf
);
917 return (CMD_SUCCESS
);
920 ldp_clear_config(vty_conf
);
921 return (CMD_SUCCESS
);
925 ldp_vty_neighbor_targeted(struct vty
*vty
, struct vty_arg
*args
[])
927 struct ldpd_conf
*vty_conf
;
929 union ldpd_addr addr
;
931 const char *addr_str
;
934 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
935 addr_str
= vty_get_arg_value(args
, "addr");
937 af
= ldp_vty_get_af(vty
);
939 if (inet_pton(af
, addr_str
, &addr
) != 1 ||
940 bad_addr(af
, &addr
)) {
941 vty_out(vty
, "%% Malformed address%s", VTY_NEWLINE
);
942 return (CMD_WARNING
);
944 if (af
== AF_INET6
&& IN6_IS_SCOPE_EMBED(&addr
.v6
)) {
945 vty_out(vty
, "%% Address can not be link-local%s", VTY_NEWLINE
);
946 return (CMD_WARNING
);
949 vty_conf
= ldp_dup_config(ldpd_conf
);
950 tnbr
= tnbr_find(vty_conf
, af
, &addr
);
956 LIST_REMOVE(tnbr
, entry
);
958 ldp_reload(vty_conf
);
959 return (CMD_SUCCESS
);
965 tnbr
= tnbr_new(af
, &addr
);
966 tnbr
->flags
|= F_TNBR_CONFIGURED
;
967 LIST_INSERT_HEAD(&vty_conf
->tnbr_list
, tnbr
, entry
);
969 ldp_reload(vty_conf
);
971 return (CMD_SUCCESS
);
974 ldp_clear_config(vty_conf
);
975 return (CMD_SUCCESS
);
979 ldp_vty_explicit_null(struct vty
*vty
, struct vty_arg
*args
[])
981 struct ldpd_conf
*vty_conf
;
982 struct ldpd_af_conf
*af_conf
;
986 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
988 vty_conf
= ldp_dup_config(ldpd_conf
);
989 af
= ldp_vty_get_af(vty
);
990 af_conf
= ldp_af_conf_get(vty_conf
, af
);
993 af_conf
->flags
&= ~F_LDPD_AF_EXPNULL
;
995 af_conf
->flags
|= F_LDPD_AF_EXPNULL
;
997 ldp_reload(vty_conf
);
999 return (CMD_SUCCESS
);
1003 ldp_vty_ttl_security(struct vty
*vty
, struct vty_arg
*args
[])
1005 struct ldpd_conf
*vty_conf
;
1006 struct ldpd_af_conf
*af_conf
;
1010 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1012 vty_conf
= ldp_dup_config(ldpd_conf
);
1013 af
= ldp_vty_get_af(vty
);
1014 af_conf
= ldp_af_conf_get(vty_conf
, af
);
1017 af_conf
->flags
&= ~F_LDPD_AF_NO_GTSM
;
1019 af_conf
->flags
|= F_LDPD_AF_NO_GTSM
;
1021 ldp_reload(vty_conf
);
1023 return (CMD_SUCCESS
);
1027 ldp_vty_router_id(struct vty
*vty
, struct vty_arg
*args
[])
1029 struct ldpd_conf
*vty_conf
;
1030 const char *addr_str
;
1033 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1034 addr_str
= vty_get_arg_value(args
, "addr");
1036 vty_conf
= ldp_dup_config(ldpd_conf
);
1039 vty_conf
->rtr_id
.s_addr
= INADDR_ANY
;
1041 if (inet_pton(AF_INET
, addr_str
, &vty_conf
->rtr_id
) != 1 ||
1042 bad_addr_v4(vty_conf
->rtr_id
)) {
1043 vty_out(vty
, "%% Malformed address%s", VTY_NEWLINE
);
1048 ldp_reload(vty_conf
);
1050 return (CMD_SUCCESS
);
1053 ldp_clear_config(vty_conf
);
1054 return (CMD_SUCCESS
);
1058 ldp_vty_ds_cisco_interop(struct vty
*vty
, struct vty_arg
*args
[])
1060 struct ldpd_conf
*vty_conf
;
1063 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1065 vty_conf
= ldp_dup_config(ldpd_conf
);
1068 vty_conf
->flags
&= ~F_LDPD_DS_CISCO_INTEROP
;
1070 vty_conf
->flags
|= F_LDPD_DS_CISCO_INTEROP
;
1072 ldp_reload(vty_conf
);
1074 return (CMD_SUCCESS
);
1078 ldp_vty_trans_pref_ipv4(struct vty
*vty
, struct vty_arg
*args
[])
1080 struct ldpd_conf
*vty_conf
;
1083 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1085 vty_conf
= ldp_dup_config(ldpd_conf
);
1088 vty_conf
->trans_pref
= DUAL_STACK_LDPOV6
;
1090 vty_conf
->trans_pref
= DUAL_STACK_LDPOV4
;
1092 ldp_reload(vty_conf
);
1094 return (CMD_SUCCESS
);
1098 ldp_vty_neighbor_password(struct vty
*vty
, struct vty_arg
*args
[])
1100 struct ldpd_conf
*vty_conf
;
1101 struct in_addr lsr_id
;
1102 size_t password_len
;
1103 struct nbr_params
*nbrp
;
1104 const char *lsr_id_str
;
1105 const char *password_str
;
1108 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1109 lsr_id_str
= vty_get_arg_value(args
, "lsr_id");
1110 password_str
= vty_get_arg_value(args
, "password");
1112 if (inet_pton(AF_INET
, lsr_id_str
, &lsr_id
) != 1 ||
1113 bad_addr_v4(lsr_id
)) {
1114 vty_out(vty
, "%% Malformed address%s", VTY_NEWLINE
);
1115 return (CMD_WARNING
);
1118 vty_conf
= ldp_dup_config(ldpd_conf
);
1119 nbrp
= nbr_params_find(vty_conf
, lsr_id
);
1125 memset(&nbrp
->auth
, 0, sizeof(nbrp
->auth
));
1126 nbrp
->auth
.method
= AUTH_NONE
;
1129 nbrp
= nbr_params_new(lsr_id
);
1130 LIST_INSERT_HEAD(&vty_conf
->nbrp_list
, nbrp
, entry
);
1131 } else if (nbrp
->auth
.method
== AUTH_MD5SIG
&&
1132 strcmp(nbrp
->auth
.md5key
, password_str
) == 0)
1135 password_len
= strlcpy(nbrp
->auth
.md5key
, password_str
,
1136 sizeof(nbrp
->auth
.md5key
));
1137 if (password_len
>= sizeof(nbrp
->auth
.md5key
))
1138 vty_out(vty
, "%% password has been truncated to %zu "
1139 "characters.", sizeof(nbrp
->auth
.md5key
) - 1);
1140 nbrp
->auth
.md5key_len
= password_len
;
1141 nbrp
->auth
.method
= AUTH_MD5SIG
;
1144 ldp_reload(vty_conf
);
1146 return (CMD_SUCCESS
);
1149 ldp_clear_config(vty_conf
);
1150 return (CMD_SUCCESS
);
1154 ldp_vty_neighbor_ttl_security(struct vty
*vty
, struct vty_arg
*args
[])
1156 struct ldpd_conf
*vty_conf
;
1157 struct in_addr lsr_id
;
1158 struct nbr_params
*nbrp
;
1161 const char *lsr_id_str
;
1162 const char *hops_str
;
1165 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1166 lsr_id_str
= vty_get_arg_value(args
, "lsr_id");
1167 hops_str
= vty_get_arg_value(args
, "hops");
1169 if (inet_pton(AF_INET
, lsr_id_str
, &lsr_id
) != 1 ||
1170 bad_addr_v4(lsr_id
)) {
1171 vty_out(vty
, "%% Malformed address%s", VTY_NEWLINE
);
1172 return (CMD_WARNING
);
1176 hops
= strtol(hops_str
, &ep
, 10);
1177 if (*ep
!= '\0' || hops
< 1 || hops
> 254) {
1178 vty_out(vty
, "%% Invalid hop count%s", VTY_NEWLINE
);
1179 return (CMD_SUCCESS
);
1183 vty_conf
= ldp_dup_config(ldpd_conf
);
1184 nbrp
= nbr_params_find(vty_conf
, lsr_id
);
1190 nbrp
->flags
&= ~(F_NBRP_GTSM
|F_NBRP_GTSM_HOPS
);
1191 nbrp
->gtsm_enabled
= 0;
1192 nbrp
->gtsm_hops
= 0;
1195 nbrp
= nbr_params_new(lsr_id
);
1196 LIST_INSERT_HEAD(&vty_conf
->nbrp_list
, nbrp
, entry
);
1199 nbrp
->flags
|= F_NBRP_GTSM
;
1200 nbrp
->flags
&= ~F_NBRP_GTSM_HOPS
;
1202 nbrp
->gtsm_enabled
= 1;
1203 nbrp
->gtsm_hops
= hops
;
1204 nbrp
->flags
|= F_NBRP_GTSM_HOPS
;
1206 nbrp
->gtsm_enabled
= 0;
1209 ldp_reload(vty_conf
);
1211 return (CMD_SUCCESS
);
1214 ldp_clear_config(vty_conf
);
1215 return (CMD_SUCCESS
);
1219 ldp_vty_l2vpn(struct vty
*vty
, struct vty_arg
*args
[])
1221 struct ldpd_conf
*vty_conf
;
1222 struct l2vpn
*l2vpn
;
1223 const char *name_str
;
1226 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1227 name_str
= vty_get_arg_value(args
, "name");
1229 vty_conf
= ldp_dup_config(ldpd_conf
);
1230 l2vpn
= l2vpn_find(vty_conf
, name_str
);
1236 LIST_REMOVE(l2vpn
, entry
);
1238 ldp_reload(vty_conf
);
1239 return (CMD_SUCCESS
);
1242 vty
->node
= LDP_L2VPN_NODE
;
1243 strlcpy(vty_l2vpn_name
, name_str
, sizeof(vty_l2vpn_name
));
1247 l2vpn
= l2vpn_new(name_str
);
1248 l2vpn
->type
= L2VPN_TYPE_VPLS
;
1249 LIST_INSERT_HEAD(&vty_conf
->l2vpn_list
, l2vpn
, entry
);
1251 ldp_reload(vty_conf
);
1253 return (CMD_SUCCESS
);
1256 ldp_clear_config(vty_conf
);
1257 return (CMD_SUCCESS
);
1261 ldp_vty_l2vpn_bridge(struct vty
*vty
, struct vty_arg
*args
[])
1263 struct ldpd_conf
*vty_conf
;
1264 struct l2vpn
*l2vpn
;
1268 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1269 ifname
= vty_get_arg_value(args
, "ifname");
1271 vty_conf
= ldp_dup_config(ldpd_conf
);
1272 l2vpn
= l2vpn_find(vty_conf
, vty_l2vpn_name
);
1275 memset(l2vpn
->br_ifname
, 0, sizeof(l2vpn
->br_ifname
));
1277 strlcpy(l2vpn
->br_ifname
, ifname
, sizeof(l2vpn
->br_ifname
));
1279 ldp_reload(vty_conf
);
1281 return (CMD_SUCCESS
);
1285 ldp_vty_l2vpn_mtu(struct vty
*vty
, struct vty_arg
*args
[])
1287 struct ldpd_conf
*vty_conf
;
1288 struct l2vpn
*l2vpn
;
1291 const char *mtu_str
;
1294 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1295 mtu_str
= vty_get_arg_value(args
, "mtu");
1297 mtu
= strtol(mtu_str
, &ep
, 10);
1298 if (*ep
!= '\0' || mtu
< MIN_L2VPN_MTU
|| mtu
> MAX_L2VPN_MTU
) {
1299 vty_out(vty
, "%% Invalid MTU%s", VTY_NEWLINE
);
1300 return (CMD_WARNING
);
1303 vty_conf
= ldp_dup_config(ldpd_conf
);
1304 l2vpn
= l2vpn_find(vty_conf
, vty_l2vpn_name
);
1307 l2vpn
->mtu
= DEFAULT_L2VPN_MTU
;
1311 ldp_reload(vty_conf
);
1313 return (CMD_SUCCESS
);
1317 ldp_vty_l2vpn_pwtype(struct vty
*vty
, struct vty_arg
*args
[])
1319 struct ldpd_conf
*vty_conf
;
1320 struct l2vpn
*l2vpn
;
1322 const char *type_str
;
1325 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1326 type_str
= vty_get_arg_value(args
, "type");
1328 if (strcmp(type_str
, "ethernet") == 0)
1329 pw_type
= PW_TYPE_ETHERNET
;
1331 pw_type
= PW_TYPE_ETHERNET_TAGGED
;
1333 vty_conf
= ldp_dup_config(ldpd_conf
);
1334 l2vpn
= l2vpn_find(vty_conf
, vty_l2vpn_name
);
1337 l2vpn
->pw_type
= DEFAULT_PW_TYPE
;
1339 l2vpn
->pw_type
= pw_type
;
1341 ldp_reload(vty_conf
);
1343 return (CMD_SUCCESS
);
1347 ldp_vty_l2vpn_interface(struct vty
*vty
, struct vty_arg
*args
[])
1349 struct ldpd_conf
*vty_conf
;
1350 struct l2vpn
*l2vpn
;
1351 struct l2vpn_if
*lif
;
1352 struct interface
*ifp
;
1357 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1358 ifname
= vty_get_arg_value(args
, "ifname");
1360 vty_conf
= ldp_dup_config(ldpd_conf
);
1361 l2vpn
= l2vpn_find(vty_conf
, vty_l2vpn_name
);
1362 lif
= l2vpn_if_find_name(l2vpn
, ifname
);
1368 LIST_REMOVE(lif
, entry
);
1370 ldp_reload(vty_conf
);
1371 return (CMD_SUCCESS
);
1377 if (ldp_iface_is_configured(vty_conf
, ifname
)) {
1378 vty_out(vty
, "%% Interface is already in use%s", VTY_NEWLINE
);
1382 ifp
= if_lookup_by_name(ifname
);
1383 memset(&kif
, 0, sizeof(kif
));
1384 strlcpy(kif
.ifname
, ifname
, sizeof(kif
.ifname
));
1386 kif
.ifindex
= ifp
->ifindex
;
1387 kif
.flags
= ifp
->flags
;
1390 lif
= l2vpn_if_new(l2vpn
, &kif
);
1391 LIST_INSERT_HEAD(&l2vpn
->if_list
, lif
, entry
);
1393 ldp_reload(vty_conf
);
1395 return (CMD_SUCCESS
);
1398 ldp_clear_config(vty_conf
);
1399 return (CMD_SUCCESS
);
1403 ldp_vty_l2vpn_pseudowire(struct vty
*vty
, struct vty_arg
*args
[])
1405 struct ldpd_conf
*vty_conf
;
1406 struct l2vpn
*l2vpn
;
1407 struct l2vpn_pw
*pw
;
1408 struct interface
*ifp
;
1413 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1414 ifname
= vty_get_arg_value(args
, "ifname");
1416 vty_conf
= ldp_dup_config(ldpd_conf
);
1417 l2vpn
= l2vpn_find(vty_conf
, vty_l2vpn_name
);
1418 pw
= l2vpn_pw_find_name(l2vpn
, ifname
);
1424 LIST_REMOVE(pw
, entry
);
1426 ldp_reload(vty_conf
);
1427 return (CMD_SUCCESS
);
1431 vty
->node
= LDP_PSEUDOWIRE_NODE
;
1432 strlcpy(vty_pw_ifname
, ifname
, sizeof(vty_pw_ifname
));
1436 if (ldp_iface_is_configured(vty_conf
, ifname
)) {
1437 vty_out(vty
, "%% Interface is already in use%s", VTY_NEWLINE
);
1441 ifp
= if_lookup_by_name(ifname
);
1442 memset(&kif
, 0, sizeof(kif
));
1443 strlcpy(kif
.ifname
, ifname
, sizeof(kif
.ifname
));
1445 kif
.ifindex
= ifp
->ifindex
;
1446 kif
.flags
= ifp
->flags
;
1449 pw
= l2vpn_pw_new(l2vpn
, &kif
);
1450 pw
->flags
= F_PW_STATUSTLV_CONF
|F_PW_CWORD_CONF
;
1451 LIST_INSERT_HEAD(&l2vpn
->pw_inactive_list
, pw
, entry
);
1453 ldp_reload(vty_conf
);
1455 vty
->node
= LDP_PSEUDOWIRE_NODE
;
1456 strlcpy(vty_pw_ifname
, ifname
, sizeof(vty_pw_ifname
));
1457 return (CMD_SUCCESS
);
1460 ldp_clear_config(vty_conf
);
1461 return (CMD_SUCCESS
);
1465 ldp_vty_l2vpn_pw_cword(struct vty
*vty
, struct vty_arg
*args
[])
1467 struct ldpd_conf
*vty_conf
;
1468 struct l2vpn
*l2vpn
;
1469 struct l2vpn_pw
*pw
;
1470 const char *preference_str
;
1473 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1474 preference_str
= vty_get_arg_value(args
, "preference");
1476 vty_conf
= ldp_dup_config(ldpd_conf
);
1477 l2vpn
= l2vpn_find(vty_conf
, vty_l2vpn_name
);
1478 pw
= l2vpn_pw_find_name(l2vpn
, vty_pw_ifname
);
1481 pw
->flags
|= F_PW_CWORD_CONF
;
1483 if (preference_str
[0] == 'e')
1484 pw
->flags
&= ~F_PW_CWORD_CONF
;
1486 pw
->flags
|= F_PW_CWORD_CONF
;
1489 ldp_reload(vty_conf
);
1491 return (CMD_SUCCESS
);
1495 ldp_vty_l2vpn_pw_nbr_addr(struct vty
*vty
, struct vty_arg
*args
[])
1497 struct ldpd_conf
*vty_conf
;
1498 struct l2vpn
*l2vpn
;
1499 struct l2vpn_pw
*pw
;
1501 union ldpd_addr addr
;
1502 const char *addr_str
;
1505 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1506 addr_str
= vty_get_arg_value(args
, "addr");
1508 if (ldp_get_address(addr_str
, &af
, &addr
) == -1 ||
1509 bad_addr(af
, &addr
)) {
1510 vty_out(vty
, "%% Malformed address%s", VTY_NEWLINE
);
1511 return (CMD_WARNING
);
1514 vty_conf
= ldp_dup_config(ldpd_conf
);
1515 l2vpn
= l2vpn_find(vty_conf
, vty_l2vpn_name
);
1516 pw
= l2vpn_pw_find_name(l2vpn
, vty_pw_ifname
);
1520 memset(&pw
->addr
, 0, sizeof(pw
->addr
));
1521 pw
->flags
&= ~F_PW_STATIC_NBR_ADDR
;
1525 pw
->flags
|= F_PW_STATIC_NBR_ADDR
;
1528 ldp_reload(vty_conf
);
1530 return (CMD_SUCCESS
);
1534 ldp_vty_l2vpn_pw_nbr_id(struct vty
*vty
, struct vty_arg
*args
[])
1536 struct ldpd_conf
*vty_conf
;
1537 struct l2vpn
*l2vpn
;
1538 struct l2vpn_pw
*pw
;
1539 struct in_addr lsr_id
;
1540 const char *lsr_id_str
;
1543 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1544 lsr_id_str
= vty_get_arg_value(args
, "lsr-id");
1546 if (inet_pton(AF_INET
, lsr_id_str
, &lsr_id
) != 1 ||
1547 bad_addr_v4(lsr_id
)) {
1548 vty_out(vty
, "%% Malformed address%s", VTY_NEWLINE
);
1549 return (CMD_WARNING
);
1552 vty_conf
= ldp_dup_config(ldpd_conf
);
1553 l2vpn
= l2vpn_find(vty_conf
, vty_l2vpn_name
);
1554 pw
= l2vpn_pw_find_name(l2vpn
, vty_pw_ifname
);
1557 pw
->lsr_id
.s_addr
= INADDR_ANY
;
1559 pw
->lsr_id
= lsr_id
;
1561 ldp_reload(vty_conf
);
1563 return (CMD_SUCCESS
);
1567 ldp_vty_l2vpn_pw_pwid(struct vty
*vty
, struct vty_arg
*args
[])
1569 struct ldpd_conf
*vty_conf
;
1570 struct l2vpn
*l2vpn
;
1571 struct l2vpn_pw
*pw
;
1574 const char *pwid_str
;
1577 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1578 pwid_str
= vty_get_arg_value(args
, "pwid");
1580 pwid
= strtol(pwid_str
, &ep
, 10);
1581 if (*ep
!= '\0' || pwid
< MIN_PWID_ID
|| pwid
> MAX_PWID_ID
) {
1582 vty_out(vty
, "%% Invalid pw-id%s", VTY_NEWLINE
);
1583 return (CMD_WARNING
);
1586 vty_conf
= ldp_dup_config(ldpd_conf
);
1587 l2vpn
= l2vpn_find(vty_conf
, vty_l2vpn_name
);
1588 pw
= l2vpn_pw_find_name(l2vpn
, vty_pw_ifname
);
1595 ldp_reload(vty_conf
);
1597 return (CMD_SUCCESS
);
1601 ldp_vty_l2vpn_pw_pwstatus(struct vty
*vty
, struct vty_arg
*args
[])
1603 struct ldpd_conf
*vty_conf
;
1604 struct l2vpn
*l2vpn
;
1605 struct l2vpn_pw
*pw
;
1608 disable
= (vty_get_arg_value(args
, "no")) ? 1 : 0;
1610 vty_conf
= ldp_dup_config(ldpd_conf
);
1611 l2vpn
= l2vpn_find(vty_conf
, vty_l2vpn_name
);
1612 pw
= l2vpn_pw_find_name(l2vpn
, vty_pw_ifname
);
1615 pw
->flags
|= F_PW_STATUSTLV_CONF
;
1617 pw
->flags
&= ~F_PW_STATUSTLV_CONF
;
1619 ldp_reload(vty_conf
);
1621 return (CMD_SUCCESS
);
1625 ldp_vty_if_init(void)
1627 /* Install interface node. */
1628 install_node (&interface_node
, interface_config_write
);
1630 install_element(CONFIG_NODE
, &interface_cmd
);
1631 install_element(CONFIG_NODE
, &no_interface_cmd
);
1632 install_default(INTERFACE_NODE
);
1634 /* "description" commands. */
1635 install_element(INTERFACE_NODE
, &interface_desc_cmd
);
1636 install_element(INTERFACE_NODE
, &no_interface_desc_cmd
);