1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2003 Yasuhiro Ohara
13 DECLARE_MGROUP(OSPF6D
);
15 /* global variables */
16 extern struct event_loop
*master
;
18 /* Historical for KAME. */
19 #ifndef IPV6_JOIN_GROUP
20 #ifdef IPV6_ADD_MEMBERSHIP
21 #define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
22 #endif /* IPV6_ADD_MEMBERSHIP. */
23 #ifdef IPV6_JOIN_MEMBERSHIP
24 #define IPV6_JOIN_GROUP IPV6_JOIN_MEMBERSHIP
25 #endif /* IPV6_JOIN_MEMBERSHIP. */
26 #endif /* ! IPV6_JOIN_GROUP*/
28 #ifndef IPV6_LEAVE_GROUP
29 #ifdef IPV6_DROP_MEMBERSHIP
30 #define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
31 #endif /* IPV6_DROP_MEMBERSHIP */
32 #endif /* ! IPV6_LEAVE_GROUP */
37 #define OSPF6_SUCCESS 1
38 #define OSPF6_FAILURE 0
39 #define OSPF6_INVALID -1
41 /* cast macro: XXX - these *must* die, ick ick. */
42 #define OSPF6_PROCESS(x) ((struct ospf6 *) (x))
43 #define OSPF6_AREA(x) ((struct ospf6_area *) (x))
44 #define OSPF6_INTERFACE(x) ((struct ospf6_interface *) (x))
45 #define OSPF6_NEIGHBOR(x) ((struct ospf6_neighbor *) (x))
47 /* operation on timeval structure */
48 #define timerstring(tv, buf, size) \
50 if ((tv)->tv_sec / 60 / 60 / 24) \
51 snprintf(buf, size, "%lldd%02lld:%02lld:%02lld", \
52 (tv)->tv_sec / 60LL / 60 / 24, \
53 (tv)->tv_sec / 60LL / 60 % 24, \
54 (tv)->tv_sec / 60LL % 60, \
55 (tv)->tv_sec % 60LL); \
57 snprintf(buf, size, "%02lld:%02lld:%02lld", \
58 (tv)->tv_sec / 60LL / 60 % 24, \
59 (tv)->tv_sec / 60LL % 60, \
60 (tv)->tv_sec % 60LL); \
63 #define threadtimer_string(now, t, buf, size) \
65 struct timeval _result; \
67 snprintf(buf, size, "inactive"); \
69 timersub(&t->u.sands, &now, &_result); \
70 timerstring(&_result, buf, size); \
75 #define OSPF6_AREA_STR "Area information\n"
76 #define OSPF6_AREA_ID_STR "Area ID (as an IPv4 notation)\n"
77 #define OSPF6_SPF_STR "Shortest Path First tree information\n"
78 #define OSPF6_ROUTER_ID_STR "Specify Router-ID\n"
79 #define OSPF6_LS_ID_STR "Specify Link State ID\n"
81 #define OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6) \
83 if (uj == false && all_vrf == false && ospf6 == NULL) { \
84 vty_out(vty, "%% OSPFv3 instance not found\n"); \
89 #define IS_OSPF6_ASBR(O) ((O)->flag & OSPF6_FLAG_ASBR)
90 #define OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf) \
92 if (argv_find(argv, argc, "vrf", &idx_vrf)) { \
93 vrf_name = argv[idx_vrf + 1]->arg; \
94 all_vrf = strmatch(vrf_name, "all"); \
96 vrf_name = VRF_DEFAULT_NAME; \
100 #define OSPF6_FALSE false
101 #define OSPF6_TRUE true
102 #define OSPF6_SUCCESS 1
103 #define OSPF6_FAILURE 0
104 #define OSPF6_INVALID -1
106 extern struct zebra_privs_t ospf6d_privs
;
108 /* Function Prototypes */
109 extern struct route_node
*route_prev(struct route_node
*node
);
111 extern void ospf6_debug(void);
112 extern void ospf6_init(struct event_loop
*master
);
114 #endif /* OSPF6D_H */