]> git.proxmox.com Git - mirror_frr.git/blobdiff - ripd/ripd.h
zebra: Refactor kernel_rtm to be a bit smarter about how it handles options
[mirror_frr.git] / ripd / ripd.h
index 784b064606a1a82e1c6e7d1a4e103258c171d49c..91fab2a7a2e3d63b190b8be002db5c88f25e1393 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef _ZEBRA_RIP_H
 #define _ZEBRA_RIP_H
 
-#include "qobj.h"
 #include "hook.h"
 #include "nexthop.h"
 #include "rip_memory.h"
 #define INADDR_RIP_GROUP        0xe0000009    /* 224.0.0.9 */
 #endif
 
-/* RIP timers */
-#define RIP_UPDATE_TIMER_DEFAULT        30
-#define RIP_TIMEOUT_TIMER_DEFAULT      180
-#define RIP_GARBAGE_TIMER_DEFAULT      120
-
 /* RIP peer timeout value. */
 #define RIP_PEER_TIMER_DEFAULT         180
 
 #define RIP_AUTH_MD5_SIZE               16
 #define RIP_AUTH_MD5_COMPAT_SIZE        RIP_RTE_SIZE
 
+/* YANG paths */
+#define RIP_INSTANCE   "/frr-ripd:ripd/instance"
+#define RIP_IFACE      "/frr-interface:lib/interface/frr-ripd:rip"
+
 /* RIP structure. */
 struct rip {
        /* RIP socket. */
@@ -113,9 +111,6 @@ struct rip {
        /* RIP routing information base. */
        struct route_table *table;
 
-       /* RIP only static routing information. */
-       struct route_table *route;
-
        /* RIP neighbor. */
        struct route_table *neighbor;
 
@@ -131,35 +126,31 @@ struct rip {
        struct thread *t_triggered_interval;
 
        /* RIP timer values. */
-       unsigned long update_time;
-       unsigned long timeout_time;
-       unsigned long garbage_time;
+       uint32_t update_time;
+       uint32_t timeout_time;
+       uint32_t garbage_time;
 
        /* RIP default metric. */
-       int default_metric;
-
-       /* RIP default-information originate. */
-       uint8_t default_information;
-       char *default_information_route_map;
+       uint8_t default_metric;
 
        /* RIP default distance. */
        uint8_t distance;
        struct route_table *distance_table;
 
        /* RIP ECMP flag */
-       unsigned int ecmp;
+       bool ecmp;
+
+       /* Are we in passive-interface default mode? */
+       bool passive_default;
 
        /* For redistribute route map. */
        struct {
                char *name;
                struct route_map *map;
-               int metric_config;
-               uint32_t metric;
+               bool metric_config;
+               uint8_t metric;
        } route_map[ZEBRA_ROUTE_MAX];
-
-       QOBJ_FIELDS
 };
-DECLARE_QOBJ_TYPE(rip)
 
 /* RIP routing table entry which belong to rip_packet. */
 struct rte {
@@ -254,7 +245,7 @@ struct rip_interface {
        int ri_receive;
 
        /* RIPv2 broadcast mode */
-       int v2_broadcast;
+       bool v2_broadcast;
 
        /* RIPv2 authentication type. */
        int auth_type;
@@ -266,11 +257,10 @@ struct rip_interface {
        char *key_chain;
 
        /* value to use for md5->auth_len */
-       uint8_t md5_auth_len;
+       int md5_auth_len;
 
        /* Split horizon flag. */
        split_horizon_policy_t split_horizon;
-       split_horizon_policy_t split_horizon_default;
 
 /* For filter type slot. */
 #define RIP_FILTER_IN  0
@@ -320,6 +310,14 @@ struct rip_peer {
        struct thread *t_timeout;
 };
 
+struct rip_distance {
+       /* Distance value for the IP source prefix. */
+       uint8_t distance;
+
+       /* Name of the access-list to be matched. */
+       char *access_list;
+};
+
 struct rip_md5_info {
        uint16_t family;
        uint16_t type;
@@ -346,9 +344,6 @@ struct rip_md5_data {
 /* N.B. stuff will break if
        (RIPv1 != RI_RIP_VERSION_1) || (RIPv2 != RI_RIP_VERSION_2) */
 
-/* Default value for "default-metric" command. */
-#define RIP_DEFAULT_METRIC_DEFAULT         1
-
 /* RIP event. */
 enum rip_event {
        RIP_READ,
@@ -362,29 +357,55 @@ enum rip_event {
 /* Macro for timer turn off. */
 #define RIP_TIMER_OFF(X) THREAD_TIMER_OFF(X)
 
+#define RIP_OFFSET_LIST_IN  0
+#define RIP_OFFSET_LIST_OUT 1
+#define RIP_OFFSET_LIST_MAX 2
+
+struct rip_offset_list {
+       char *ifname;
+
+       struct {
+               char *alist_name;
+               /* struct access_list *alist; */
+               uint8_t metric;
+       } direct[RIP_OFFSET_LIST_MAX];
+};
+
 /* Prototypes. */
 extern void rip_init(void);
-extern void rip_reset(void);
 extern void rip_clean(void);
 extern void rip_clean_network(void);
 extern void rip_interfaces_clean(void);
-extern void rip_interfaces_reset(void);
+extern int rip_passive_nondefault_set(const char *ifname);
+extern int rip_passive_nondefault_unset(const char *ifname);
 extern void rip_passive_nondefault_clean(void);
 extern void rip_if_init(void);
 extern void rip_if_down_all(void);
 extern void rip_route_map_init(void);
-extern void rip_route_map_reset(void);
 extern void rip_zclient_init(struct thread_master *);
 extern void rip_zclient_stop(void);
-extern void rip_zclient_reset(void);
-extern void rip_offset_init(void);
 extern int if_check_address(struct in_addr addr);
+extern int rip_create(int socket);
 
 extern int rip_request_send(struct sockaddr_in *, struct interface *, uint8_t,
                            struct connected *);
 extern int rip_neighbor_lookup(struct sockaddr_in *);
+extern int rip_neighbor_add(struct prefix_ipv4 *p);
+extern int rip_neighbor_delete(struct prefix_ipv4 *p);
+
+extern int rip_enable_network_add(struct prefix *p);
+extern int rip_enable_network_delete(struct prefix *p);
+extern int rip_enable_if_add(const char *ifname);
+extern int rip_enable_if_delete(const char *ifname);
+
+extern void rip_event(enum rip_event, int);
+extern void rip_ecmp_disable(void);
+
+extern int rip_create_socket(void);
 
 extern int rip_redistribute_check(int);
+extern void rip_redistribute_conf_update(int type);
+extern void rip_redistribute_conf_delete(int type);
 extern void rip_redistribute_add(int type, int sub_type, struct prefix_ipv4 *p,
                                 struct nexthop *nh, unsigned int metric,
                                 unsigned char distance, route_tag_t tag);
@@ -396,9 +417,8 @@ extern void rip_interface_multicast_set(int, struct connected *);
 extern void rip_distribute_update_interface(struct interface *);
 extern void rip_if_rmap_update_interface(struct interface *);
 
-extern int config_write_rip_network(struct vty *, int);
-extern int config_write_rip_offset_list(struct vty *);
-extern int config_write_rip_redistribute(struct vty *, int);
+extern int rip_show_network_config(struct vty *);
+extern void rip_show_redistribute_config(struct vty *);
 
 extern void rip_peer_init(void);
 extern void rip_peer_update(struct sockaddr_in *, uint8_t);
@@ -408,20 +428,31 @@ extern void rip_peer_display(struct vty *);
 extern struct rip_peer *rip_peer_lookup(struct in_addr *);
 extern struct rip_peer *rip_peer_lookup_next(struct in_addr *);
 
-extern int rip_offset_list_apply_in(struct prefix_ipv4 *, struct interface *,
-                                   uint32_t *);
-extern int rip_offset_list_apply_out(struct prefix_ipv4 *, struct interface *,
-                                    uint32_t *);
-extern void rip_offset_clean(void);
-
 extern void rip_info_free(struct rip_info *);
+extern struct rip_distance *rip_distance_new(void);
+extern void rip_distance_free(struct rip_distance *rdistance);
 extern uint8_t rip_distance_apply(struct rip_info *);
 extern void rip_redistribute_clean(void);
 
+extern int rip_route_rte(struct rip_info *rinfo);
 extern struct rip_info *rip_ecmp_add(struct rip_info *);
 extern struct rip_info *rip_ecmp_replace(struct rip_info *);
 extern struct rip_info *rip_ecmp_delete(struct rip_info *);
 
+extern struct rip_offset_list *rip_offset_list_new(const char *ifname);
+extern void offset_list_del(struct rip_offset_list *offset);
+extern struct rip_offset_list *rip_offset_list_lookup(const char *ifname);
+extern int rip_offset_list_apply_in(struct prefix_ipv4 *, struct interface *,
+                                   uint32_t *);
+extern int rip_offset_list_apply_out(struct prefix_ipv4 *, struct interface *,
+                                    uint32_t *);
+extern void rip_offset_init(void);
+extern void rip_offset_clean(void);
+
+/* YANG notifications */
+extern void ripd_notif_send_auth_type_failure(const char *ifname);
+extern void ripd_notif_send_auth_failure(const char *ifname);
+
 /* There is only one rip strucutre. */
 extern struct rip *rip;
 
@@ -437,4 +468,12 @@ extern long rip_global_queries;
 DECLARE_HOOK(rip_ifaddr_add, (struct connected * ifc), (ifc))
 DECLARE_HOOK(rip_ifaddr_del, (struct connected * ifc), (ifc))
 
+extern struct list *peer_list;
+extern struct route_table *rip_distance_table;
+extern vector Vrip_passive_nondefault;
+
+/* Northbound. */
+extern void rip_cli_init(void);
+extern const struct frr_yang_module_info frr_ripd_info;
+
 #endif /* _ZEBRA_RIP_H */