]> git.proxmox.com Git - mirror_frr.git/blobdiff - ldpd/ldpd.h
Merge pull request #3405 from LabNConsulting/working/master/fix-vrf
[mirror_frr.git] / ldpd / ldpd.h
index 47188c6bee39111a3ca3b63fe49b57b6765bf3cc..91135055817fa1cb8b477383b554bfe2ef1c1888 100644 (file)
 #ifndef _LDPD_H_
 #define _LDPD_H_
 
-#include "openbsd-queue.h"
+#include "queue.h"
 #include "openbsd-tree.h"
 #include "imsg.h"
 #include "thread.h"
 #include "qobj.h"
 #include "prefix.h"
 #include "filter.h"
+#include "vty.h"
+#include "pw.h"
+#include "zclient.h"
 
 #include "ldp.h"
 
@@ -43,7 +46,6 @@
 #define LDPD_OPT_NOACTION      0x00000004
 
 #define TCP_MD5_KEY_LEN                80
-#define L2VPN_NAME_LEN         32
 
 #define        RT_BUF_SIZE             16384
 #define        MAX_RTSOCK_BUF          128 * 1024
@@ -101,8 +103,10 @@ enum imsg_type {
        IMSG_CTL_LOG_VERBOSE,
        IMSG_KLABEL_CHANGE,
        IMSG_KLABEL_DELETE,
-       IMSG_KPWLABEL_CHANGE,
-       IMSG_KPWLABEL_DELETE,
+       IMSG_KPW_ADD,
+       IMSG_KPW_DELETE,
+       IMSG_KPW_SET,
+       IMSG_KPW_UNSET,
        IMSG_IFSTATUS,
        IMSG_NEWADDR,
        IMSG_DELADDR,
@@ -146,8 +150,16 @@ enum imsg_type {
        IMSG_DEBUG_UPDATE,
        IMSG_LOG,
        IMSG_ACL_CHECK,
-       IMSG_GET_LABEL_CHUNK,
-       IMSG_RELEASE_LABEL_CHUNK
+       IMSG_INIT,
+       IMSG_PW_UPDATE
+};
+
+struct ldpd_init {
+       char             user[256];
+       char             group[256];
+       char             ctl_sock_path[MAXPATHLEN];
+       char             zclient_serv_path[MAXPATHLEN];
+       unsigned short instance;
 };
 
 union ldpd_addr {
@@ -381,7 +393,7 @@ struct l2vpn_if {
        char                     ifname[IF_NAMESIZE];
        unsigned int             ifindex;
        int                      operative;
-       uint8_t                  mac[ETHER_ADDR_LEN];
+       uint8_t                  mac[ETH_ALEN];
        QOBJ_FIELDS
 };
 RB_HEAD(l2vpn_if_head, l2vpn_if);
@@ -397,8 +409,10 @@ struct l2vpn_pw {
        uint32_t                 pwid;
        char                     ifname[IF_NAMESIZE];
        unsigned int             ifindex;
+       bool                     enabled;
        uint32_t                 remote_group;
        uint16_t                 remote_mtu;
+       uint32_t                 local_status;
        uint32_t                 remote_status;
        uint8_t                  flags;
        QOBJ_FIELDS
@@ -410,8 +424,7 @@ DECLARE_QOBJ_TYPE(l2vpn_pw)
 #define F_PW_STATUSTLV         0x02    /* status tlv negotiated */
 #define F_PW_CWORD_CONF                0x04    /* control word configured */
 #define F_PW_CWORD             0x08    /* control word negotiated */
-#define F_PW_STATUS_UP         0x10    /* pseudowire is operational */
-#define F_PW_STATIC_NBR_ADDR   0x20    /* static neighbor address configured */
+#define F_PW_STATIC_NBR_ADDR   0x10    /* static neighbor address configured */
 
 struct l2vpn {
        RB_ENTRY(l2vpn)          entry;
@@ -439,6 +452,12 @@ enum ldpd_process {
        PROC_LDE_ENGINE
 } ldpd_process;
 
+static const char * const log_procnames[] = {
+       "parent",
+       "ldpe",
+       "lde"
+};
+
 enum socket_type {
        LDP_SOCKET_DISC,
        LDP_SOCKET_EDISC,
@@ -503,8 +522,6 @@ struct ldpd_af_global {
 
 struct ldpd_global {
        int                      cmd_opts;
-       int                      sighup;
-       time_t                   uptime;
        struct in_addr           rtr_id;
        struct ldpd_af_global    ipv4;
        struct ldpd_af_global    ipv6;
@@ -530,17 +547,8 @@ struct kroute {
        uint16_t                 flags;
 };
 
-struct kpw {
-       unsigned short           ifindex;
-       int                      pw_type;
-       int                      af;
-       union ldpd_addr          nexthop;
-       uint32_t                 local_label;
-       uint32_t                 remote_label;
-       uint8_t                  flags;
-};
-
 struct kaddr {
+       char                     ifname[IF_NAMESIZE];
        unsigned short           ifindex;
        int                      af;
        union ldpd_addr          addr;
@@ -553,7 +561,7 @@ struct kif {
        unsigned short           ifindex;
        int                      flags;
        int                      operative;
-       uint8_t                  mac[ETHER_ADDR_LEN];
+       uint8_t                  mac[ETH_ALEN];
        int                      mtu;
 };
 
@@ -648,17 +656,21 @@ struct ctl_pw {
 
 extern struct ldpd_conf                *ldpd_conf, *vty_conf;
 extern struct ldpd_global       global;
+extern struct ldpd_init                 init;
 
 /* parse.y */
 struct ldpd_conf       *parse_config(char *);
 int                     cmdline_symset(char *);
 
 /* kroute.c */
+void            pw2zpw(struct l2vpn_pw *, struct zapi_pw *);
 void            kif_redistribute(const char *);
 int             kr_change(struct kroute *);
 int             kr_delete(struct kroute *);
-int             kmpw_set(struct kpw *);
-int             kmpw_unset(struct kpw *);
+int             kmpw_add(struct zapi_pw *);
+int             kmpw_del(struct zapi_pw *);
+int             kmpw_set(struct zapi_pw *);
+int             kmpw_unset(struct zapi_pw *);
 
 /* util.c */
 uint8_t                 mask2prefixlen(in_addr_t);
@@ -679,7 +691,8 @@ void                 embedscope(struct sockaddr_in6 *);
 void            recoverscope(struct sockaddr_in6 *);
 void            addscope(struct sockaddr_in6 *, uint32_t);
 void            clearscope(struct in6_addr *);
-struct sockaddr        *addr2sa(int af, union ldpd_addr *, uint16_t);
+void            addr2sa(int af, const union ldpd_addr *, uint16_t,
+                   union sockunion *su);
 void            sa2addr(struct sockaddr *, int *, union ldpd_addr *,
                    in_port_t *);
 socklen_t       sockaddr_len(struct sockaddr *);
@@ -705,7 +718,7 @@ struct ldpd_af_conf *ldp_af_conf_get(struct ldpd_conf *, int);
 struct ldpd_af_global  *ldp_af_global_get(struct ldpd_global *, int);
 int                     ldp_is_dual_stack(struct ldpd_conf *);
 in_addr_t               ldp_rtr_id_get(struct ldpd_conf *);
-int                     ldp_reload(struct ldpd_conf *);
+int                     ldp_config_apply(struct vty *, struct ldpd_conf *);
 void                    ldp_clear_config(struct ldpd_conf *);
 void                    merge_config(struct ldpd_conf *, struct ldpd_conf *);
 struct ldpd_conf       *config_new_empty(void);
@@ -761,6 +774,30 @@ int                 sock_set_ipv6_mcast_hops(int, int);
 int             sock_set_ipv6_mcast(struct iface *);
 int             sock_set_ipv6_mcast_loop(int);
 
+/* logmsg.h */
+struct in6_addr;
+union ldpd_addr;
+struct hello_source;
+struct fec;
+
+const char     *log_sockaddr(void *);
+const char     *log_in6addr(const struct in6_addr *);
+const char     *log_in6addr_scope(const struct in6_addr *, unsigned int);
+const char     *log_addr(int, const union ldpd_addr *);
+char           *log_label(uint32_t);
+const char     *log_time(time_t);
+char           *log_hello_src(const struct hello_source *);
+const char     *log_map(const struct map *);
+const char     *log_fec(const struct fec *);
+const char     *af_name(int);
+const char     *socket_name(int);
+const char     *nbr_state_name(int);
+const char     *if_state_name(int);
+const char     *if_type_name(enum iface_type);
+const char     *msg_name(uint16_t);
+const char     *status_code_name(uint32_t);
+const char     *pw_type_name(uint16_t);
+
 /* quagga */
 extern struct thread_master    *master;
 extern char                     ctl_sock_path[MAXPATHLEN];