xref: /openbsd/usr.sbin/ldpd/ldpd.h (revision 4ff910d1)
1 /*	$OpenBSD: ldpd.h,v 1.92 2021/01/19 15:59:25 claudio Exp $ */
2 
3 /*
4  * Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
5  * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
6  * Copyright (c) 2004 Esben Norby <norby@openbsd.org>
7  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
8  *
9  * Permission to use, copy, modify, and distribute this software for any
10  * purpose with or without fee is hereby granted, provided that the above
11  * copyright notice and this permission notice appear in all copies.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 #ifndef _LDPD_H_
23 #define _LDPD_H_
24 
25 #include <sys/types.h>
26 #include <sys/socket.h>
27 #include <sys/queue.h>
28 #include <sys/tree.h>
29 #include <net/if_arp.h>
30 #include <net/if.h>
31 #include <netinet/in.h>
32 #include <netinet/if_ether.h>
33 #include <event.h>
34 #include <imsg.h>
35 
36 #include "ldp.h"
37 
38 #define CONF_FILE		"/etc/ldpd.conf"
39 #define	LDPD_SOCKET		"/var/run/ldpd.sock"
40 #define LDPD_USER		"_ldpd"
41 
42 #define LDPD_OPT_VERBOSE	0x00000001
43 #define LDPD_OPT_VERBOSE2	0x00000002
44 #define LDPD_OPT_NOACTION	0x00000004
45 
46 #define TCP_MD5_KEY_LEN		80
47 #define L2VPN_NAME_LEN		32
48 
49 #define	READ_BUF_SIZE		65535
50 #define	RT_BUF_SIZE		16384
51 #define	MAX_RTSOCK_BUF		(2 * 1024 * 1024)
52 #define	LDP_BACKLOG		128
53 
54 #define	F_LDPD_INSERTED		0x0001
55 #define	F_CONNECTED		0x0002
56 #define	F_STATIC		0x0004
57 #define	F_DYNAMIC		0x0008
58 #define	F_REJECT		0x0010
59 #define	F_BLACKHOLE		0x0020
60 #define	F_REDISTRIBUTED		0x0040
61 
62 struct evbuf {
63 	struct msgbuf		wbuf;
64 	struct event		ev;
65 };
66 
67 struct imsgev {
68 	struct imsgbuf		 ibuf;
69 	void			(*handler)(int, short, void *);
70 	struct event		 ev;
71 	short			 events;
72 };
73 
74 enum imsg_type {
75 	IMSG_NONE,
76 	IMSG_CTL_RELOAD,
77 	IMSG_CTL_SHOW_INTERFACE,
78 	IMSG_CTL_SHOW_DISCOVERY,
79 	IMSG_CTL_SHOW_NBR,
80 	IMSG_CTL_SHOW_LIB,
81 	IMSG_CTL_SHOW_L2VPN_PW,
82 	IMSG_CTL_SHOW_L2VPN_BINDING,
83 	IMSG_CTL_CLEAR_NBR,
84 	IMSG_CTL_FIB_COUPLE,
85 	IMSG_CTL_FIB_DECOUPLE,
86 	IMSG_CTL_KROUTE,
87 	IMSG_CTL_KROUTE_ADDR,
88 	IMSG_CTL_IFINFO,
89 	IMSG_CTL_END,
90 	IMSG_CTL_LOG_VERBOSE,
91 	IMSG_KLABEL_CHANGE,
92 	IMSG_KLABEL_DELETE,
93 	IMSG_KPWLABEL_CHANGE,
94 	IMSG_KPWLABEL_DELETE,
95 	IMSG_IFSTATUS,
96 	IMSG_NEWADDR,
97 	IMSG_DELADDR,
98 	IMSG_LABEL_MAPPING,
99 	IMSG_LABEL_MAPPING_FULL,
100 	IMSG_LABEL_REQUEST,
101 	IMSG_LABEL_RELEASE,
102 	IMSG_LABEL_WITHDRAW,
103 	IMSG_LABEL_ABORT,
104 	IMSG_REQUEST_ADD,
105 	IMSG_REQUEST_ADD_END,
106 	IMSG_MAPPING_ADD,
107 	IMSG_MAPPING_ADD_END,
108 	IMSG_RELEASE_ADD,
109 	IMSG_RELEASE_ADD_END,
110 	IMSG_WITHDRAW_ADD,
111 	IMSG_WITHDRAW_ADD_END,
112 	IMSG_ADDRESS_ADD,
113 	IMSG_ADDRESS_DEL,
114 	IMSG_NOTIFICATION,
115 	IMSG_NOTIFICATION_SEND,
116 	IMSG_NEIGHBOR_UP,
117 	IMSG_NEIGHBOR_DOWN,
118 	IMSG_NETWORK_ADD,
119 	IMSG_NETWORK_DEL,
120 	IMSG_SOCKET_IPC,
121 	IMSG_SOCKET_NET,
122 	IMSG_CLOSE_SOCKETS,
123 	IMSG_REQUEST_SOCKETS,
124 	IMSG_SETUP_SOCKETS,
125 	IMSG_RECONF_CONF,
126 	IMSG_RECONF_IFACE,
127 	IMSG_RECONF_TNBR,
128 	IMSG_RECONF_NBRP,
129 	IMSG_RECONF_L2VPN,
130 	IMSG_RECONF_L2VPN_IF,
131 	IMSG_RECONF_L2VPN_PW,
132 	IMSG_RECONF_CONF_AUTH,
133 	IMSG_RECONF_END
134 };
135 
136 union ldpd_addr {
137 	struct in_addr	v4;
138 	struct in6_addr	v6;
139 };
140 
141 #define IN6_IS_SCOPE_EMBED(a)   \
142 	((IN6_IS_ADDR_LINKLOCAL(a)) ||  \
143 	 (IN6_IS_ADDR_MC_LINKLOCAL(a)) || \
144 	 (IN6_IS_ADDR_MC_INTFACELOCAL(a)))
145 
146 /* interface states */
147 #define	IF_STA_DOWN		0x01
148 #define	IF_STA_ACTIVE		0x02
149 
150 /* targeted neighbor states */
151 #define	TNBR_STA_DOWN		0x01
152 #define	TNBR_STA_ACTIVE		0x02
153 
154 /* interface types */
155 enum iface_type {
156 	IF_TYPE_POINTOPOINT,
157 	IF_TYPE_BROADCAST
158 };
159 
160 /* neighbor states */
161 #define	NBR_STA_PRESENT		0x0001
162 #define	NBR_STA_INITIAL		0x0002
163 #define	NBR_STA_OPENREC		0x0004
164 #define	NBR_STA_OPENSENT	0x0008
165 #define	NBR_STA_OPER		0x0010
166 #define	NBR_STA_SESSION		(NBR_STA_INITIAL | NBR_STA_OPENREC | \
167 				NBR_STA_OPENSENT | NBR_STA_OPER)
168 
169 /* neighbor events */
170 enum nbr_event {
171 	NBR_EVT_NOTHING,
172 	NBR_EVT_MATCH_ADJ,
173 	NBR_EVT_CONNECT_UP,
174 	NBR_EVT_CLOSE_SESSION,
175 	NBR_EVT_INIT_RCVD,
176 	NBR_EVT_KEEPALIVE_RCVD,
177 	NBR_EVT_PDU_RCVD,
178 	NBR_EVT_PDU_SENT,
179 	NBR_EVT_INIT_SENT
180 };
181 
182 /* neighbor actions */
183 enum nbr_action {
184 	NBR_ACT_NOTHING,
185 	NBR_ACT_RST_KTIMEOUT,
186 	NBR_ACT_SESSION_EST,
187 	NBR_ACT_RST_KTIMER,
188 	NBR_ACT_CONNECT_SETUP,
189 	NBR_ACT_PASSIVE_INIT,
190 	NBR_ACT_KEEPALIVE_SEND,
191 	NBR_ACT_CLOSE_SESSION
192 };
193 
194 TAILQ_HEAD(mapping_head, mapping_entry);
195 
196 struct map {
197 	uint8_t		type;
198 	uint32_t	msg_id;
199 	union {
200 		struct {
201 			uint16_t	af;
202 			union ldpd_addr	prefix;
203 			uint8_t		prefixlen;
204 		} prefix;
205 		struct {
206 			uint16_t	type;
207 			uint32_t	pwid;
208 			uint32_t	group_id;
209 			uint16_t	ifmtu;
210 		} pwid;
211 		struct {
212 			uint8_t		type;
213 			union {
214 				uint16_t	prefix_af;
215 				uint16_t	pw_type;
216 			} u;
217 		} twcard;
218 	} fec;
219 	struct {
220 		uint32_t	status_code;
221 		uint32_t	msg_id;
222 		uint16_t	msg_type;
223 	} st;
224 	uint32_t	label;
225 	uint32_t	requestid;
226 	uint32_t	pw_status;
227 	uint8_t		flags;
228 };
229 #define F_MAP_REQ_ID	0x01	/* optional request message id present */
230 #define F_MAP_STATUS	0x02	/* status */
231 #define F_MAP_PW_CWORD	0x04	/* pseudowire control word */
232 #define F_MAP_PW_ID	0x08	/* pseudowire connection id */
233 #define F_MAP_PW_IFMTU	0x10	/* pseudowire interface parameter */
234 #define F_MAP_PW_STATUS	0x20	/* pseudowire status */
235 
236 struct notify_msg {
237 	uint32_t	status_code;
238 	uint32_t	msg_id;		/* network byte order */
239 	uint16_t	msg_type;	/* network byte order */
240 	uint32_t	pw_status;
241 	struct map	fec;
242 	struct {
243 		uint16_t	 type;
244 		uint16_t	 length;
245 		char		*data;
246 	} rtlvs;
247 	uint8_t		flags;
248 };
249 #define F_NOTIF_PW_STATUS	0x01	/* pseudowire status tlv present */
250 #define F_NOTIF_FEC		0x02	/* fec tlv present */
251 #define F_NOTIF_RETURNED_TLVS	0x04	/* returned tlvs present */
252 
253 struct if_addr {
254 	LIST_ENTRY(if_addr)	 entry;
255 	int			 af;
256 	union ldpd_addr		 addr;
257 	uint8_t			 prefixlen;
258 	union ldpd_addr		 dstbrd;
259 };
260 LIST_HEAD(if_addr_head, if_addr);
261 
262 struct iface_af {
263 	struct iface		*iface;
264 	int			 af;
265 	int			 enabled;
266 	int			 state;
267 	LIST_HEAD(, adj)	 adj_list;
268 	time_t			 uptime;
269 	struct event		 hello_timer;
270 	uint16_t		 hello_holdtime;
271 	uint16_t		 hello_interval;
272 };
273 
274 struct iface {
275 	LIST_ENTRY(iface)	 entry;
276 	char			 name[IF_NAMESIZE];
277 	unsigned int		 ifindex;
278 	unsigned int		 rdomain;
279 	struct if_addr_head	 addr_list;
280 	struct in6_addr		 linklocal;
281 	enum iface_type		 type;
282 	uint8_t			 if_type;
283 	uint16_t		 flags;
284 	uint8_t			 linkstate;
285 	struct iface_af		 ipv4;
286 	struct iface_af		 ipv6;
287 };
288 
289 /* source of targeted hellos */
290 struct tnbr {
291 	LIST_ENTRY(tnbr)	 entry;
292 	struct event		 hello_timer;
293 	struct adj		*adj;
294 	int			 af;
295 	union ldpd_addr		 addr;
296 	int			 state;
297 	uint16_t		 hello_holdtime;
298 	uint16_t		 hello_interval;
299 	uint16_t		 pw_count;
300 	uint8_t			 flags;
301 };
302 #define F_TNBR_CONFIGURED	 0x01
303 #define F_TNBR_DYNAMIC		 0x02
304 
305 /* neighbor specific parameters */
306 struct nbr_params {
307 	LIST_ENTRY(nbr_params)	 entry;
308 	struct in_addr		 lsr_id;
309 	uint16_t		 keepalive;
310 	int			 gtsm_enabled;
311 	uint8_t			 gtsm_hops;
312 	uint8_t			 flags;
313 };
314 #define F_NBRP_KEEPALIVE	 0x01
315 #define F_NBRP_GTSM		 0x02
316 #define F_NBRP_GTSM_HOPS	 0x04
317 
318 struct l2vpn_if {
319 	LIST_ENTRY(l2vpn_if)	 entry;
320 	struct l2vpn		*l2vpn;
321 	char			 ifname[IF_NAMESIZE];
322 	unsigned int		 ifindex;
323 	uint16_t		 flags;
324 	uint8_t			 linkstate;
325 	uint8_t			 mac[ETHER_ADDR_LEN];
326 };
327 
328 struct l2vpn_pw {
329 	LIST_ENTRY(l2vpn_pw)	 entry;
330 	struct l2vpn		*l2vpn;
331 	struct in_addr		 lsr_id;
332 	int			 af;
333 	union ldpd_addr		 addr;
334 	uint32_t		 pwid;
335 	char			 ifname[IF_NAMESIZE];
336 	unsigned int		 ifindex;
337 	uint32_t		 remote_group;
338 	uint16_t		 remote_mtu;
339 	uint32_t		 remote_status;
340 	uint8_t			 flags;
341 };
342 #define F_PW_STATUSTLV_CONF	0x01	/* status tlv configured */
343 #define F_PW_STATUSTLV		0x02	/* status tlv negotiated */
344 #define F_PW_CWORD_CONF		0x04	/* control word configured */
345 #define F_PW_CWORD		0x08	/* control word negotiated */
346 #define F_PW_STATUS_UP		0x10	/* pseudowire is operational */
347 
348 struct l2vpn {
349 	LIST_ENTRY(l2vpn)	 entry;
350 	char			 name[L2VPN_NAME_LEN];
351 	int			 type;
352 	int			 pw_type;
353 	int			 mtu;
354 	char			 br_ifname[IF_NAMESIZE];
355 	unsigned int		 br_ifindex;
356 	LIST_HEAD(, l2vpn_if)	 if_list;
357 	LIST_HEAD(, l2vpn_pw)	 pw_list;
358 };
359 #define L2VPN_TYPE_VPWS		1
360 #define L2VPN_TYPE_VPLS		2
361 
362 /* ldp_conf */
363 enum ldpd_process {
364 	PROC_MAIN,
365 	PROC_LDP_ENGINE,
366 	PROC_LDE_ENGINE
367 };
368 extern enum ldpd_process	ldpd_process;
369 
370 enum socket_type {
371 	LDP_SOCKET_DISC,
372 	LDP_SOCKET_EDISC,
373 	LDP_SOCKET_SESSION
374 };
375 
376 enum hello_type {
377 	HELLO_LINK,
378 	HELLO_TARGETED
379 };
380 
381 struct ldpd_af_conf {
382 	uint16_t		 keepalive;
383 	uint16_t		 thello_holdtime;
384 	uint16_t		 thello_interval;
385 	union ldpd_addr		 trans_addr;
386 	int			 flags;
387 };
388 #define	F_LDPD_AF_ENABLED	0x0001
389 #define	F_LDPD_AF_THELLO_ACCEPT	0x0002
390 #define	F_LDPD_AF_EXPNULL	0x0004
391 #define	F_LDPD_AF_NO_GTSM	0x0008
392 
393 struct ldp_auth {
394 	LIST_ENTRY(ldp_auth)	 entry;
395 	char			 md5key[TCP_MD5_KEY_LEN];
396 	unsigned int		 md5key_len;
397 	struct in_addr		 id;
398 	int			 idlen;
399 };
400 
401 #define LDP_AUTH_REQUIRED(_a)	 ((_a)->md5key_len != 0)
402 
403 struct ldpd_conf {
404 	struct in_addr		 rtr_id;
405 	unsigned int		 rdomain;
406 	struct ldpd_af_conf	 ipv4;
407 	struct ldpd_af_conf	 ipv6;
408 	LIST_HEAD(, iface)	 iface_list;
409 	LIST_HEAD(, tnbr)	 tnbr_list;
410 	LIST_HEAD(, nbr_params)	 nbrp_list;
411 	LIST_HEAD(, l2vpn)	 l2vpn_list;
412 	LIST_HEAD(, ldp_auth)	 auth_list;
413 	uint16_t		 trans_pref;
414 	int			 flags;
415 };
416 #define	F_LDPD_NO_FIB_UPDATE	0x0001
417 #define	F_LDPD_DS_CISCO_INTEROP	0x0002
418 
419 struct ldpd_af_global {
420 	struct event		 disc_ev;
421 	struct event		 edisc_ev;
422 	int			 ldp_disc_socket;
423 	int			 ldp_edisc_socket;
424 	int			 ldp_session_socket;
425 };
426 
427 struct ldpd_global {
428 	int			 cmd_opts;
429 	char			*csock;
430 	time_t			 uptime;
431 	struct ldpd_af_global	 ipv4;
432 	struct ldpd_af_global	 ipv6;
433 	uint32_t		 conf_seqnum;
434 	int			 pfkeysock;
435 	struct if_addr_head	 addr_list;
436 	LIST_HEAD(, adj)	 adj_list;
437 	struct in_addr		 mcast_addr_v4;
438 	struct in6_addr		 mcast_addr_v6;
439 	TAILQ_HEAD(, pending_conn) pending_conns;
440 };
441 
442 /* kroute */
443 struct kroute {
444 	int			 af;
445 	union ldpd_addr		 prefix;
446 	uint8_t			 prefixlen;
447 	union ldpd_addr		 nexthop;
448 	uint32_t		 local_label;
449 	uint32_t		 remote_label;
450 	unsigned short		 ifindex;
451 	uint8_t			 priority;
452 	uint16_t		 flags;
453 };
454 
455 struct kpw {
456 	unsigned short		 ifindex;
457 	int			 pw_type;
458 	int			 af;
459 	union ldpd_addr		 nexthop;
460 	uint32_t		 local_label;
461 	uint32_t		 remote_label;
462 	uint8_t			 flags;
463 };
464 
465 struct kaddr {
466 	unsigned short		 ifindex;
467 	int			 af;
468 	union ldpd_addr		 addr;
469 	uint8_t			 prefixlen;
470 	union ldpd_addr	 	 dstbrd;
471 };
472 
473 struct kif {
474 	char			 ifname[IF_NAMESIZE];
475 	unsigned short		 ifindex;
476 	int			 flags;
477 	uint8_t			 link_state;
478 	uint8_t			 mac[ETHER_ADDR_LEN];
479 	int			 mtu;
480 	unsigned int		 rdomain;
481 	uint8_t			 if_type;
482 	uint64_t		 baudrate;
483 };
484 
485 /* control data structures */
486 struct ctl_iface {
487 	int			 af;
488 	char			 name[IF_NAMESIZE];
489 	unsigned int		 ifindex;
490 	int			 state;
491 	uint16_t		 flags;
492 	uint8_t			 linkstate;
493 	enum iface_type		 type;
494 	uint8_t			 if_type;
495 	uint16_t		 hello_holdtime;
496 	uint16_t		 hello_interval;
497 	time_t			 uptime;
498 	uint16_t		 adj_cnt;
499 };
500 
501 struct ctl_adj {
502 	int			 af;
503 	struct in_addr		 id;
504 	enum hello_type		 type;
505 	char			 ifname[IF_NAMESIZE];
506 	union ldpd_addr		 src_addr;
507 	uint16_t		 holdtime;
508 	union ldpd_addr		 trans_addr;
509 };
510 
511 struct ctl_nbr {
512 	int			 af;
513 	struct in_addr		 id;
514 	union ldpd_addr		 laddr;
515 	union ldpd_addr		 raddr;
516 	time_t			 uptime;
517 	int			 nbr_state;
518 };
519 
520 struct ctl_rt {
521 	int			 af;
522 	union ldpd_addr		 prefix;
523 	uint8_t			 prefixlen;
524 	struct in_addr		 nexthop;	/* lsr-id */
525 	uint32_t		 local_label;
526 	uint32_t		 remote_label;
527 	uint8_t			 flags;
528 	uint8_t			 in_use;
529 };
530 
531 struct ctl_pw {
532 	uint16_t		 type;
533 	char			 ifname[IF_NAMESIZE];
534 	uint32_t		 pwid;
535 	struct in_addr		 lsr_id;
536 	uint32_t		 local_label;
537 	uint32_t		 local_gid;
538 	uint16_t		 local_ifmtu;
539 	uint32_t		 remote_label;
540 	uint32_t		 remote_gid;
541 	uint16_t		 remote_ifmtu;
542 	uint32_t		 status;
543 };
544 
545 extern struct ldpd_conf		*ldpd_conf;
546 extern struct ldpd_global	 global;
547 
548 /* parse.y */
549 struct ldpd_conf	*parse_config(char *);
550 int			 cmdline_symset(char *);
551 
552 /* kroute.c */
553 int		 kif_init(void);
554 int		 kr_init(int, unsigned int);
555 void		 kif_redistribute(const char *);
556 int		 kr_change(struct kroute *);
557 int		 kr_delete(struct kroute *);
558 void		 kr_shutdown(void);
559 void		 kr_fib_couple(void);
560 void		 kr_fib_decouple(void);
561 void		 kr_change_egress_label(int, int);
562 void		 kr_show_route(struct imsg *);
563 void		 kr_ifinfo(char *, pid_t);
564 struct kif	*kif_findname(char *);
565 void		 kif_clear(void);
566 int		 kmpw_set(struct kpw *);
567 int		 kmpw_unset(struct kpw *);
568 int		 kmpw_find(const char *);
569 
570 /* util.c */
571 uint8_t		 mask2prefixlen(in_addr_t);
572 uint8_t		 mask2prefixlen6(struct sockaddr_in6 *);
573 in_addr_t	 prefixlen2mask(uint8_t);
574 struct in6_addr	*prefixlen2mask6(uint8_t);
575 void		 ldp_applymask(int, union ldpd_addr *,
576 		    const union ldpd_addr *, int);
577 int		 ldp_addrcmp(int, const union ldpd_addr *,
578 		    const union ldpd_addr *);
579 int		 ldp_addrisset(int, const union ldpd_addr *);
580 int		 ldp_prefixcmp(int, const union ldpd_addr *,
581 		    const union ldpd_addr *, uint8_t);
582 int		 bad_addr_v4(struct in_addr);
583 int		 bad_addr_v6(struct in6_addr *);
584 int		 bad_addr(int, union ldpd_addr *);
585 void		 embedscope(struct sockaddr_in6 *);
586 void		 recoverscope(struct sockaddr_in6 *);
587 void		 addscope(struct sockaddr_in6 *, uint32_t);
588 void		 clearscope(struct in6_addr *);
589 struct sockaddr	*addr2sa(int af, union ldpd_addr *, uint16_t);
590 void		 sa2addr(struct sockaddr *, int *, union ldpd_addr *);
591 
592 /* ldpd.c */
593 void			 main_imsg_compose_ldpe(int, pid_t, void *, uint16_t);
594 void			 main_imsg_compose_lde(int, pid_t, void *, uint16_t);
595 void			 imsg_event_add(struct imsgev *);
596 int			 imsg_compose_event(struct imsgev *, uint16_t, uint32_t, pid_t,
597 			    int, void *, uint16_t);
598 void			 evbuf_enqueue(struct evbuf *, struct ibuf *);
599 void			 evbuf_event_add(struct evbuf *);
600 void			 evbuf_init(struct evbuf *, int, void (*)(int, short, void *), void *);
601 void			 evbuf_clear(struct evbuf *);
602 struct ldpd_af_conf	*ldp_af_conf_get(struct ldpd_conf *, int);
603 struct ldpd_af_global	*ldp_af_global_get(struct ldpd_global *, int);
604 int			 ldp_is_dual_stack(struct ldpd_conf *);
605 void			 merge_config(struct ldpd_conf *, struct ldpd_conf *);
606 struct ldpd_conf	*config_new_empty(void);
607 void			 config_clear(struct ldpd_conf *);
608 
609 /* socket.c */
610 int		 ldp_create_socket(int, enum socket_type);
611 void		 sock_set_recvbuf(int);
612 int		 sock_set_reuse(int, int);
613 int		 sock_set_bindany(int, int);
614 int		 sock_set_ipv4_tos(int, int);
615 int		 sock_set_ipv4_recvif(int, int);
616 int		 sock_set_ipv4_minttl(int, int);
617 int		 sock_set_ipv4_ucast_ttl(int fd, int);
618 int		 sock_set_ipv4_mcast_ttl(int, uint8_t);
619 int		 sock_set_ipv4_mcast(struct iface *);
620 int		 sock_set_ipv4_mcast_loop(int);
621 int		 sock_set_ipv6_dscp(int, int);
622 int		 sock_set_ipv6_pktinfo(int, int);
623 int		 sock_set_ipv6_minhopcount(int, int);
624 int		 sock_set_ipv6_ucast_hops(int, int);
625 int		 sock_set_ipv6_mcast_hops(int, int);
626 int		 sock_set_ipv6_mcast(struct iface *);
627 int		 sock_set_ipv6_mcast_loop(int);
628 
629 /* printconf.c */
630 void	print_config(struct ldpd_conf *);
631 
632 /* logmsg.h */
633 struct in6_addr;
634 union ldpd_addr;
635 struct hello_source;
636 struct fec;
637 
638 const char	*log_sockaddr(void *);
639 const char	*log_in6addr(const struct in6_addr *);
640 const char	*log_in6addr_scope(const struct in6_addr *, unsigned int);
641 const char	*log_addr(int, const union ldpd_addr *);
642 char		*log_label(uint32_t);
643 char		*log_hello_src(const struct hello_source *);
644 const char	*log_map(const struct map *);
645 const char	*log_fec(const struct fec *);
646 const char	*af_name(int);
647 const char	*socket_name(int);
648 const char	*nbr_state_name(int);
649 const char	*if_state_name(int);
650 const char	*if_type_name(enum iface_type);
651 const char	*msg_name(uint16_t);
652 const char	*status_code_name(uint32_t);
653 const char	*pw_type_name(uint16_t);
654 
655 #endif	/* _LDPD_H_ */
656