1 // SPDX-License-Identifier: ISC
5 * Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
6 * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
7 * Copyright (c) 2004 Esben Norby <norby@openbsd.org>
8 * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
15 #include "openbsd-tree.h"
26 #include "lib/ldp_sync.h"
28 #define CONF_FILE "/etc/ldpd.conf"
29 #define LDPD_USER "_ldpd"
31 #define LDPD_FD_ASYNC 3
32 #define LDPD_FD_SYNC 4
34 #define LDPD_OPT_VERBOSE 0x00000001
35 #define LDPD_OPT_VERBOSE2 0x00000002
36 #define LDPD_OPT_NOACTION 0x00000004
38 #define TCP_MD5_KEY_LEN 80
40 #define RT_BUF_SIZE 16384
41 #define MAX_RTSOCK_BUF 128 * 1024
42 #define LDP_BACKLOG 128
44 #define F_LDPD_INSERTED 0x0001
45 #define F_CONNECTED 0x0002
46 #define F_STATIC 0x0004
47 #define F_DYNAMIC 0x0008
48 #define F_REJECT 0x0010
49 #define F_BLACKHOLE 0x0020
50 #define F_REDISTRIBUTED 0x0040
55 void (*handler
)(struct thread
*);
61 void (*handler_write
)(struct thread
*);
62 struct thread
*ev_write
;
63 void (*handler_read
)(struct thread
*);
64 struct thread
*ev_read
;
70 IMSG_CTL_SHOW_INTERFACE
,
71 IMSG_CTL_SHOW_DISCOVERY
,
72 IMSG_CTL_SHOW_DISCOVERY_DTL
,
73 IMSG_CTL_SHOW_DISC_IFACE
,
74 IMSG_CTL_SHOW_DISC_TNBR
,
75 IMSG_CTL_SHOW_DISC_ADJ
,
77 IMSG_CTL_SHOW_NBR_DISC
,
78 IMSG_CTL_SHOW_NBR_END
,
80 IMSG_CTL_SHOW_LIB_BEGIN
,
81 IMSG_CTL_SHOW_LIB_SENT
,
82 IMSG_CTL_SHOW_LIB_RCVD
,
83 IMSG_CTL_SHOW_LIB_END
,
84 IMSG_CTL_SHOW_L2VPN_PW
,
85 IMSG_CTL_SHOW_L2VPN_BINDING
,
86 IMSG_CTL_SHOW_LDP_SYNC
,
89 IMSG_CTL_FIB_DECOUPLE
,
106 IMSG_LABEL_MAPPING_FULL
,
112 IMSG_REQUEST_ADD_END
,
114 IMSG_MAPPING_ADD_END
,
116 IMSG_RELEASE_ADD_END
,
118 IMSG_WITHDRAW_ADD_END
,
122 IMSG_NOTIFICATION_SEND
,
130 IMSG_REQUEST_SOCKETS
,
137 IMSG_RECONF_L2VPN_IF
,
138 IMSG_RECONF_L2VPN_PW
,
139 IMSG_RECONF_L2VPN_IPW
,
148 IMSG_LDP_SYNC_IF_STATE_REQUEST
,
149 IMSG_LDP_SYNC_IF_STATE_UPDATE
,
159 char ctl_sock_path
[MAXPATHLEN
];
160 char zclient_serv_path
[MAXPATHLEN
];
161 unsigned short instance
;
165 char name
[ACL_NAMSIZ
];
173 #define IN6_IS_SCOPE_EMBED(a) \
174 ((IN6_IS_ADDR_LINKLOCAL(a)) || \
175 (IN6_IS_ADDR_MC_LINKLOCAL(a)) || \
176 (IN6_IS_ADDR_MC_INTFACELOCAL(a)))
178 /* interface states */
179 #define IF_STA_DOWN 0x01
180 #define IF_STA_ACTIVE 0x02
182 /* targeted neighbor states */
183 #define TNBR_STA_DOWN 0x01
184 #define TNBR_STA_ACTIVE 0x02
186 /* interface types */
192 /* neighbor states */
193 #define NBR_STA_PRESENT 0x0001
194 #define NBR_STA_INITIAL 0x0002
195 #define NBR_STA_OPENREC 0x0004
196 #define NBR_STA_OPENSENT 0x0008
197 #define NBR_STA_OPER 0x0010
198 #define NBR_STA_SESSION (NBR_STA_INITIAL | NBR_STA_OPENREC | \
199 NBR_STA_OPENSENT | NBR_STA_OPER)
201 /* neighbor events */
206 NBR_EVT_CLOSE_SESSION
,
208 NBR_EVT_KEEPALIVE_RCVD
,
214 /* neighbor actions */
217 NBR_ACT_RST_KTIMEOUT
,
220 NBR_ACT_CONNECT_SETUP
,
221 NBR_ACT_PASSIVE_INIT
,
222 NBR_ACT_KEEPALIVE_SEND
,
223 NBR_ACT_CLOSE_SESSION
226 /* LDP IGP Sync states */
227 #define LDP_SYNC_STA_UNKNOWN 0x0000
228 #define LDP_SYNC_STA_NOT_ACH 0x0001
229 #define LDP_SYNC_STA_ACH 0x0002
231 /* LDP IGP Sync events */
232 enum ldp_sync_event
{
233 LDP_SYNC_EVT_NOTHING
,
234 LDP_SYNC_EVT_LDP_SYNC_START
,
235 LDP_SYNC_EVT_LDP_SYNC_COMPLETE
,
236 LDP_SYNC_EVT_CONFIG_LDP_OFF
,
237 LDP_SYNC_EVT_ADJ_DEL
,
238 LDP_SYNC_EVT_ADJ_NEW
,
239 LDP_SYNC_EVT_SESSION_CLOSE
,
240 LDP_SYNC_EVT_CONFIG_LDP_ON
,
241 LDP_SYNC_EVT_IFACE_SHUTDOWN
244 /* LDP IGP Sync actions */
245 enum ldp_sync_action
{
246 LDP_SYNC_ACT_NOTHING
,
247 LDP_SYNC_ACT_IFACE_START_SYNC
,
248 LDP_SYNC_ACT_LDP_START_SYNC
,
249 LDP_SYNC_ACT_LDP_COMPLETE_SYNC
,
250 LDP_SYNC_ACT_CONFIG_LDP_OFF
,
251 LDP_SYNC_ACT_IFACE_SHUTDOWN
254 /* forward declarations */
255 RB_HEAD(global_adj_head
, adj
);
256 RB_HEAD(nbr_adj_head
, adj
);
257 RB_HEAD(ia_adj_head
, adj
);
265 union ldpd_addr prefix
;
283 uint32_t status_code
;
292 #define F_MAP_REQ_ID 0x01 /* optional request message id present */
293 #define F_MAP_STATUS 0x02 /* status */
294 #define F_MAP_PW_CWORD 0x04 /* pseudowire control word */
295 #define F_MAP_PW_ID 0x08 /* pseudowire connection id */
296 #define F_MAP_PW_IFMTU 0x10 /* pseudowire interface parameter */
297 #define F_MAP_PW_STATUS 0x20 /* pseudowire status */
300 uint32_t status_code
;
301 uint32_t msg_id
; /* network byte order */
302 uint16_t msg_type
; /* network byte order */
312 #define F_NOTIF_PW_STATUS 0x01 /* pseudowire status tlv present */
313 #define F_NOTIF_FEC 0x02 /* fec tlv present */
314 #define F_NOTIF_RETURNED_TLVS 0x04 /* returned tlvs present */
317 LIST_ENTRY(if_addr
) entry
;
319 union ldpd_addr addr
;
321 union ldpd_addr dstbrd
;
323 LIST_HEAD(if_addr_head
, if_addr
);
330 struct ia_adj_head adj_tree
;
332 struct thread
*hello_timer
;
333 uint16_t hello_holdtime
;
334 uint16_t hello_interval
;
337 struct iface_ldp_sync
{
339 struct thread
*wait_for_sync_timer
;
343 RB_ENTRY(iface
) entry
;
344 char name
[INTERFACE_NAMSIZ
];
346 struct if_addr_head addr_list
;
347 struct in6_addr linklocal
;
348 enum iface_type type
;
350 struct iface_af ipv4
;
351 struct iface_af ipv6
;
352 struct iface_ldp_sync ldp_sync
;
355 RB_HEAD(iface_head
, iface
);
356 RB_PROTOTYPE(iface_head
, iface
, entry
, iface_compare
);
357 DECLARE_QOBJ_TYPE(iface
);
359 /* source of targeted hellos */
361 RB_ENTRY(tnbr
) entry
;
362 struct thread
*hello_timer
;
365 union ldpd_addr addr
;
372 RB_HEAD(tnbr_head
, tnbr
);
373 RB_PROTOTYPE(tnbr_head
, tnbr
, entry
, tnbr_compare
);
374 DECLARE_QOBJ_TYPE(tnbr
);
375 #define F_TNBR_CONFIGURED 0x01
376 #define F_TNBR_DYNAMIC 0x02
383 /* neighbor specific parameters */
385 RB_ENTRY(nbr_params
) entry
;
386 struct in_addr lsr_id
;
391 enum auth_method method
;
392 char md5key
[TCP_MD5_KEY_LEN
];
398 RB_HEAD(nbrp_head
, nbr_params
);
399 RB_PROTOTYPE(nbrp_head
, nbr_params
, entry
, nbr_params_compare
);
400 DECLARE_QOBJ_TYPE(nbr_params
);
401 #define F_NBRP_KEEPALIVE 0x01
402 #define F_NBRP_GTSM 0x02
403 #define F_NBRP_GTSM_HOPS 0x04
406 uint32_t kalive_sent
;
407 uint32_t kalive_rcvd
;
410 uint32_t addrwdraw_sent
;
411 uint32_t addrwdraw_rcvd
;
414 uint32_t capability_sent
;
415 uint32_t capability_rcvd
;
416 uint32_t labelmap_sent
;
417 uint32_t labelmap_rcvd
;
418 uint32_t labelreq_sent
;
419 uint32_t labelreq_rcvd
;
420 uint32_t labelwdraw_sent
;
421 uint32_t labelwdraw_rcvd
;
422 uint32_t labelrel_sent
;
423 uint32_t labelrel_rcvd
;
424 uint32_t labelabreq_sent
;
425 uint32_t labelabreq_rcvd
;
426 uint32_t unknown_tlv
;
427 uint32_t unknown_msg
;
431 struct ldp_entity_stats
{
432 uint32_t session_attempts
;
433 uint32_t session_rejects_hello
;
434 uint32_t session_rejects_ad
;
435 uint32_t session_rejects_max_pdu
;
436 uint32_t session_rejects_lr
;
438 uint32_t bad_pdu_len
;
439 uint32_t bad_msg_len
;
440 uint32_t bad_tlv_len
;
441 uint32_t malformed_tlv
;
442 uint32_t keepalive_timer_exp
;
443 uint32_t shutdown_rcv_notify
;
444 uint32_t shutdown_send_notify
;
448 RB_ENTRY(l2vpn_if
) entry
;
450 char ifname
[INTERFACE_NAMSIZ
];
453 uint8_t mac
[ETH_ALEN
];
456 RB_HEAD(l2vpn_if_head
, l2vpn_if
);
457 RB_PROTOTYPE(l2vpn_if_head
, l2vpn_if
, entry
, l2vpn_if_compare
);
458 DECLARE_QOBJ_TYPE(l2vpn_if
);
461 RB_ENTRY(l2vpn_pw
) entry
;
463 struct in_addr lsr_id
;
465 union ldpd_addr addr
;
467 char ifname
[INTERFACE_NAMSIZ
];
470 uint32_t remote_group
;
472 uint32_t local_status
;
473 uint32_t remote_status
;
478 RB_HEAD(l2vpn_pw_head
, l2vpn_pw
);
479 RB_PROTOTYPE(l2vpn_pw_head
, l2vpn_pw
, entry
, l2vpn_pw_compare
);
480 DECLARE_QOBJ_TYPE(l2vpn_pw
);
481 #define F_PW_STATUSTLV_CONF 0x01 /* status tlv configured */
482 #define F_PW_STATUSTLV 0x02 /* status tlv negotiated */
483 #define F_PW_CWORD_CONF 0x04 /* control word configured */
484 #define F_PW_CWORD 0x08 /* control word negotiated */
485 #define F_PW_STATIC_NBR_ADDR 0x10 /* static neighbor address configured */
487 #define F_PW_NO_ERR 0x00 /* no error reported */
488 #define F_PW_LOCAL_NOT_FWD 0x01 /* locally can't forward over PW */
489 #define F_PW_REMOTE_NOT_FWD 0x02 /* remote end of PW reported fwd error*/
490 #define F_PW_NO_REMOTE_LABEL 0x03 /* have not recvd label from peer */
491 #define F_PW_MTU_MISMATCH 0x04 /* mtu mismatch between peers */
494 RB_ENTRY(l2vpn
) entry
;
495 char name
[L2VPN_NAME_LEN
];
499 char br_ifname
[INTERFACE_NAMSIZ
];
500 ifindex_t br_ifindex
;
501 struct l2vpn_if_head if_tree
;
502 struct l2vpn_pw_head pw_tree
;
503 struct l2vpn_pw_head pw_inactive_tree
;
506 RB_HEAD(l2vpn_head
, l2vpn
);
507 RB_PROTOTYPE(l2vpn_head
, l2vpn
, entry
, l2vpn_compare
);
508 DECLARE_QOBJ_TYPE(l2vpn
);
509 #define L2VPN_TYPE_VPWS 1
510 #define L2VPN_TYPE_VPLS 2
513 extern enum ldpd_process
{
519 static const char * const log_procnames
[] = {
536 struct ldpd_af_conf
{
538 uint16_t lhello_holdtime
;
539 uint16_t lhello_interval
;
540 uint16_t thello_holdtime
;
541 uint16_t thello_interval
;
542 union ldpd_addr trans_addr
;
543 char acl_thello_accept_from
[ACL_NAMSIZ
];
544 char acl_label_allocate_for
[ACL_NAMSIZ
];
545 char acl_label_advertise_to
[ACL_NAMSIZ
];
546 char acl_label_advertise_for
[ACL_NAMSIZ
];
547 char acl_label_expnull_for
[ACL_NAMSIZ
];
548 char acl_label_accept_from
[ACL_NAMSIZ
];
549 char acl_label_accept_for
[ACL_NAMSIZ
];
552 #define F_LDPD_AF_ENABLED 0x0001
553 #define F_LDPD_AF_THELLO_ACCEPT 0x0002
554 #define F_LDPD_AF_EXPNULL 0x0004
555 #define F_LDPD_AF_NO_GTSM 0x0008
556 #define F_LDPD_AF_ALLOCHOSTONLY 0x0010
559 struct in_addr rtr_id
;
560 struct ldpd_af_conf ipv4
;
561 struct ldpd_af_conf ipv6
;
562 struct iface_head iface_tree
;
563 struct tnbr_head tnbr_tree
;
564 struct nbrp_head nbrp_tree
;
565 struct l2vpn_head l2vpn_tree
;
566 uint16_t lhello_holdtime
;
567 uint16_t lhello_interval
;
568 uint16_t thello_holdtime
;
569 uint16_t thello_interval
;
571 uint16_t wait_for_sync_interval
;
573 time_t config_change_time
;
574 struct ldp_entity_stats stats
;
577 DECLARE_QOBJ_TYPE(ldpd_conf
);
578 #define F_LDPD_NO_FIB_UPDATE 0x0001
579 #define F_LDPD_DS_CISCO_INTEROP 0x0002
580 #define F_LDPD_ENABLED 0x0004
581 #define F_LDPD_ORDERED_CONTROL 0x0008
582 #define F_LDPD_ALLOW_BROKEN_LSP 0x0010
584 struct ldpd_af_global
{
585 struct thread
*disc_ev
;
586 struct thread
*edisc_ev
;
588 int ldp_edisc_socket
;
589 int ldp_session_socket
;
594 struct in_addr rtr_id
;
595 struct ldpd_af_global ipv4
;
596 struct ldpd_af_global ipv6
;
597 uint32_t conf_seqnum
;
599 struct if_addr_head addr_list
;
600 struct global_adj_head adj_tree
;
601 struct in_addr mcast_addr_v4
;
602 struct in6_addr mcast_addr_v6
;
603 TAILQ_HEAD(, pending_conn
) pending_conns
;
609 union ldpd_addr prefix
;
611 union ldpd_addr nexthop
;
612 uint32_t local_label
;
613 uint32_t remote_label
;
616 uint8_t route_instance
;
621 char ifname
[INTERFACE_NAMSIZ
];
624 union ldpd_addr addr
;
626 union ldpd_addr dstbrd
;
630 char ifname
[INTERFACE_NAMSIZ
];
634 uint8_t mac
[ETH_ALEN
];
639 char acl
[ACL_NAMSIZ
];
641 union ldpd_addr addr
;
645 /* control data structures */
648 char name
[INTERFACE_NAMSIZ
];
651 enum iface_type type
;
652 uint16_t hello_holdtime
;
653 uint16_t hello_interval
;
659 char name
[INTERFACE_NAMSIZ
];
665 struct ctl_disc_tnbr
{
667 union ldpd_addr addr
;
674 enum hello_type type
;
675 char ifname
[INTERFACE_NAMSIZ
];
676 union ldpd_addr src_addr
;
678 uint16_t holdtime_remaining
;
679 union ldpd_addr trans_addr
;
686 union ldpd_addr laddr
;
688 union ldpd_addr raddr
;
690 enum auth_method auth_method
;
694 struct ldp_stats stats
;
696 uint16_t max_pdu_len
;
697 uint16_t hold_time_remaining
;
702 union ldpd_addr prefix
;
704 struct in_addr nexthop
; /* lsr-id */
705 uint32_t local_label
;
706 uint32_t remote_label
;
714 char l2vpn_name
[L2VPN_NAME_LEN
];
715 char ifname
[INTERFACE_NAMSIZ
];
717 struct in_addr lsr_id
;
718 uint32_t local_label
;
720 uint16_t local_ifmtu
;
722 uint32_t remote_label
;
724 uint16_t remote_ifmtu
;
725 uint8_t remote_cword
;
730 struct ctl_ldp_sync
{
731 char name
[INTERFACE_NAMSIZ
];
736 uint16_t wait_time_remaining
;
737 struct in_addr peer_ldp_id
;
740 extern struct ldpd_conf
*ldpd_conf
, *vty_conf
;
741 extern struct ldpd_global global
;
742 extern struct ldpd_init init
;
745 struct ldpd_conf
*parse_config(char *);
746 int cmdline_symset(char *);
749 void pw2zpw(struct l2vpn_pw
*, struct zapi_pw
*);
750 void kif_redistribute(const char *);
751 int kr_change(struct kroute
*);
752 int kr_delete(struct kroute
*);
753 int kmpw_add(struct zapi_pw
*);
754 int kmpw_del(struct zapi_pw
*);
755 int kmpw_set(struct zapi_pw
*);
756 int kmpw_unset(struct zapi_pw
*);
759 uint8_t mask2prefixlen(in_addr_t
);
760 uint8_t mask2prefixlen6(struct sockaddr_in6
*);
761 in_addr_t
prefixlen2mask(uint8_t);
762 struct in6_addr
*prefixlen2mask6(uint8_t);
763 void ldp_applymask(int, union ldpd_addr
*,
764 const union ldpd_addr
*, int);
765 int ldp_addrcmp(int, const union ldpd_addr
*,
766 const union ldpd_addr
*);
767 int ldp_addrisset(int, const union ldpd_addr
*);
768 int ldp_prefixcmp(int, const union ldpd_addr
*,
769 const union ldpd_addr
*, uint8_t);
770 int bad_addr_v4(struct in_addr
);
771 int bad_addr_v6(struct in6_addr
*);
772 int bad_addr(int, union ldpd_addr
*);
773 void embedscope(struct sockaddr_in6
*);
774 void recoverscope(struct sockaddr_in6
*);
775 void addscope(struct sockaddr_in6
*, uint32_t);
776 void clearscope(struct in6_addr
*);
777 void addr2sa(int af
, const union ldpd_addr
*, uint16_t,
778 union sockunion
*su
);
779 void sa2addr(struct sockaddr
*, int *, union ldpd_addr
*,
781 socklen_t
sockaddr_len(struct sockaddr
*);
784 void ldp_write_handler(struct thread
*thread
);
785 void main_imsg_compose_ldpe(int, pid_t
, void *, uint16_t);
786 void main_imsg_compose_lde(int, pid_t
, void *, uint16_t);
787 int main_imsg_compose_both(enum imsg_type
, void *,
789 void imsg_event_add(struct imsgev
*);
790 int imsg_compose_event(struct imsgev
*, uint16_t, uint32_t,
791 pid_t
, int, void *, uint16_t);
792 void evbuf_enqueue(struct evbuf
*, struct ibuf
*);
793 void evbuf_event_add(struct evbuf
*);
794 void evbuf_init(struct evbuf
*, int, void (*)(struct thread
*), void *);
795 void evbuf_clear(struct evbuf
*);
796 int ldp_acl_request(struct imsgev
*, char *, int,
797 union ldpd_addr
*, uint8_t);
798 void ldp_acl_reply(struct imsgev
*, struct acl_check
*);
799 struct ldpd_af_conf
*ldp_af_conf_get(struct ldpd_conf
*, int);
800 struct ldpd_af_global
*ldp_af_global_get(struct ldpd_global
*, int);
801 int ldp_is_dual_stack(struct ldpd_conf
*);
802 in_addr_t
ldp_rtr_id_get(struct ldpd_conf
*);
803 int ldp_config_apply(struct vty
*, struct ldpd_conf
*);
804 void ldp_clear_config(struct ldpd_conf
*);
805 void merge_config(struct ldpd_conf
*, struct ldpd_conf
*);
806 struct ldpd_conf
*config_new_empty(void);
807 void config_clear(struct ldpd_conf
*);
810 /* NOTE: the parameters' names should be preserved because of codegen */
811 struct iface
*iface_new_api(struct ldpd_conf
*conf
,
813 void iface_del_api(struct ldpd_conf
*conf
,
814 struct iface
*iface
);
815 struct tnbr
*tnbr_new_api(struct ldpd_conf
*conf
, int af
,
816 union ldpd_addr
*addr
);
817 void tnbr_del_api(struct ldpd_conf
*conf
, struct tnbr
*tnbr
);
818 struct nbr_params
*nbrp_new_api(struct ldpd_conf
*conf
,
819 struct in_addr lsr_id
);
820 void nbrp_del_api(struct ldpd_conf
*conf
,
821 struct nbr_params
*nbrp
);
822 struct l2vpn
*l2vpn_new_api(struct ldpd_conf
*conf
, const char *name
);
823 void l2vpn_del_api(struct ldpd_conf
*conf
,
824 struct l2vpn
*l2vpn
);
825 struct l2vpn_if
*l2vpn_if_new_api(struct ldpd_conf
*conf
,
826 struct l2vpn
*l2vpn
, const char *ifname
);
827 void l2vpn_if_del_api(struct l2vpn
*l2vpn
,
828 struct l2vpn_if
*lif
);
829 struct l2vpn_pw
*l2vpn_pw_new_api(struct ldpd_conf
*conf
,
830 struct l2vpn
*l2vpn
, const char *ifname
);
831 void l2vpn_pw_del_api(struct l2vpn
*l2vpn
,
832 struct l2vpn_pw
*pw
);
835 int ldp_create_socket(int, enum socket_type
);
836 void sock_set_nonblock(int);
837 void sock_set_cloexec(int);
838 void sock_set_recvbuf(int);
839 int sock_set_reuse(int, int);
840 int sock_set_bindany(int, int);
841 int sock_set_md5sig(int, int, union ldpd_addr
*, const char *);
842 int sock_set_ipv4_tos(int, int);
843 int sock_set_ipv4_pktinfo(int, int);
844 int sock_set_ipv4_recvdstaddr(int fd
, ifindex_t ifindex
);
845 int sock_set_ipv4_recvif(int, int);
846 int sock_set_ipv4_minttl(int, int);
847 int sock_set_ipv4_ucast_ttl(int fd
, int);
848 int sock_set_ipv4_mcast_ttl(int, uint8_t);
849 int sock_set_ipv4_mcast(struct iface
*);
850 int sock_set_ipv4_mcast_loop(int);
851 int sock_set_ipv6_dscp(int, int);
852 int sock_set_ipv6_pktinfo(int, int);
853 int sock_set_ipv6_minhopcount(int, int);
854 int sock_set_ipv6_ucast_hops(int, int);
855 int sock_set_ipv6_mcast_hops(int, int);
856 int sock_set_ipv6_mcast(struct iface
*);
857 int sock_set_ipv6_mcast_loop(int);
865 const char *log_sockaddr(void *);
866 const char *log_in6addr(const struct in6_addr
*);
867 const char *log_in6addr_scope(const struct in6_addr
*addr
,
869 const char *log_addr(int, const union ldpd_addr
*);
870 char *log_label(uint32_t);
871 const char *log_time(time_t);
872 char *log_hello_src(const struct hello_source
*);
873 const char *log_map(const struct map
*);
874 const char *log_fec(const struct fec
*);
875 const char *af_name(int);
876 const char *socket_name(int);
877 const char *nbr_state_name(int);
878 const char *if_state_name(int);
879 const char *if_type_name(enum iface_type
);
880 const char *msg_name(uint16_t);
881 const char *status_code_name(uint32_t);
882 const char *pw_type_name(uint16_t);
883 const char *pw_error_code(uint8_t);
886 extern struct thread_master
*master
;
887 extern char ctl_sock_path
[MAXPATHLEN
];
890 void ldp_zebra_init(struct thread_master
*);
891 void ldp_zebra_destroy(void);
892 int ldp_sync_zebra_send_state_update(struct ldp_igp_sync_if_state
*);
893 int ldp_zebra_send_rlfa_labels(struct zapi_rlfa_response
*
896 void ldp_zebra_regdereg_zebra_info(bool want_register
);
900 #define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
901 #define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
902 #define IN6_IS_ADDR_MC_INTFACELOCAL(a) \
903 (IN6_IS_ADDR_MULTICAST(a) && \
904 (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_INTFACELOCAL))
907 DECLARE_HOOK(ldp_register_mib
, (struct thread_master
* tm
), (tm
));
909 extern void ldp_agentx_enabled(void);
911 #endif /* _LDPD_H_ */