forked from Mirror/frr
2005-05-06 Paul Jakma <paul@dishone.st>
* (general) extern and static'ification of functions in code and header. Cleanup any definitions with unspecified arguments. Add casts for callback assignments where the callback is defined, typically, as passing void *, but the function being assigned has some other pointer type defined as its argument, as gcc complains about casts from void * to X* via function arguments. Fix some old K&R style function argument definitions. Add noreturn gcc attribute to some functions, as appropriate. Add unused gcc attribute to some functions (eg ones meant to help while debugging) Add guard defines to headers which were missing them. * command.c: (install_node) add const qualifier, still doesnt shut up the warning though, because of the double pointer. (cmp_node) ditto * keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived fromn vty.h ones to fix some of the (long) < 0 warnings. * thread.c: (various) use thread_empty (cpu_record_hash_key) should cast to uintptr_t, a stdint.h type * vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they removed from ospfd/ospf_vty.h * zebra.h: Move definition of ZEBRA_PORT to here, to remove dependence of lib on zebra/zserv.h
This commit is contained in:
parent
e7fe8c88c3
commit
8cc4198f9f
|
@ -1,3 +1,29 @@
|
||||||
|
2005-05-06 Paul Jakma <paul@dishone.st>
|
||||||
|
|
||||||
|
* (general) extern and static'ification of functions in code and
|
||||||
|
header.
|
||||||
|
Cleanup any definitions with unspecified arguments.
|
||||||
|
Add casts for callback assignments where the callback is defined,
|
||||||
|
typically, as passing void *, but the function being assigned has
|
||||||
|
some other pointer type defined as its argument, as gcc complains
|
||||||
|
about casts from void * to X* via function arguments.
|
||||||
|
Fix some old K&R style function argument definitions.
|
||||||
|
Add noreturn gcc attribute to some functions, as appropriate.
|
||||||
|
Add unused gcc attribute to some functions (eg ones meant to help
|
||||||
|
while debugging)
|
||||||
|
Add guard defines to headers which were missing them.
|
||||||
|
* command.c: (install_node) add const qualifier, still doesnt shut
|
||||||
|
up the warning though, because of the double pointer.
|
||||||
|
(cmp_node) ditto
|
||||||
|
* keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived
|
||||||
|
fromn vty.h ones to fix some of the (long) < 0 warnings.
|
||||||
|
* thread.c: (various) use thread_empty
|
||||||
|
(cpu_record_hash_key) should cast to uintptr_t, a stdint.h type
|
||||||
|
* vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they
|
||||||
|
removed from ospfd/ospf_vty.h
|
||||||
|
* zebra.h: Move definition of ZEBRA_PORT to here, to remove
|
||||||
|
dependence of lib on zebra/zserv.h
|
||||||
|
|
||||||
2005-05-06 Hasso Tepper <hasso at quagga.net>
|
2005-05-06 Hasso Tepper <hasso at quagga.net>
|
||||||
|
|
||||||
* sockunion.c: Fix warning message.
|
* sockunion.c: Fix warning message.
|
||||||
|
|
|
@ -27,14 +27,14 @@
|
||||||
/* Create a new buffer. Memory will be allocated in chunks of the given
|
/* Create a new buffer. Memory will be allocated in chunks of the given
|
||||||
size. If the argument is 0, the library will supply a reasonable
|
size. If the argument is 0, the library will supply a reasonable
|
||||||
default size suitable for buffering socket I/O. */
|
default size suitable for buffering socket I/O. */
|
||||||
struct buffer *buffer_new (size_t);
|
extern struct buffer *buffer_new (size_t);
|
||||||
|
|
||||||
/* Free all data in the buffer. */
|
/* Free all data in the buffer. */
|
||||||
void buffer_reset (struct buffer *);
|
extern void buffer_reset (struct buffer *);
|
||||||
|
|
||||||
/* This function first calls buffer_reset to release all buffered data.
|
/* This function first calls buffer_reset to release all buffered data.
|
||||||
Then it frees the struct buffer itself. */
|
Then it frees the struct buffer itself. */
|
||||||
void buffer_free (struct buffer *);
|
extern void buffer_free (struct buffer *);
|
||||||
|
|
||||||
/* Add the given data to the end of the buffer. */
|
/* Add the given data to the end of the buffer. */
|
||||||
extern void buffer_put (struct buffer *, const void *, size_t);
|
extern void buffer_put (struct buffer *, const void *, size_t);
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
#include <zebra.h>
|
#include <zebra.h>
|
||||||
|
|
||||||
int /* return checksum in low-order 16 bits */
|
int /* return checksum in low-order 16 bits */
|
||||||
in_cksum(ptr, nbytes)
|
in_cksum(u_short *ptr, int nbytes)
|
||||||
register u_short *ptr;
|
|
||||||
register int nbytes;
|
|
||||||
{
|
{
|
||||||
register long sum; /* assumes long == 32 bits */
|
register long sum; /* assumes long == 32 bits */
|
||||||
u_short oddbyte;
|
u_short oddbyte;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
$Id: command.c,v 1.47 2005/04/25 16:26:42 paul Exp $
|
$Id: command.c,v 1.48 2005/05/06 21:25:49 paul Exp $
|
||||||
|
|
||||||
Command interpreter routine for virtual terminal [aka TeletYpe]
|
Command interpreter routine for virtual terminal [aka TeletYpe]
|
||||||
Copyright (C) 1997, 98, 99 Kunihiro Ishiguro
|
Copyright (C) 1997, 98, 99 Kunihiro Ishiguro
|
||||||
|
@ -193,8 +193,8 @@ install_node (struct cmd_node *node,
|
||||||
static int
|
static int
|
||||||
cmp_node (const void *p, const void *q)
|
cmp_node (const void *p, const void *q)
|
||||||
{
|
{
|
||||||
struct cmd_element *a = *(struct cmd_element **)p;
|
const struct cmd_element *a = *(struct cmd_element **)p;
|
||||||
struct cmd_element *b = *(struct cmd_element **)q;
|
const struct cmd_element *b = *(struct cmd_element **)q;
|
||||||
|
|
||||||
return strcmp (a->string, b->string);
|
return strcmp (a->string, b->string);
|
||||||
}
|
}
|
||||||
|
@ -202,8 +202,8 @@ cmp_node (const void *p, const void *q)
|
||||||
static int
|
static int
|
||||||
cmp_desc (const void *p, const void *q)
|
cmp_desc (const void *p, const void *q)
|
||||||
{
|
{
|
||||||
struct desc *a = *(struct desc **)p;
|
const struct desc *a = *(struct desc **)p;
|
||||||
struct desc *b = *(struct desc **)q;
|
const struct desc *b = *(struct desc **)q;
|
||||||
|
|
||||||
return strcmp (a->cmd, b->cmd);
|
return strcmp (a->cmd, b->cmd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,27 +318,27 @@ struct desc
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
void install_node (struct cmd_node *, int (*) (struct vty *));
|
extern void install_node (struct cmd_node *, int (*) (struct vty *));
|
||||||
void install_default (enum node_type);
|
extern void install_default (enum node_type);
|
||||||
void install_element (enum node_type, struct cmd_element *);
|
extern void install_element (enum node_type, struct cmd_element *);
|
||||||
void sort_node ();
|
extern void sort_node (void);
|
||||||
|
|
||||||
/* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated
|
/* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated
|
||||||
string with a space between each element (allocated using
|
string with a space between each element (allocated using
|
||||||
XMALLOC(MTYPE_TMP)). Returns NULL if shift >= argc. */
|
XMALLOC(MTYPE_TMP)). Returns NULL if shift >= argc. */
|
||||||
char *argv_concat (const char **argv, int argc, int shift);
|
extern char *argv_concat (const char **argv, int argc, int shift);
|
||||||
|
|
||||||
vector cmd_make_strvec (const char *);
|
extern vector cmd_make_strvec (const char *);
|
||||||
void cmd_free_strvec (vector);
|
extern void cmd_free_strvec (vector);
|
||||||
vector cmd_describe_command ();
|
extern vector cmd_describe_command (vector, struct vty *, int *status);
|
||||||
char **cmd_complete_command ();
|
extern char **cmd_complete_command (vector, struct vty *, int *status);
|
||||||
const char *cmd_prompt (enum node_type);
|
extern const char *cmd_prompt (enum node_type);
|
||||||
int config_from_file (struct vty *, FILE *);
|
extern int config_from_file (struct vty *, FILE *);
|
||||||
enum node_type node_parent (enum node_type);
|
extern enum node_type node_parent (enum node_type);
|
||||||
int cmd_execute_command (vector, struct vty *, struct cmd_element **, int);
|
extern int cmd_execute_command (vector, struct vty *, struct cmd_element **, int);
|
||||||
int cmd_execute_command_strict (vector, struct vty *, struct cmd_element **);
|
extern int cmd_execute_command_strict (vector, struct vty *, struct cmd_element **);
|
||||||
void config_replace_string (struct cmd_element *, char *, ...);
|
extern void config_replace_string (struct cmd_element *, char *, ...);
|
||||||
void cmd_init (int);
|
extern void cmd_init (int);
|
||||||
|
|
||||||
/* Export typical functions. */
|
/* Export typical functions. */
|
||||||
extern struct cmd_element config_end_cmd;
|
extern struct cmd_element config_end_cmd;
|
||||||
|
@ -346,9 +346,9 @@ extern struct cmd_element config_exit_cmd;
|
||||||
extern struct cmd_element config_quit_cmd;
|
extern struct cmd_element config_quit_cmd;
|
||||||
extern struct cmd_element config_help_cmd;
|
extern struct cmd_element config_help_cmd;
|
||||||
extern struct cmd_element config_list_cmd;
|
extern struct cmd_element config_list_cmd;
|
||||||
char *host_config_file ();
|
extern char *host_config_file (void);
|
||||||
void host_config_set (char *);
|
extern void host_config_set (char *);
|
||||||
|
|
||||||
void print_version (const char *);
|
|
||||||
|
|
||||||
|
extern void print_version (const char *);
|
||||||
|
|
||||||
#endif /* _ZEBRA_COMMAND_H */
|
#endif /* _ZEBRA_COMMAND_H */
|
||||||
|
|
|
@ -35,8 +35,8 @@ struct hash *disthash;
|
||||||
void (*distribute_add_hook) (struct distribute *);
|
void (*distribute_add_hook) (struct distribute *);
|
||||||
void (*distribute_delete_hook) (struct distribute *);
|
void (*distribute_delete_hook) (struct distribute *);
|
||||||
|
|
||||||
struct distribute *
|
static struct distribute *
|
||||||
distribute_new ()
|
distribute_new (void)
|
||||||
{
|
{
|
||||||
struct distribute *new;
|
struct distribute *new;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ distribute_new ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free distribute object. */
|
/* Free distribute object. */
|
||||||
void
|
static void
|
||||||
distribute_free (struct distribute *dist)
|
distribute_free (struct distribute *dist)
|
||||||
{
|
{
|
||||||
if (dist->ifname)
|
if (dist->ifname)
|
||||||
|
@ -93,7 +93,7 @@ distribute_list_delete_hook (void (*func) (struct distribute *))
|
||||||
distribute_delete_hook = func;
|
distribute_delete_hook = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
static void *
|
||||||
distribute_hash_alloc (struct distribute *arg)
|
distribute_hash_alloc (struct distribute *arg)
|
||||||
{
|
{
|
||||||
struct distribute *dist;
|
struct distribute *dist;
|
||||||
|
@ -107,7 +107,7 @@ distribute_hash_alloc (struct distribute *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make new distribute list and push into hash. */
|
/* Make new distribute list and push into hash. */
|
||||||
struct distribute *
|
static struct distribute *
|
||||||
distribute_get (const char *ifname)
|
distribute_get (const char *ifname)
|
||||||
{
|
{
|
||||||
struct distribute key;
|
struct distribute key;
|
||||||
|
@ -115,10 +115,10 @@ distribute_get (const char *ifname)
|
||||||
/* temporary reference */
|
/* temporary reference */
|
||||||
key.ifname = (char *)ifname;
|
key.ifname = (char *)ifname;
|
||||||
|
|
||||||
return hash_get (disthash, &key, distribute_hash_alloc);
|
return hash_get (disthash, &key, (void * (*) (void *))distribute_hash_alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
static unsigned int
|
||||||
distribute_hash_make (struct distribute *dist)
|
distribute_hash_make (struct distribute *dist)
|
||||||
{
|
{
|
||||||
unsigned int i, key;
|
unsigned int i, key;
|
||||||
|
@ -133,7 +133,7 @@ distribute_hash_make (struct distribute *dist)
|
||||||
|
|
||||||
/* If two distribute-list have same value then return 1 else return
|
/* If two distribute-list have same value then return 1 else return
|
||||||
0. This function is used by hash package. */
|
0. This function is used by hash package. */
|
||||||
int
|
static int
|
||||||
distribute_cmp (struct distribute *dist1, struct distribute *dist2)
|
distribute_cmp (struct distribute *dist1, struct distribute *dist2)
|
||||||
{
|
{
|
||||||
if (dist1->ifname && dist2->ifname)
|
if (dist1->ifname && dist2->ifname)
|
||||||
|
@ -145,7 +145,7 @@ distribute_cmp (struct distribute *dist1, struct distribute *dist2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set access-list name to the distribute list. */
|
/* Set access-list name to the distribute list. */
|
||||||
struct distribute *
|
static struct distribute *
|
||||||
distribute_list_set (const char *ifname, enum distribute_type type,
|
distribute_list_set (const char *ifname, enum distribute_type type,
|
||||||
const char *alist_name)
|
const char *alist_name)
|
||||||
{
|
{
|
||||||
|
@ -174,7 +174,7 @@ distribute_list_set (const char *ifname, enum distribute_type type,
|
||||||
|
|
||||||
/* Unset distribute-list. If matched distribute-list exist then
|
/* Unset distribute-list. If matched distribute-list exist then
|
||||||
return 1. */
|
return 1. */
|
||||||
int
|
static int
|
||||||
distribute_list_unset (const char *ifname, enum distribute_type type,
|
distribute_list_unset (const char *ifname, enum distribute_type type,
|
||||||
const char *alist_name)
|
const char *alist_name)
|
||||||
{
|
{
|
||||||
|
@ -223,7 +223,7 @@ distribute_list_unset (const char *ifname, enum distribute_type type,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set access-list name to the distribute list. */
|
/* Set access-list name to the distribute list. */
|
||||||
struct distribute *
|
static struct distribute *
|
||||||
distribute_list_prefix_set (const char *ifname, enum distribute_type type,
|
distribute_list_prefix_set (const char *ifname, enum distribute_type type,
|
||||||
const char *plist_name)
|
const char *plist_name)
|
||||||
{
|
{
|
||||||
|
@ -252,7 +252,7 @@ distribute_list_prefix_set (const char *ifname, enum distribute_type type,
|
||||||
|
|
||||||
/* Unset distribute-list. If matched distribute-list exist then
|
/* Unset distribute-list. If matched distribute-list exist then
|
||||||
return 1. */
|
return 1. */
|
||||||
int
|
static int
|
||||||
distribute_list_prefix_unset (const char *ifname, enum distribute_type type,
|
distribute_list_prefix_unset (const char *ifname, enum distribute_type type,
|
||||||
const char *plist_name)
|
const char *plist_name)
|
||||||
{
|
{
|
||||||
|
@ -768,7 +768,8 @@ distribute_list_reset ()
|
||||||
void
|
void
|
||||||
distribute_list_init (int node)
|
distribute_list_init (int node)
|
||||||
{
|
{
|
||||||
disthash = hash_create (distribute_hash_make, distribute_cmp);
|
disthash = hash_create ((unsigned int (*) (void *)) distribute_hash_make,
|
||||||
|
(int (*) (void *, void *)) distribute_cmp);
|
||||||
|
|
||||||
if(node==RIP_NODE) {
|
if(node==RIP_NODE) {
|
||||||
install_element (RIP_NODE, &distribute_list_all_cmd);
|
install_element (RIP_NODE, &distribute_list_all_cmd);
|
||||||
|
|
|
@ -43,15 +43,15 @@ struct distribute
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Prototypes for distribute-list. */
|
/* Prototypes for distribute-list. */
|
||||||
void distribute_list_init (int);
|
extern void distribute_list_init (int);
|
||||||
void distribute_list_reset (void);
|
extern void distribute_list_reset (void);
|
||||||
void distribute_list_add_hook (void (*) (struct distribute *));
|
extern void distribute_list_add_hook (void (*) (struct distribute *));
|
||||||
void distribute_list_delete_hook (void (*) (struct distribute *));
|
extern void distribute_list_delete_hook (void (*) (struct distribute *));
|
||||||
struct distribute *distribute_lookup (const char *);
|
extern struct distribute *distribute_lookup (const char *);
|
||||||
int config_write_distribute (struct vty *);
|
extern int config_write_distribute (struct vty *);
|
||||||
int config_show_distribute (struct vty *);
|
extern int config_show_distribute (struct vty *);
|
||||||
|
|
||||||
enum filter_type distribute_apply_in (struct interface *, struct prefix *);
|
extern enum filter_type distribute_apply_in (struct interface *, struct prefix *);
|
||||||
enum filter_type distribute_apply_out (struct interface *, struct prefix *);
|
extern enum filter_type distribute_apply_out (struct interface *, struct prefix *);
|
||||||
|
|
||||||
#endif /* _ZEBRA_DISTRIBUTE_H */
|
#endif /* _ZEBRA_DISTRIBUTE_H */
|
||||||
|
|
62
lib/filter.c
62
lib/filter.c
|
@ -84,10 +84,10 @@ struct access_master
|
||||||
struct access_list_list str;
|
struct access_list_list str;
|
||||||
|
|
||||||
/* Hook function which is executed when new access_list is added. */
|
/* Hook function which is executed when new access_list is added. */
|
||||||
void (*add_hook) ();
|
void (*add_hook) (struct access_list *);
|
||||||
|
|
||||||
/* Hook function which is executed when access_list is deleted. */
|
/* Hook function which is executed when access_list is deleted. */
|
||||||
void (*delete_hook) ();
|
void (*delete_hook) (struct access_list *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Static structure for IPv4 access_list's master. */
|
/* Static structure for IPv4 access_list's master. */
|
||||||
|
@ -110,7 +110,7 @@ static struct access_master access_master_ipv6 =
|
||||||
};
|
};
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
struct access_master *
|
static struct access_master *
|
||||||
access_master_get (afi_t afi)
|
access_master_get (afi_t afi)
|
||||||
{
|
{
|
||||||
if (afi == AFI_IP)
|
if (afi == AFI_IP)
|
||||||
|
@ -123,14 +123,14 @@ access_master_get (afi_t afi)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate new filter structure. */
|
/* Allocate new filter structure. */
|
||||||
struct filter *
|
static struct filter *
|
||||||
filter_new ()
|
filter_new (void)
|
||||||
{
|
{
|
||||||
return (struct filter *) XCALLOC (MTYPE_ACCESS_FILTER,
|
return (struct filter *) XCALLOC (MTYPE_ACCESS_FILTER,
|
||||||
sizeof (struct filter));
|
sizeof (struct filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
filter_free (struct filter *filter)
|
filter_free (struct filter *filter)
|
||||||
{
|
{
|
||||||
XFREE (MTYPE_ACCESS_FILTER, filter);
|
XFREE (MTYPE_ACCESS_FILTER, filter);
|
||||||
|
@ -209,22 +209,22 @@ filter_match_zebra (struct filter *mfilter, struct prefix *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate new access list structure. */
|
/* Allocate new access list structure. */
|
||||||
struct access_list *
|
static struct access_list *
|
||||||
access_list_new ()
|
access_list_new (void)
|
||||||
{
|
{
|
||||||
return (struct access_list *) XCALLOC (MTYPE_ACCESS_LIST,
|
return (struct access_list *) XCALLOC (MTYPE_ACCESS_LIST,
|
||||||
sizeof (struct access_list));
|
sizeof (struct access_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free allocated access_list. */
|
/* Free allocated access_list. */
|
||||||
void
|
static void
|
||||||
access_list_free (struct access_list *access)
|
access_list_free (struct access_list *access)
|
||||||
{
|
{
|
||||||
XFREE (MTYPE_ACCESS_LIST, access);
|
XFREE (MTYPE_ACCESS_LIST, access);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete access_list from access_master and free it. */
|
/* Delete access_list from access_master and free it. */
|
||||||
void
|
static void
|
||||||
access_list_delete (struct access_list *access)
|
access_list_delete (struct access_list *access)
|
||||||
{
|
{
|
||||||
struct filter *filter;
|
struct filter *filter;
|
||||||
|
@ -266,7 +266,7 @@ access_list_delete (struct access_list *access)
|
||||||
|
|
||||||
/* Insert new access list to list of access_list. Each acceess_list
|
/* Insert new access list to list of access_list. Each acceess_list
|
||||||
is sorted by the name. */
|
is sorted by the name. */
|
||||||
struct access_list *
|
static struct access_list *
|
||||||
access_list_insert (afi_t afi, const char *name)
|
access_list_insert (afi_t afi, const char *name)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -383,7 +383,7 @@ access_list_lookup (afi_t afi, const char *name)
|
||||||
|
|
||||||
/* Get access list from list of access_list. If there isn't matched
|
/* Get access list from list of access_list. If there isn't matched
|
||||||
access_list create new one and return it. */
|
access_list create new one and return it. */
|
||||||
struct access_list *
|
static struct access_list *
|
||||||
access_list_get (afi_t afi, const char *name)
|
access_list_get (afi_t afi, const char *name)
|
||||||
{
|
{
|
||||||
struct access_list *access;
|
struct access_list *access;
|
||||||
|
@ -444,7 +444,7 @@ access_list_delete_hook (void (*func) (struct access_list *access))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add new filter to the end of specified access_list. */
|
/* Add new filter to the end of specified access_list. */
|
||||||
void
|
static void
|
||||||
access_list_filter_add (struct access_list *access, struct filter *filter)
|
access_list_filter_add (struct access_list *access, struct filter *filter)
|
||||||
{
|
{
|
||||||
filter->next = NULL;
|
filter->next = NULL;
|
||||||
|
@ -473,7 +473,7 @@ access_list_empty (struct access_list *access)
|
||||||
|
|
||||||
/* Delete filter from specified access_list. If there is hook
|
/* Delete filter from specified access_list. If there is hook
|
||||||
function execute it. */
|
function execute it. */
|
||||||
void
|
static void
|
||||||
access_list_filter_delete (struct access_list *access, struct filter *filter)
|
access_list_filter_delete (struct access_list *access, struct filter *filter)
|
||||||
{
|
{
|
||||||
struct access_master *master;
|
struct access_master *master;
|
||||||
|
@ -513,7 +513,7 @@ access_list_filter_delete (struct access_list *access, struct filter *filter)
|
||||||
host A single host address
|
host A single host address
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct filter *
|
static struct filter *
|
||||||
filter_lookup_cisco (struct access_list *access, struct filter *mnew)
|
filter_lookup_cisco (struct access_list *access, struct filter *mnew)
|
||||||
{
|
{
|
||||||
struct filter *mfilter;
|
struct filter *mfilter;
|
||||||
|
@ -547,7 +547,7 @@ filter_lookup_cisco (struct access_list *access, struct filter *mnew)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct filter *
|
static struct filter *
|
||||||
filter_lookup_zebra (struct access_list *access, struct filter *mnew)
|
filter_lookup_zebra (struct access_list *access, struct filter *mnew)
|
||||||
{
|
{
|
||||||
struct filter *mfilter;
|
struct filter *mfilter;
|
||||||
|
@ -568,7 +568,7 @@ filter_lookup_zebra (struct access_list *access, struct filter *mnew)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
vty_access_list_remark_unset (struct vty *vty, afi_t afi, const char *name)
|
vty_access_list_remark_unset (struct vty *vty, afi_t afi, const char *name)
|
||||||
{
|
{
|
||||||
struct access_list *access;
|
struct access_list *access;
|
||||||
|
@ -593,7 +593,7 @@ vty_access_list_remark_unset (struct vty *vty, afi_t afi, const char *name)
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
filter_set_cisco (struct vty *vty, const char *name_str, const char *type_str,
|
filter_set_cisco (struct vty *vty, const char *name_str, const char *type_str,
|
||||||
const char *addr_str, const char *addr_mask_str,
|
const char *addr_str, const char *addr_mask_str,
|
||||||
const char *mask_str, const char *mask_mask_str,
|
const char *mask_str, const char *mask_mask_str,
|
||||||
|
@ -1152,7 +1152,7 @@ DEFUN (no_access_list_extended_host_any,
|
||||||
"255.255.255.255", 1, 0);
|
"255.255.255.255", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str,
|
filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str,
|
||||||
afi_t afi, const char *prefix_str, int exact, int set)
|
afi_t afi, const char *prefix_str, int exact, int set)
|
||||||
{
|
{
|
||||||
|
@ -1567,7 +1567,7 @@ void config_write_access_zebra (struct vty *, struct filter *);
|
||||||
void config_write_access_cisco (struct vty *, struct filter *);
|
void config_write_access_cisco (struct vty *, struct filter *);
|
||||||
|
|
||||||
/* show access-list command. */
|
/* show access-list command. */
|
||||||
int
|
static int
|
||||||
filter_show (struct vty *vty, const char *name, afi_t afi)
|
filter_show (struct vty *vty, const char *name, afi_t afi)
|
||||||
{
|
{
|
||||||
struct access_list *access;
|
struct access_list *access;
|
||||||
|
@ -1782,7 +1782,7 @@ config_write_access_zebra (struct vty *vty, struct filter *mfilter)
|
||||||
vty_out (vty, "%s", VTY_NEWLINE);
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
config_write_access (struct vty *vty, afi_t afi)
|
config_write_access (struct vty *vty, afi_t afi)
|
||||||
{
|
{
|
||||||
struct access_list *access;
|
struct access_list *access;
|
||||||
|
@ -1858,14 +1858,14 @@ struct cmd_node access_node =
|
||||||
1
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
static int
|
||||||
config_write_access_ipv4 (struct vty *vty)
|
config_write_access_ipv4 (struct vty *vty)
|
||||||
{
|
{
|
||||||
return config_write_access (vty, AFI_IP);
|
return config_write_access (vty, AFI_IP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
access_list_reset_ipv4 ()
|
access_list_reset_ipv4 (void)
|
||||||
{
|
{
|
||||||
struct access_list *access;
|
struct access_list *access;
|
||||||
struct access_list *next;
|
struct access_list *next;
|
||||||
|
@ -1894,8 +1894,8 @@ access_list_reset_ipv4 ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Install vty related command. */
|
/* Install vty related command. */
|
||||||
void
|
static void
|
||||||
access_list_init_ipv4 ()
|
access_list_init_ipv4 (void)
|
||||||
{
|
{
|
||||||
install_node (&access_node, config_write_access_ipv4);
|
install_node (&access_node, config_write_access_ipv4);
|
||||||
|
|
||||||
|
@ -1954,14 +1954,14 @@ struct cmd_node access_ipv6_node =
|
||||||
1
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
static int
|
||||||
config_write_access_ipv6 (struct vty *vty)
|
config_write_access_ipv6 (struct vty *vty)
|
||||||
{
|
{
|
||||||
return config_write_access (vty, AFI_IP6);
|
return config_write_access (vty, AFI_IP6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
access_list_reset_ipv6 ()
|
access_list_reset_ipv6 (void)
|
||||||
{
|
{
|
||||||
struct access_list *access;
|
struct access_list *access;
|
||||||
struct access_list *next;
|
struct access_list *next;
|
||||||
|
@ -1989,8 +1989,8 @@ access_list_reset_ipv6 ()
|
||||||
assert (master->str.tail == NULL);
|
assert (master->str.tail == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
access_list_init_ipv6 ()
|
access_list_init_ipv6 (void)
|
||||||
{
|
{
|
||||||
install_node (&access_ipv6_node, config_write_access_ipv6);
|
install_node (&access_ipv6_node, config_write_access_ipv6);
|
||||||
|
|
||||||
|
|
12
lib/filter.h
12
lib/filter.h
|
@ -57,11 +57,11 @@ struct access_list
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Prototypes for access-list. */
|
/* Prototypes for access-list. */
|
||||||
void access_list_init (void);
|
extern void access_list_init (void);
|
||||||
void access_list_reset (void);
|
extern void access_list_reset (void);
|
||||||
void access_list_add_hook (void (*func)(struct access_list *));
|
extern void access_list_add_hook (void (*func)(struct access_list *));
|
||||||
void access_list_delete_hook (void (*func)(struct access_list *));
|
extern void access_list_delete_hook (void (*func)(struct access_list *));
|
||||||
struct access_list *access_list_lookup (afi_t, const char *);
|
extern struct access_list *access_list_lookup (afi_t, const char *);
|
||||||
enum filter_type access_list_apply (struct access_list *, void *);
|
extern enum filter_type access_list_apply (struct access_list *, void *);
|
||||||
|
|
||||||
#endif /* _ZEBRA_FILTER_H */
|
#endif /* _ZEBRA_FILTER_H */
|
||||||
|
|
|
@ -105,7 +105,7 @@ struct option
|
||||||
errors, only prototype getopt for the GNU C library. */
|
errors, only prototype getopt for the GNU C library. */
|
||||||
extern int getopt (int argc, char *const *argv, const char *shortopts);
|
extern int getopt (int argc, char *const *argv, const char *shortopts);
|
||||||
#else /* not __GNU_LIBRARY__ */
|
#else /* not __GNU_LIBRARY__ */
|
||||||
extern int getopt ();
|
extern int getopt (void);
|
||||||
#endif /* __GNU_LIBRARY__ */
|
#endif /* __GNU_LIBRARY__ */
|
||||||
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
|
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
|
||||||
const struct option *longopts, int *longind);
|
const struct option *longopts, int *longind);
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
|
|
||||||
/* Allocate a new hash. */
|
/* Allocate a new hash. */
|
||||||
struct hash *
|
struct hash *
|
||||||
hash_create_size (unsigned int size,
|
hash_create_size (unsigned int size, unsigned int (*hash_key) (void *),
|
||||||
unsigned int (*hash_key) (), int (*hash_cmp) ())
|
int (*hash_cmp) (void *, void *))
|
||||||
{
|
{
|
||||||
struct hash *hash;
|
struct hash *hash;
|
||||||
|
|
||||||
|
@ -45,7 +45,8 @@ hash_create_size (unsigned int size,
|
||||||
|
|
||||||
/* Allocate a new hash with default hash size. */
|
/* Allocate a new hash with default hash size. */
|
||||||
struct hash *
|
struct hash *
|
||||||
hash_create (unsigned int (*hash_key) (), int (*hash_cmp) ())
|
hash_create (unsigned int (*hash_key) (void *),
|
||||||
|
int (*hash_cmp) (void *, void *))
|
||||||
{
|
{
|
||||||
return hash_create_size (HASHTABSIZE, hash_key, hash_cmp);
|
return hash_create_size (HASHTABSIZE, hash_key, hash_cmp);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +64,7 @@ hash_alloc_intern (void *arg)
|
||||||
corresponding hash backet and alloc_func is specified, create new
|
corresponding hash backet and alloc_func is specified, create new
|
||||||
hash backet. */
|
hash backet. */
|
||||||
void *
|
void *
|
||||||
hash_get (struct hash *hash, void *data, void * (*alloc_func) ())
|
hash_get (struct hash *hash, void *data, void * (*alloc_func) (void *))
|
||||||
{
|
{
|
||||||
unsigned int key;
|
unsigned int key;
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
|
|
24
lib/hash.h
24
lib/hash.h
|
@ -45,27 +45,29 @@ struct hash
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
|
|
||||||
/* Key make function. */
|
/* Key make function. */
|
||||||
unsigned int (*hash_key) ();
|
unsigned int (*hash_key) (void *);
|
||||||
|
|
||||||
/* Data compare function. */
|
/* Data compare function. */
|
||||||
int (*hash_cmp) ();
|
int (*hash_cmp) (void *, void *);
|
||||||
|
|
||||||
/* Backet alloc. */
|
/* Backet alloc. */
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct hash *hash_create (unsigned int (*) (), int (*) ());
|
extern struct hash *hash_create (unsigned int (*) (void *),
|
||||||
struct hash *hash_create_size (unsigned int, unsigned int (*) (), int (*) ());
|
int (*) (void *, void *));
|
||||||
|
extern struct hash *hash_create_size (unsigned int, unsigned int (*) (void *),
|
||||||
|
int (*) (void *, void *));
|
||||||
|
|
||||||
void *hash_get (struct hash *, void *, void * (*) ());
|
extern void *hash_get (struct hash *, void *, void * (*) (void *));
|
||||||
void *hash_alloc_intern (void *);
|
extern void *hash_alloc_intern (void *);
|
||||||
void *hash_lookup (struct hash *, void *);
|
extern void *hash_lookup (struct hash *, void *);
|
||||||
void *hash_release (struct hash *, void *);
|
extern void *hash_release (struct hash *, void *);
|
||||||
|
|
||||||
void hash_iterate (struct hash *,
|
extern void hash_iterate (struct hash *,
|
||||||
void (*) (struct hash_backet *, void *), void *);
|
void (*) (struct hash_backet *, void *), void *);
|
||||||
|
|
||||||
void hash_clean (struct hash *, void (*) (void *));
|
extern void hash_clean (struct hash *, void (*) (void *));
|
||||||
void hash_free (struct hash *);
|
extern void hash_free (struct hash *);
|
||||||
|
|
||||||
#endif /* _ZEBRA_HASH_H */
|
#endif /* _ZEBRA_HASH_H */
|
||||||
|
|
28
lib/if.c
28
lib/if.c
|
@ -191,13 +191,13 @@ if_lookup_by_index (unsigned int index)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
ifindex2ifname (unsigned int index)
|
ifindex2ifname (unsigned int index)
|
||||||
{
|
{
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
|
||||||
return ((ifp = if_lookup_by_index(index)) != NULL) ?
|
return ((ifp = if_lookup_by_index(index)) != NULL) ?
|
||||||
ifp->name : (char *)"unknown";
|
ifp->name : "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
|
@ -434,7 +434,7 @@ if_flag_dump (unsigned long flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For debugging */
|
/* For debugging */
|
||||||
void
|
static void
|
||||||
if_dump (struct interface *ifp)
|
if_dump (struct interface *ifp)
|
||||||
{
|
{
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
|
@ -587,7 +587,7 @@ DEFUN (show_address,
|
||||||
|
|
||||||
/* Allocate connected structure. */
|
/* Allocate connected structure. */
|
||||||
struct connected *
|
struct connected *
|
||||||
connected_new ()
|
connected_new (void)
|
||||||
{
|
{
|
||||||
struct connected *new = XMALLOC (MTYPE_CONNECTED, sizeof (struct connected));
|
struct connected *new = XMALLOC (MTYPE_CONNECTED, sizeof (struct connected));
|
||||||
memset (new, 0, sizeof (struct connected));
|
memset (new, 0, sizeof (struct connected));
|
||||||
|
@ -611,7 +611,7 @@ connected_free (struct connected *connected)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print if_addr structure. */
|
/* Print if_addr structure. */
|
||||||
void
|
static void __attribute__ ((unused))
|
||||||
connected_log (struct connected *connected, char *str)
|
connected_log (struct connected *connected, char *str)
|
||||||
{
|
{
|
||||||
struct prefix *p;
|
struct prefix *p;
|
||||||
|
@ -637,7 +637,7 @@ connected_log (struct connected *connected, char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If two connected address has same prefix return 1. */
|
/* If two connected address has same prefix return 1. */
|
||||||
int
|
static int
|
||||||
connected_same_prefix (struct prefix *p1, struct prefix *p2)
|
connected_same_prefix (struct prefix *p1, struct prefix *p2)
|
||||||
{
|
{
|
||||||
if (p1->family == p2->family)
|
if (p1->family == p2->family)
|
||||||
|
@ -767,13 +767,16 @@ if_indextoname (unsigned int ifindex, char *name)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0 /* this route_table of struct connected's is unused
|
||||||
|
* however, it would be good to use a route_table rather than
|
||||||
|
* a list..
|
||||||
|
*/
|
||||||
/* Interface looking up by interface's address. */
|
/* Interface looking up by interface's address. */
|
||||||
|
|
||||||
/* Interface's IPv4 address reverse lookup table. */
|
/* Interface's IPv4 address reverse lookup table. */
|
||||||
struct route_table *ifaddr_ipv4_table;
|
struct route_table *ifaddr_ipv4_table;
|
||||||
/* struct route_table *ifaddr_ipv6_table; */
|
/* struct route_table *ifaddr_ipv6_table; */
|
||||||
|
|
||||||
void
|
static void
|
||||||
ifaddr_ipv4_add (struct in_addr *ifaddr, struct interface *ifp)
|
ifaddr_ipv4_add (struct in_addr *ifaddr, struct interface *ifp)
|
||||||
{
|
{
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
|
@ -794,7 +797,7 @@ ifaddr_ipv4_add (struct in_addr *ifaddr, struct interface *ifp)
|
||||||
rn->info = ifp;
|
rn->info = ifp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ifaddr_ipv4_delete (struct in_addr *ifaddr, struct interface *ifp)
|
ifaddr_ipv4_delete (struct in_addr *ifaddr, struct interface *ifp)
|
||||||
{
|
{
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
|
@ -817,7 +820,7 @@ ifaddr_ipv4_delete (struct in_addr *ifaddr, struct interface *ifp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup interface by interface's IP address or interface index. */
|
/* Lookup interface by interface's IP address or interface index. */
|
||||||
struct interface *
|
static struct interface *
|
||||||
ifaddr_ipv4_lookup (struct in_addr *addr, unsigned int ifindex)
|
ifaddr_ipv4_lookup (struct in_addr *addr, unsigned int ifindex)
|
||||||
{
|
{
|
||||||
struct prefix_ipv4 p;
|
struct prefix_ipv4 p;
|
||||||
|
@ -841,13 +844,16 @@ ifaddr_ipv4_lookup (struct in_addr *addr, unsigned int ifindex)
|
||||||
else
|
else
|
||||||
return if_lookup_by_index(ifindex);
|
return if_lookup_by_index(ifindex);
|
||||||
}
|
}
|
||||||
|
#endif /* ifaddr_ipv4_table */
|
||||||
|
|
||||||
/* Initialize interface list. */
|
/* Initialize interface list. */
|
||||||
void
|
void
|
||||||
if_init ()
|
if_init (void)
|
||||||
{
|
{
|
||||||
iflist = list_new ();
|
iflist = list_new ();
|
||||||
|
#if 0
|
||||||
ifaddr_ipv4_table = route_table_init ();
|
ifaddr_ipv4_table = route_table_init ();
|
||||||
|
#endif /* ifaddr_ipv4_table */
|
||||||
|
|
||||||
if (iflist) {
|
if (iflist) {
|
||||||
iflist->cmp = (int (*)(void *, void *))if_cmp_func;
|
iflist->cmp = (int (*)(void *, void *))if_cmp_func;
|
||||||
|
|
52
lib/if.h
52
lib/if.h
|
@ -211,16 +211,16 @@ struct connected
|
||||||
#endif /* IFF_VIRTUAL */
|
#endif /* IFF_VIRTUAL */
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
int if_cmp_func (struct interface *, struct interface *);
|
extern int if_cmp_func (struct interface *, struct interface *);
|
||||||
struct interface *if_create (const char *name, int namelen);
|
extern struct interface *if_create (const char *name, int namelen);
|
||||||
struct interface *if_lookup_by_index (unsigned int);
|
extern struct interface *if_lookup_by_index (unsigned int);
|
||||||
struct interface *if_lookup_exact_address (struct in_addr);
|
extern struct interface *if_lookup_exact_address (struct in_addr);
|
||||||
struct interface *if_lookup_address (struct in_addr);
|
extern struct interface *if_lookup_address (struct in_addr);
|
||||||
|
|
||||||
/* These 2 functions are to be used when the ifname argument is terminated
|
/* These 2 functions are to be used when the ifname argument is terminated
|
||||||
by a '\0' character: */
|
by a '\0' character: */
|
||||||
struct interface *if_lookup_by_name (const char *ifname);
|
extern struct interface *if_lookup_by_name (const char *ifname);
|
||||||
struct interface *if_get_by_name (const char *ifname);
|
extern struct interface *if_get_by_name (const char *ifname);
|
||||||
|
|
||||||
/* For these 2 functions, the namelen argument should be the precise length
|
/* For these 2 functions, the namelen argument should be the precise length
|
||||||
of the ifname string (not counting any optional trailing '\0' character).
|
of the ifname string (not counting any optional trailing '\0' character).
|
||||||
|
@ -239,22 +239,22 @@ extern void if_delete_retain (struct interface *);
|
||||||
deletes it from the interface list and frees the structure. */
|
deletes it from the interface list and frees the structure. */
|
||||||
extern void if_delete (struct interface *);
|
extern void if_delete (struct interface *);
|
||||||
|
|
||||||
int if_is_up (struct interface *);
|
extern int if_is_up (struct interface *);
|
||||||
int if_is_running (struct interface *);
|
extern int if_is_running (struct interface *);
|
||||||
int if_is_operative (struct interface *);
|
extern int if_is_operative (struct interface *);
|
||||||
int if_is_loopback (struct interface *);
|
extern int if_is_loopback (struct interface *);
|
||||||
int if_is_broadcast (struct interface *);
|
extern int if_is_broadcast (struct interface *);
|
||||||
int if_is_pointopoint (struct interface *);
|
extern int if_is_pointopoint (struct interface *);
|
||||||
int if_is_multicast (struct interface *);
|
extern int if_is_multicast (struct interface *);
|
||||||
void if_add_hook (int, int (*)(struct interface *));
|
extern void if_add_hook (int, int (*)(struct interface *));
|
||||||
void if_init ();
|
extern void if_init (void);
|
||||||
void if_dump_all ();
|
extern void if_dump_all (void);
|
||||||
extern const char *if_flag_dump(unsigned long);
|
extern const char *if_flag_dump(unsigned long);
|
||||||
|
|
||||||
/* Please use ifindex2ifname instead of if_indextoname where possible;
|
/* Please use ifindex2ifname instead of if_indextoname where possible;
|
||||||
ifindex2ifname uses internal interface info, whereas if_indextoname must
|
ifindex2ifname uses internal interface info, whereas if_indextoname must
|
||||||
make a system call. */
|
make a system call. */
|
||||||
extern char *ifindex2ifname (unsigned int);
|
extern const char *ifindex2ifname (unsigned int);
|
||||||
|
|
||||||
/* Please use ifname2ifindex instead of if_nametoindex where possible;
|
/* Please use ifname2ifindex instead of if_nametoindex where possible;
|
||||||
ifname2ifindex uses internal interface info, whereas if_nametoindex must
|
ifname2ifindex uses internal interface info, whereas if_nametoindex must
|
||||||
|
@ -262,22 +262,22 @@ extern char *ifindex2ifname (unsigned int);
|
||||||
extern unsigned int ifname2ifindex(const char *ifname);
|
extern unsigned int ifname2ifindex(const char *ifname);
|
||||||
|
|
||||||
/* Connected address functions. */
|
/* Connected address functions. */
|
||||||
struct connected *connected_new ();
|
extern struct connected *connected_new (void);
|
||||||
void connected_free (struct connected *);
|
extern void connected_free (struct connected *);
|
||||||
void connected_add (struct interface *, struct connected *);
|
extern void connected_add (struct interface *, struct connected *);
|
||||||
struct connected *connected_add_by_prefix (struct interface *,
|
extern struct connected *connected_add_by_prefix (struct interface *,
|
||||||
struct prefix *,
|
struct prefix *,
|
||||||
struct prefix *);
|
struct prefix *);
|
||||||
struct connected *connected_delete_by_prefix (struct interface *,
|
extern struct connected *connected_delete_by_prefix (struct interface *,
|
||||||
struct prefix *);
|
struct prefix *);
|
||||||
struct connected *connected_lookup_address (struct interface *,
|
extern struct connected *connected_lookup_address (struct interface *,
|
||||||
struct in_addr);
|
struct in_addr);
|
||||||
|
|
||||||
#ifndef HAVE_IF_NAMETOINDEX
|
#ifndef HAVE_IF_NAMETOINDEX
|
||||||
unsigned int if_nametoindex (const char *);
|
extern unsigned int if_nametoindex (const char *);
|
||||||
#endif
|
#endif
|
||||||
#ifndef HAVE_IF_INDEXTONAME
|
#ifndef HAVE_IF_INDEXTONAME
|
||||||
char *if_indextoname (unsigned int, char *);
|
extern char *if_indextoname (unsigned int, char *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Exported variables. */
|
/* Exported variables. */
|
||||||
|
|
|
@ -30,11 +30,11 @@
|
||||||
struct hash *ifrmaphash;
|
struct hash *ifrmaphash;
|
||||||
|
|
||||||
/* Hook functions. */
|
/* Hook functions. */
|
||||||
void (*if_rmap_add_hook) (struct if_rmap *) = NULL;
|
static void (*if_rmap_add_hook) (struct if_rmap *) = NULL;
|
||||||
void (*if_rmap_delete_hook) (struct if_rmap *) = NULL;
|
static void (*if_rmap_delete_hook) (struct if_rmap *) = NULL;
|
||||||
|
|
||||||
struct if_rmap *
|
static struct if_rmap *
|
||||||
if_rmap_new ()
|
if_rmap_new (void)
|
||||||
{
|
{
|
||||||
struct if_rmap *new;
|
struct if_rmap *new;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ if_rmap_new ()
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
if_rmap_free (struct if_rmap *if_rmap)
|
if_rmap_free (struct if_rmap *if_rmap)
|
||||||
{
|
{
|
||||||
if (if_rmap->ifname)
|
if (if_rmap->ifname)
|
||||||
|
@ -83,18 +83,19 @@ if_rmap_hook_delete (void (*func) (struct if_rmap *))
|
||||||
if_rmap_delete_hook = func;
|
if_rmap_delete_hook = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
static void *
|
||||||
if_rmap_hash_alloc (struct if_rmap *arg)
|
if_rmap_hash_alloc (void *arg)
|
||||||
{
|
{
|
||||||
|
struct if_rmap *ifarg = arg;
|
||||||
struct if_rmap *if_rmap;
|
struct if_rmap *if_rmap;
|
||||||
|
|
||||||
if_rmap = if_rmap_new ();
|
if_rmap = if_rmap_new ();
|
||||||
if_rmap->ifname = strdup (arg->ifname);
|
if_rmap->ifname = strdup (ifarg->ifname);
|
||||||
|
|
||||||
return if_rmap;
|
return if_rmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct if_rmap *
|
static struct if_rmap *
|
||||||
if_rmap_get (const char *ifname)
|
if_rmap_get (const char *ifname)
|
||||||
{
|
{
|
||||||
struct if_rmap key;
|
struct if_rmap key;
|
||||||
|
@ -105,9 +106,10 @@ if_rmap_get (const char *ifname)
|
||||||
return (struct if_rmap *) hash_get (ifrmaphash, &key, if_rmap_hash_alloc);
|
return (struct if_rmap *) hash_get (ifrmaphash, &key, if_rmap_hash_alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
static unsigned int
|
||||||
if_rmap_hash_make (struct if_rmap *if_rmap)
|
if_rmap_hash_make (void *data)
|
||||||
{
|
{
|
||||||
|
struct if_rmap *if_rmap = data;
|
||||||
unsigned int i, key;
|
unsigned int i, key;
|
||||||
|
|
||||||
key = 0;
|
key = 0;
|
||||||
|
@ -117,15 +119,17 @@ if_rmap_hash_make (struct if_rmap *if_rmap)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
if_rmap_hash_cmp (struct if_rmap *if_rmap1, struct if_rmap *if_rmap2)
|
if_rmap_hash_cmp (void *arg1, void* arg2)
|
||||||
{
|
{
|
||||||
|
struct if_rmap *if_rmap1 = arg1;
|
||||||
|
struct if_rmap *if_rmap2 = arg2;
|
||||||
if (strcmp (if_rmap1->ifname, if_rmap2->ifname) == 0)
|
if (strcmp (if_rmap1->ifname, if_rmap2->ifname) == 0)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct if_rmap *
|
static struct if_rmap *
|
||||||
if_rmap_set (const char *ifname, enum if_rmap_type type,
|
if_rmap_set (const char *ifname, enum if_rmap_type type,
|
||||||
const char *routemap_name)
|
const char *routemap_name)
|
||||||
{
|
{
|
||||||
|
@ -152,7 +156,7 @@ if_rmap_set (const char *ifname, enum if_rmap_type type,
|
||||||
return if_rmap;
|
return if_rmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
if_rmap_unset (const char *ifname, enum if_rmap_type type,
|
if_rmap_unset (const char *ifname, enum if_rmap_type type,
|
||||||
const char *routemap_name)
|
const char *routemap_name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,11 +37,11 @@ struct if_rmap
|
||||||
char *routemap[IF_RMAP_MAX];
|
char *routemap[IF_RMAP_MAX];
|
||||||
};
|
};
|
||||||
|
|
||||||
void if_rmap_init (int);
|
extern void if_rmap_init (int);
|
||||||
void if_rmap_reset (void);
|
extern void if_rmap_reset (void);
|
||||||
void if_rmap_hook_add (void (*) (struct if_rmap *));
|
extern void if_rmap_hook_add (void (*) (struct if_rmap *));
|
||||||
void if_rmap_hook_delete (void (*) (struct if_rmap *));
|
extern void if_rmap_hook_delete (void (*) (struct if_rmap *));
|
||||||
struct if_rmap *if_rmap_lookup (const char *);
|
extern struct if_rmap *if_rmap_lookup (const char *);
|
||||||
int config_write_if_rmap (struct vty *);
|
extern int config_write_if_rmap (struct vty *);
|
||||||
|
|
||||||
#endif /* _ZEBRA_IF_RMAP_H */
|
#endif /* _ZEBRA_IF_RMAP_H */
|
||||||
|
|
10
lib/jhash.h
10
lib/jhash.h
|
@ -24,12 +24,12 @@
|
||||||
* of bytes. No alignment or length assumptions are made about
|
* of bytes. No alignment or length assumptions are made about
|
||||||
* the input key.
|
* the input key.
|
||||||
*/
|
*/
|
||||||
u_int32_t jhash(void *key, u_int32_t length, u_int32_t initval);
|
extern u_int32_t jhash(void *key, u_int32_t length, u_int32_t initval);
|
||||||
|
|
||||||
/* A special optimized version that handles 1 or more of u_int32_ts.
|
/* A special optimized version that handles 1 or more of u_int32_ts.
|
||||||
* The length parameter here is the number of u_int32_ts in the key.
|
* The length parameter here is the number of u_int32_ts in the key.
|
||||||
*/
|
*/
|
||||||
u_int32_t jhash2(u_int32_t *k, u_int32_t length, u_int32_t initval);
|
extern u_int32_t jhash2(u_int32_t *k, u_int32_t length, u_int32_t initval);
|
||||||
|
|
||||||
/* A special ultra-optimized versions that knows they are hashing exactly
|
/* A special ultra-optimized versions that knows they are hashing exactly
|
||||||
* 3, 2 or 1 word(s).
|
* 3, 2 or 1 word(s).
|
||||||
|
@ -37,8 +37,8 @@ u_int32_t jhash2(u_int32_t *k, u_int32_t length, u_int32_t initval);
|
||||||
* NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally
|
* NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally
|
||||||
* done at the end is not done here.
|
* done at the end is not done here.
|
||||||
*/
|
*/
|
||||||
u_int32_t jhash_3words(u_int32_t a, u_int32_t b, u_int32_t c, u_int32_t initval);
|
extern u_int32_t jhash_3words(u_int32_t a, u_int32_t b, u_int32_t c, u_int32_t initval);
|
||||||
u_int32_t jhash_2words(u_int32_t a, u_int32_t b, u_int32_t initval);
|
extern u_int32_t jhash_2words(u_int32_t a, u_int32_t b, u_int32_t initval);
|
||||||
u_int32_t jhash_1word(u_int32_t a, u_int32_t initval);
|
extern u_int32_t jhash_1word(u_int32_t a, u_int32_t initval);
|
||||||
|
|
||||||
#endif /* _QUAGGA_JHASH_H */
|
#endif /* _QUAGGA_JHASH_H */
|
||||||
|
|
|
@ -28,8 +28,8 @@ Boston, MA 02111-1307, USA. */
|
||||||
/* Master list of key chain. */
|
/* Master list of key chain. */
|
||||||
struct list *keychain_list;
|
struct list *keychain_list;
|
||||||
|
|
||||||
struct keychain *
|
static struct keychain *
|
||||||
keychain_new ()
|
keychain_new (void)
|
||||||
{
|
{
|
||||||
struct keychain *new;
|
struct keychain *new;
|
||||||
new = XMALLOC (MTYPE_KEYCHAIN, sizeof (struct keychain));
|
new = XMALLOC (MTYPE_KEYCHAIN, sizeof (struct keychain));
|
||||||
|
@ -37,14 +37,14 @@ keychain_new ()
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
keychain_free (struct keychain *keychain)
|
keychain_free (struct keychain *keychain)
|
||||||
{
|
{
|
||||||
XFREE (MTYPE_KEYCHAIN, keychain);
|
XFREE (MTYPE_KEYCHAIN, keychain);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct key *
|
static struct key *
|
||||||
key_new ()
|
key_new (void)
|
||||||
{
|
{
|
||||||
struct key *new;
|
struct key *new;
|
||||||
new = XMALLOC (MTYPE_KEY, sizeof (struct key));
|
new = XMALLOC (MTYPE_KEY, sizeof (struct key));
|
||||||
|
@ -52,7 +52,7 @@ key_new ()
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
key_free (struct key *key)
|
key_free (struct key *key)
|
||||||
{
|
{
|
||||||
XFREE (MTYPE_KEY, key);
|
XFREE (MTYPE_KEY, key);
|
||||||
|
@ -75,9 +75,12 @@ keychain_lookup (const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
key_cmp_func (const struct key *k1, const struct key *k2)
|
key_cmp_func (void *arg1, void *arg2)
|
||||||
{
|
{
|
||||||
|
const struct key *k1 = arg1;
|
||||||
|
const struct key *k2 = arg2;
|
||||||
|
|
||||||
if (k1->index > k2->index)
|
if (k1->index > k2->index)
|
||||||
return 1;
|
return 1;
|
||||||
if (k1->index < k2->index)
|
if (k1->index < k2->index)
|
||||||
|
@ -85,7 +88,7 @@ key_cmp_func (const struct key *k1, const struct key *k2)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
key_delete_func (struct key *key)
|
key_delete_func (struct key *key)
|
||||||
{
|
{
|
||||||
if (key->string)
|
if (key->string)
|
||||||
|
@ -93,7 +96,7 @@ key_delete_func (struct key *key)
|
||||||
key_free (key);
|
key_free (key);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct keychain *
|
static struct keychain *
|
||||||
keychain_get (const char *name)
|
keychain_get (const char *name)
|
||||||
{
|
{
|
||||||
struct keychain *keychain;
|
struct keychain *keychain;
|
||||||
|
@ -113,7 +116,7 @@ keychain_get (const char *name)
|
||||||
return keychain;
|
return keychain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
keychain_delete (struct keychain *keychain)
|
keychain_delete (struct keychain *keychain)
|
||||||
{
|
{
|
||||||
if (keychain->name)
|
if (keychain->name)
|
||||||
|
@ -124,7 +127,7 @@ keychain_delete (struct keychain *keychain)
|
||||||
keychain_free (keychain);
|
keychain_free (keychain);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct key *
|
static struct key *
|
||||||
key_lookup (const struct keychain *keychain, u_int32_t index)
|
key_lookup (const struct keychain *keychain, u_int32_t index)
|
||||||
{
|
{
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
|
@ -203,7 +206,7 @@ key_lookup_for_send (const struct keychain *keychain)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct key *
|
static struct key *
|
||||||
key_get (const struct keychain *keychain, u_int32_t index)
|
key_get (const struct keychain *keychain, u_int32_t index)
|
||||||
{
|
{
|
||||||
struct key *key;
|
struct key *key;
|
||||||
|
@ -220,7 +223,7 @@ key_get (const struct keychain *keychain, u_int32_t index)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
key_delete (struct keychain *keychain, struct key *key)
|
key_delete (struct keychain *keychain, struct key *key)
|
||||||
{
|
{
|
||||||
listnode_delete (keychain->key, key);
|
listnode_delete (keychain->key, key);
|
||||||
|
@ -356,7 +359,7 @@ DEFUN (no_key_string,
|
||||||
|
|
||||||
/* Convert HH:MM:SS MON DAY YEAR to time_t value. -1 is returned when
|
/* Convert HH:MM:SS MON DAY YEAR to time_t value. -1 is returned when
|
||||||
given string is malformed. */
|
given string is malformed. */
|
||||||
time_t
|
static time_t
|
||||||
key_str2time (const char *time_str, const char *day_str, const char *month_str,
|
key_str2time (const char *time_str, const char *day_str, const char *month_str,
|
||||||
const char *year_str)
|
const char *year_str)
|
||||||
{
|
{
|
||||||
|
@ -366,7 +369,6 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
|
||||||
time_t time;
|
time_t time;
|
||||||
unsigned int sec, min, hour;
|
unsigned int sec, min, hour;
|
||||||
unsigned int day, month, year;
|
unsigned int day, month, year;
|
||||||
char *endptr = NULL;
|
|
||||||
|
|
||||||
const char *month_name[] =
|
const char *month_name[] =
|
||||||
{
|
{
|
||||||
|
@ -385,6 +387,18 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define GET_LONG_RANGE(V,STR,MIN,MAX) \
|
||||||
|
{ \
|
||||||
|
unsigned long tmpl; \
|
||||||
|
char *endptr = NULL; \
|
||||||
|
tmpl = strtoul ((STR), &endptr, 10); \
|
||||||
|
if (*endptr != '\0' || tmpl == ULONG_MAX) \
|
||||||
|
return -1; \
|
||||||
|
if ( tmpl < (MIN) || tmpl > (MAX)) \
|
||||||
|
return -1; \
|
||||||
|
(V) = tmpl; \
|
||||||
|
}
|
||||||
|
|
||||||
/* Check hour field of time_str. */
|
/* Check hour field of time_str. */
|
||||||
colon = strchr (time_str, ':');
|
colon = strchr (time_str, ':');
|
||||||
if (colon == NULL)
|
if (colon == NULL)
|
||||||
|
@ -392,9 +406,7 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
|
||||||
*colon = '\0';
|
*colon = '\0';
|
||||||
|
|
||||||
/* Hour must be between 0 and 23. */
|
/* Hour must be between 0 and 23. */
|
||||||
hour = strtoul (time_str, &endptr, 10);
|
GET_LONG_RANGE (hour, time_str, 0, 23);
|
||||||
if (hour == ULONG_MAX || *endptr != '\0' || hour < 0 || hour > 23)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Check min field of time_str. */
|
/* Check min field of time_str. */
|
||||||
time_str = colon + 1;
|
time_str = colon + 1;
|
||||||
|
@ -404,9 +416,7 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
|
||||||
*colon = '\0';
|
*colon = '\0';
|
||||||
|
|
||||||
/* Min must be between 0 and 59. */
|
/* Min must be between 0 and 59. */
|
||||||
min = strtoul (time_str, &endptr, 10);
|
GET_LONG_RANGE (min, time_str, 0, 59);
|
||||||
if (min == ULONG_MAX || *endptr != '\0' || min < 0 || min > 59)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Check sec field of time_str. */
|
/* Check sec field of time_str. */
|
||||||
time_str = colon + 1;
|
time_str = colon + 1;
|
||||||
|
@ -414,14 +424,10 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Sec must be between 0 and 59. */
|
/* Sec must be between 0 and 59. */
|
||||||
sec = strtoul (time_str, &endptr, 10);
|
GET_LONG_RANGE (sec, time_str, 0, 59);
|
||||||
if (sec == ULONG_MAX || *endptr != '\0' || sec < 0 || sec > 59)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Check day_str. Day must be <1-31>. */
|
/* Check day_str. Day must be <1-31>. */
|
||||||
day = strtoul (day_str, &endptr, 10);
|
GET_LONG_RANGE (day, day_str, 1, 31);
|
||||||
if (day == ULONG_MAX || *endptr != '\0' || day < 0 || day > 31)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Check month_str. Month must match month_name. */
|
/* Check month_str. Month must match month_name. */
|
||||||
month = 0;
|
month = 0;
|
||||||
|
@ -436,9 +442,7 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Check year_str. Year must be <1993-2035>. */
|
/* Check year_str. Year must be <1993-2035>. */
|
||||||
year = strtoul (year_str, &endptr, 10);
|
GET_LONG_RANGE (year, year_str, 1993, 2035);
|
||||||
if (year == ULONG_MAX || *endptr != '\0' || year < 1993 || year > 2035)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
memset (&tm, 0, sizeof (struct tm));
|
memset (&tm, 0, sizeof (struct tm));
|
||||||
tm.tm_sec = sec;
|
tm.tm_sec = sec;
|
||||||
|
@ -451,9 +455,10 @@ key_str2time (const char *time_str, const char *day_str, const char *month_str,
|
||||||
time = mktime (&tm);
|
time = mktime (&tm);
|
||||||
|
|
||||||
return time;
|
return time;
|
||||||
|
#undef GET_LONG_RANGE
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
key_lifetime_set (struct vty *vty, struct key_range *krange,
|
key_lifetime_set (struct vty *vty, struct key_range *krange,
|
||||||
const char *stime_str, const char *sday_str,
|
const char *stime_str, const char *sday_str,
|
||||||
const char *smonth_str, const char *syear_str,
|
const char *smonth_str, const char *syear_str,
|
||||||
|
@ -489,7 +494,7 @@ key_lifetime_set (struct vty *vty, struct key_range *krange,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
key_lifetime_duration_set (struct vty *vty, struct key_range *krange,
|
key_lifetime_duration_set (struct vty *vty, struct key_range *krange,
|
||||||
const char *stime_str, const char *sday_str,
|
const char *stime_str, const char *sday_str,
|
||||||
const char *smonth_str, const char *syear_str,
|
const char *smonth_str, const char *syear_str,
|
||||||
|
@ -513,7 +518,7 @@ key_lifetime_duration_set (struct vty *vty, struct key_range *krange,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
key_lifetime_infinite_set (struct vty *vty, struct key_range *krange,
|
key_lifetime_infinite_set (struct vty *vty, struct key_range *krange,
|
||||||
const char *stime_str, const char *sday_str,
|
const char *stime_str, const char *sday_str,
|
||||||
const char *smonth_str, const char *syear_str)
|
const char *smonth_str, const char *syear_str)
|
||||||
|
@ -863,7 +868,7 @@ struct cmd_node keychain_key_node =
|
||||||
1
|
1
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
static int
|
||||||
keychain_strftime (char *buf, int bufsiz, time_t *time)
|
keychain_strftime (char *buf, int bufsiz, time_t *time)
|
||||||
{
|
{
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
|
@ -876,7 +881,7 @@ keychain_strftime (char *buf, int bufsiz, time_t *time)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
keychain_config_write (struct vty *vty)
|
keychain_config_write (struct vty *vty)
|
||||||
{
|
{
|
||||||
struct keychain *keychain;
|
struct keychain *keychain;
|
||||||
|
|
|
@ -47,10 +47,10 @@ struct key
|
||||||
struct key_range accept;
|
struct key_range accept;
|
||||||
};
|
};
|
||||||
|
|
||||||
void keychain_init ();
|
extern void keychain_init (void);
|
||||||
struct keychain *keychain_lookup (const char *);
|
extern struct keychain *keychain_lookup (const char *);
|
||||||
struct key *key_lookup_for_accept (const struct keychain *, u_int32_t);
|
extern struct key *key_lookup_for_accept (const struct keychain *, u_int32_t);
|
||||||
struct key *key_match_for_accept (const struct keychain *, const char *);
|
extern struct key *key_match_for_accept (const struct keychain *, const char *);
|
||||||
struct key *key_lookup_for_send (const struct keychain *);
|
extern struct key *key_lookup_for_send (const struct keychain *);
|
||||||
|
|
||||||
#endif /* _ZEBRA_KEYCHAIN_H */
|
#endif /* _ZEBRA_KEYCHAIN_H */
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
/* Allocate new list. */
|
/* Allocate new list. */
|
||||||
struct list *
|
struct list *
|
||||||
list_new ()
|
list_new (void)
|
||||||
{
|
{
|
||||||
struct list *new;
|
struct list *new;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ list_free (struct list *l)
|
||||||
|
|
||||||
/* Allocate new listnode. Internal use only. */
|
/* Allocate new listnode. Internal use only. */
|
||||||
static struct listnode *
|
static struct listnode *
|
||||||
listnode_new ()
|
listnode_new (void)
|
||||||
{
|
{
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
|
|
||||||
|
|
|
@ -62,26 +62,26 @@ struct list
|
||||||
#define listgetdata(X) (assert((X)->data != NULL), (X)->data)
|
#define listgetdata(X) (assert((X)->data != NULL), (X)->data)
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
struct list *list_new(); /* encouraged: set list.del callback on new lists */
|
extern struct list *list_new(void); /* encouraged: set list.del callback on new lists */
|
||||||
void list_free (struct list *);
|
extern void list_free (struct list *);
|
||||||
|
|
||||||
void listnode_add (struct list *, void *);
|
extern void listnode_add (struct list *, void *);
|
||||||
void listnode_add_sort (struct list *, void *);
|
extern void listnode_add_sort (struct list *, void *);
|
||||||
void listnode_add_after (struct list *, struct listnode *, void *);
|
extern void listnode_add_after (struct list *, struct listnode *, void *);
|
||||||
void listnode_delete (struct list *, void *);
|
extern void listnode_delete (struct list *, void *);
|
||||||
struct listnode *listnode_lookup (struct list *, void *);
|
extern struct listnode *listnode_lookup (struct list *, void *);
|
||||||
void *listnode_head (struct list *);
|
extern void *listnode_head (struct list *);
|
||||||
|
|
||||||
void list_delete (struct list *);
|
extern void list_delete (struct list *);
|
||||||
void list_delete_all_node (struct list *);
|
extern void list_delete_all_node (struct list *);
|
||||||
|
|
||||||
/* For ospfd and ospf6d. */
|
/* For ospfd and ospf6d. */
|
||||||
void list_delete_node (struct list *, struct listnode *);
|
extern void list_delete_node (struct list *, struct listnode *);
|
||||||
|
|
||||||
/* For ospf_spf.c */
|
/* For ospf_spf.c */
|
||||||
void list_add_node_prev (struct list *, struct listnode *, void *);
|
extern void list_add_node_prev (struct list *, struct listnode *, void *);
|
||||||
void list_add_node_next (struct list *, struct listnode *, void *);
|
extern void list_add_node_next (struct list *, struct listnode *, void *);
|
||||||
void list_add_list (struct list *, struct list *);
|
extern void list_add_list (struct list *, struct list *);
|
||||||
|
|
||||||
/* List iteration macro.
|
/* List iteration macro.
|
||||||
* Usage: for (ALL_LIST_ELEMENTS (...) { ... }
|
* Usage: for (ALL_LIST_ELEMENTS (...) { ... }
|
||||||
|
|
42
lib/log.h
42
lib/log.h
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Id: log.h,v 1.17 2005/01/18 22:18:59 ajs Exp $
|
* $Id: log.h,v 1.18 2005/05/06 21:25:49 paul Exp $
|
||||||
*
|
*
|
||||||
* Zebra logging funcions.
|
* Zebra logging funcions.
|
||||||
* Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro
|
* Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro
|
||||||
|
@ -96,11 +96,11 @@ struct message
|
||||||
extern struct zlog *zlog_default;
|
extern struct zlog *zlog_default;
|
||||||
|
|
||||||
/* Open zlog function */
|
/* Open zlog function */
|
||||||
struct zlog *openzlog (const char *progname, zlog_proto_t protocol,
|
extern struct zlog *openzlog (const char *progname, zlog_proto_t protocol,
|
||||||
int syslog_options, int syslog_facility);
|
int syslog_options, int syslog_facility);
|
||||||
|
|
||||||
/* Close zlog function. */
|
/* Close zlog function. */
|
||||||
void closezlog (struct zlog *zl);
|
extern void closezlog (struct zlog *zl);
|
||||||
|
|
||||||
/* GCC have printf type attribute check. */
|
/* GCC have printf type attribute check. */
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
@ -110,41 +110,41 @@ void closezlog (struct zlog *zl);
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
/* Generic function for zlog. */
|
/* Generic function for zlog. */
|
||||||
void zlog (struct zlog *zl, int priority, const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
|
extern void zlog (struct zlog *zl, int priority, const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
|
||||||
|
|
||||||
/* Handy zlog functions. */
|
/* Handy zlog functions. */
|
||||||
void zlog_err (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
|
extern void zlog_err (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
|
||||||
void zlog_warn (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
|
extern void zlog_warn (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
|
||||||
void zlog_info (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
|
extern void zlog_info (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
|
||||||
void zlog_notice (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
|
extern void zlog_notice (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
|
||||||
void zlog_debug (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
|
extern void zlog_debug (const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
|
||||||
|
|
||||||
/* For bgpd's peer oriented log. */
|
/* For bgpd's peer oriented log. */
|
||||||
void plog_err (struct zlog *, const char *format, ...);
|
extern void plog_err (struct zlog *, const char *format, ...);
|
||||||
void plog_warn (struct zlog *, const char *format, ...);
|
extern void plog_warn (struct zlog *, const char *format, ...);
|
||||||
void plog_info (struct zlog *, const char *format, ...);
|
extern void plog_info (struct zlog *, const char *format, ...);
|
||||||
void plog_notice (struct zlog *, const char *format, ...);
|
extern void plog_notice (struct zlog *, const char *format, ...);
|
||||||
void plog_debug (struct zlog *, const char *format, ...);
|
extern void plog_debug (struct zlog *, const char *format, ...);
|
||||||
|
|
||||||
/* Set logging level for the given destination. If the log_level
|
/* Set logging level for the given destination. If the log_level
|
||||||
argument is ZLOG_DISABLED, then the destination is disabled.
|
argument is ZLOG_DISABLED, then the destination is disabled.
|
||||||
This function should not be used for file logging (use zlog_set_file
|
This function should not be used for file logging (use zlog_set_file
|
||||||
or zlog_reset_file instead). */
|
or zlog_reset_file instead). */
|
||||||
void zlog_set_level (struct zlog *zl, zlog_dest_t, int log_level);
|
extern void zlog_set_level (struct zlog *zl, zlog_dest_t, int log_level);
|
||||||
|
|
||||||
/* Set logging to the given filename at the specified level. */
|
/* Set logging to the given filename at the specified level. */
|
||||||
int zlog_set_file (struct zlog *zl, const char *filename, int log_level);
|
extern int zlog_set_file (struct zlog *zl, const char *filename, int log_level);
|
||||||
/* Disable file logging. */
|
/* Disable file logging. */
|
||||||
int zlog_reset_file (struct zlog *zl);
|
extern int zlog_reset_file (struct zlog *zl);
|
||||||
|
|
||||||
/* Rotate log. */
|
/* Rotate log. */
|
||||||
int zlog_rotate (struct zlog *);
|
extern int zlog_rotate (struct zlog *);
|
||||||
|
|
||||||
/* For hackey massage lookup and check */
|
/* For hackey massage lookup and check */
|
||||||
#define LOOKUP(x, y) mes_lookup(x, x ## _max, y)
|
#define LOOKUP(x, y) mes_lookup(x, x ## _max, y)
|
||||||
|
|
||||||
const char *lookup (struct message *, int);
|
extern const char *lookup (struct message *, int);
|
||||||
const char *mes_lookup (struct message *meslist, int max, int index);
|
extern const char *mes_lookup (struct message *meslist, int max, int index);
|
||||||
|
|
||||||
extern const char *zlog_priority[];
|
extern const char *zlog_priority[];
|
||||||
extern const char *zlog_proto_names[];
|
extern const char *zlog_proto_names[];
|
||||||
|
|
30
lib/md5.c
30
lib/md5.c
|
@ -69,8 +69,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
|
||||||
/* Initialize structure containing state of computation.
|
/* Initialize structure containing state of computation.
|
||||||
(RFC 1321, 3.3: Step 3) */
|
(RFC 1321, 3.3: Step 3) */
|
||||||
void
|
void
|
||||||
md5_init_ctx (ctx)
|
md5_init_ctx (struct md5_ctx *ctx)
|
||||||
struct md5_ctx *ctx;
|
|
||||||
{
|
{
|
||||||
ctx->A = 0x67452301;
|
ctx->A = 0x67452301;
|
||||||
ctx->B = 0xefcdab89;
|
ctx->B = 0xefcdab89;
|
||||||
|
@ -87,9 +86,7 @@ md5_init_ctx (ctx)
|
||||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||||
aligned for a 32 bits value. */
|
aligned for a 32 bits value. */
|
||||||
void *
|
void *
|
||||||
md5_read_ctx (ctx, resbuf)
|
md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
|
||||||
const struct md5_ctx *ctx;
|
|
||||||
void *resbuf;
|
|
||||||
{
|
{
|
||||||
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
|
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
|
||||||
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
|
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
|
||||||
|
@ -105,9 +102,7 @@ md5_read_ctx (ctx, resbuf)
|
||||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||||
aligned for a 32 bits value. */
|
aligned for a 32 bits value. */
|
||||||
void *
|
void *
|
||||||
md5_finish_ctx (ctx, resbuf)
|
md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
|
||||||
struct md5_ctx *ctx;
|
|
||||||
void *resbuf;
|
|
||||||
{
|
{
|
||||||
/* Take yet unprocessed bytes into account. */
|
/* Take yet unprocessed bytes into account. */
|
||||||
md5_uint32 bytes = ctx->buflen;
|
md5_uint32 bytes = ctx->buflen;
|
||||||
|
@ -136,9 +131,7 @@ md5_finish_ctx (ctx, resbuf)
|
||||||
resulting message digest number will be written into the 16 bytes
|
resulting message digest number will be written into the 16 bytes
|
||||||
beginning at RESBLOCK. */
|
beginning at RESBLOCK. */
|
||||||
int
|
int
|
||||||
md5_stream (stream, resblock)
|
md5_stream (FILE *stream, void *resblock)
|
||||||
FILE *stream;
|
|
||||||
void *resblock;
|
|
||||||
{
|
{
|
||||||
/* Important: BLOCKSIZE must be a multiple of 64. */
|
/* Important: BLOCKSIZE must be a multiple of 64. */
|
||||||
#define BLOCKSIZE 4096
|
#define BLOCKSIZE 4096
|
||||||
|
@ -193,10 +186,7 @@ md5_stream (stream, resblock)
|
||||||
output yields to the wanted ASCII representation of the message
|
output yields to the wanted ASCII representation of the message
|
||||||
digest. */
|
digest. */
|
||||||
void *
|
void *
|
||||||
md5_buffer (buffer, len, resblock)
|
md5_buffer (const char *buffer, size_t len, void *resblock)
|
||||||
const char *buffer;
|
|
||||||
size_t len;
|
|
||||||
void *resblock;
|
|
||||||
{
|
{
|
||||||
struct md5_ctx ctx;
|
struct md5_ctx ctx;
|
||||||
|
|
||||||
|
@ -212,10 +202,7 @@ md5_buffer (buffer, len, resblock)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
md5_process_bytes (buffer, len, ctx)
|
md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||||
const void *buffer;
|
|
||||||
size_t len;
|
|
||||||
struct md5_ctx *ctx;
|
|
||||||
{
|
{
|
||||||
/* When we already have some bits in our internal buffer concatenate
|
/* When we already have some bits in our internal buffer concatenate
|
||||||
both inputs first. */
|
both inputs first. */
|
||||||
|
@ -270,10 +257,7 @@ md5_process_bytes (buffer, len, ctx)
|
||||||
It is assumed that LEN % 64 == 0. */
|
It is assumed that LEN % 64 == 0. */
|
||||||
|
|
||||||
void
|
void
|
||||||
md5_process_block (buffer, len, ctx)
|
md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||||
const void *buffer;
|
|
||||||
size_t len;
|
|
||||||
struct md5_ctx *ctx;
|
|
||||||
{
|
{
|
||||||
md5_uint32 correct_words[16];
|
md5_uint32 correct_words[16];
|
||||||
const md5_uint32 *words = buffer;
|
const md5_uint32 *words = buffer;
|
||||||
|
|
|
@ -40,7 +40,7 @@ static struct message mstr [] =
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Fatal memory allocation error occured. */
|
/* Fatal memory allocation error occured. */
|
||||||
static void
|
static void __attribute__ ((noreturn))
|
||||||
zerror (const char *fname, int type, size_t size)
|
zerror (const char *fname, int type, size_t size)
|
||||||
{
|
{
|
||||||
zlog_err ("%s : can't allocate memory for `%s' size %d: %s\n",
|
zlog_err ("%s : can't allocate memory for `%s' size %d: %s\n",
|
||||||
|
|
43
lib/memory.h
43
lib/memory.h
|
@ -58,38 +58,25 @@ extern struct mlist mlists[];
|
||||||
#endif /* MEMORY_LOG */
|
#endif /* MEMORY_LOG */
|
||||||
|
|
||||||
/* Prototypes of memory function. */
|
/* Prototypes of memory function. */
|
||||||
void *zmalloc (int type, size_t size);
|
extern void *zmalloc (int type, size_t size);
|
||||||
void *zcalloc (int type, size_t size);
|
extern void *zcalloc (int type, size_t size);
|
||||||
void *zrealloc (int type, void *ptr, size_t size);
|
extern void *zrealloc (int type, void *ptr, size_t size);
|
||||||
void zfree (int type, void *ptr);
|
extern void zfree (int type, void *ptr);
|
||||||
char *zstrdup (int type, const char *str);
|
extern char *zstrdup (int type, const char *str);
|
||||||
|
|
||||||
void *mtype_zmalloc (const char *file,
|
extern void *mtype_zmalloc (const char *file, int line, int type, size_t size);
|
||||||
int line,
|
|
||||||
int type,
|
|
||||||
size_t size);
|
|
||||||
|
|
||||||
void *mtype_zcalloc (const char *file,
|
extern void *mtype_zcalloc (const char *file, int line, int type,
|
||||||
int line,
|
size_t num, size_t size);
|
||||||
int type,
|
|
||||||
size_t num,
|
|
||||||
size_t size);
|
|
||||||
|
|
||||||
void *mtype_zrealloc (const char *file,
|
extern void *mtype_zrealloc (const char *file, int line, int type, void *ptr,
|
||||||
int line,
|
size_t size);
|
||||||
int type,
|
|
||||||
void *ptr,
|
|
||||||
size_t size);
|
|
||||||
|
|
||||||
void mtype_zfree (const char *file,
|
extern void mtype_zfree (const char *file, int line, int type,
|
||||||
int line,
|
void *ptr);
|
||||||
int type,
|
|
||||||
void *ptr);
|
|
||||||
|
|
||||||
char *mtype_zstrdup (const char *file,
|
extern char *mtype_zstrdup (const char *file, int line, int type,
|
||||||
int line,
|
const char *str);
|
||||||
int type,
|
extern void memory_init (void);
|
||||||
const char *str);
|
|
||||||
void memory_init (void);
|
|
||||||
|
|
||||||
#endif /* _ZEBRA_MEMORY_H */
|
#endif /* _ZEBRA_MEMORY_H */
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
/* Both readn and writen are deprecated and will be removed. They are not
|
/* Both readn and writen are deprecated and will be removed. They are not
|
||||||
suitable for use with non-blocking file descriptors.
|
suitable for use with non-blocking file descriptors.
|
||||||
*/
|
*/
|
||||||
int readn (int, u_char *, int);
|
extern int readn (int, u_char *, int);
|
||||||
int writen (int, const u_char *, int);
|
extern int writen (int, const u_char *, int);
|
||||||
|
|
||||||
/* Set the file descriptor to use non-blocking I/O. Returns 0 for success,
|
/* Set the file descriptor to use non-blocking I/O. Returns 0 for success,
|
||||||
-1 on error. */
|
-1 on error. */
|
||||||
|
|
26
lib/plist.c
26
lib/plist.c
|
@ -72,10 +72,10 @@ struct prefix_master
|
||||||
struct prefix_list *recent;
|
struct prefix_list *recent;
|
||||||
|
|
||||||
/* Hook function which is executed when new prefix_list is added. */
|
/* Hook function which is executed when new prefix_list is added. */
|
||||||
void (*add_hook) ();
|
void (*add_hook) (struct prefix_list *);
|
||||||
|
|
||||||
/* Hook function which is executed when prefix_list is deleted. */
|
/* Hook function which is executed when prefix_list is deleted. */
|
||||||
void (*delete_hook) ();
|
void (*delete_hook) (struct prefix_list *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Static structure of IPv4 prefix_list's master. */
|
/* Static structure of IPv4 prefix_list's master. */
|
||||||
|
@ -150,7 +150,7 @@ prefix_list_lookup (afi_t afi, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct prefix_list *
|
static struct prefix_list *
|
||||||
prefix_list_new ()
|
prefix_list_new (void)
|
||||||
{
|
{
|
||||||
struct prefix_list *new;
|
struct prefix_list *new;
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ prefix_list_free (struct prefix_list *plist)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct prefix_list_entry *
|
static struct prefix_list_entry *
|
||||||
prefix_list_entry_new ()
|
prefix_list_entry_new (void)
|
||||||
{
|
{
|
||||||
struct prefix_list_entry *new;
|
struct prefix_list_entry *new;
|
||||||
|
|
||||||
|
@ -326,11 +326,11 @@ prefix_list_delete (struct prefix_list *plist)
|
||||||
|
|
||||||
if (plist->name)
|
if (plist->name)
|
||||||
XFREE (MTYPE_PREFIX_LIST_STR, plist->name);
|
XFREE (MTYPE_PREFIX_LIST_STR, plist->name);
|
||||||
|
|
||||||
prefix_list_free (plist);
|
prefix_list_free (plist);
|
||||||
|
|
||||||
if (master->delete_hook)
|
if (master->delete_hook)
|
||||||
(*master->delete_hook) ();
|
(*master->delete_hook) (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct prefix_list_entry *
|
static struct prefix_list_entry *
|
||||||
|
@ -586,7 +586,7 @@ prefix_list_apply (struct prefix_list *plist, void *object)
|
||||||
return PREFIX_DENY;
|
return PREFIX_DENY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void __attribute__ ((unused))
|
||||||
prefix_list_print (struct prefix_list *plist)
|
prefix_list_print (struct prefix_list *plist)
|
||||||
{
|
{
|
||||||
struct prefix_list_entry *pentry;
|
struct prefix_list_entry *pentry;
|
||||||
|
@ -2578,7 +2578,7 @@ prefix_bgp_show_prefix_list (struct vty *vty, afi_t afi, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prefix_list_reset_orf ()
|
prefix_list_reset_orf (void)
|
||||||
{
|
{
|
||||||
struct prefix_list *plist;
|
struct prefix_list *plist;
|
||||||
struct prefix_list *next;
|
struct prefix_list *next;
|
||||||
|
@ -2625,7 +2625,7 @@ config_write_prefix_ipv4 (struct vty *vty)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prefix_list_reset_ipv4 ()
|
prefix_list_reset_ipv4 (void)
|
||||||
{
|
{
|
||||||
struct prefix_list *plist;
|
struct prefix_list *plist;
|
||||||
struct prefix_list *next;
|
struct prefix_list *next;
|
||||||
|
@ -2657,7 +2657,7 @@ prefix_list_reset_ipv4 ()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prefix_list_init_ipv4 ()
|
prefix_list_init_ipv4 (void)
|
||||||
{
|
{
|
||||||
install_node (&prefix_node, config_write_prefix_ipv4);
|
install_node (&prefix_node, config_write_prefix_ipv4);
|
||||||
|
|
||||||
|
@ -2734,7 +2734,7 @@ config_write_prefix_ipv6 (struct vty *vty)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prefix_list_reset_ipv6 ()
|
prefix_list_reset_ipv6 (void)
|
||||||
{
|
{
|
||||||
struct prefix_list *plist;
|
struct prefix_list *plist;
|
||||||
struct prefix_list *next;
|
struct prefix_list *next;
|
||||||
|
@ -2766,7 +2766,7 @@ prefix_list_reset_ipv6 ()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prefix_list_init_ipv6 ()
|
prefix_list_init_ipv6 (void)
|
||||||
{
|
{
|
||||||
install_node (&prefix_ipv6_node, config_write_prefix_ipv6);
|
install_node (&prefix_ipv6_node, config_write_prefix_ipv6);
|
||||||
|
|
||||||
|
|
29
lib/plist.h
29
lib/plist.h
|
@ -20,6 +20,9 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _QUAGGA_PLIST_H
|
||||||
|
#define _QUAGGA_PLIST_H
|
||||||
|
|
||||||
#define AFI_ORF_PREFIX 65535
|
#define AFI_ORF_PREFIX 65535
|
||||||
|
|
||||||
enum prefix_list_type
|
enum prefix_list_type
|
||||||
|
@ -62,17 +65,19 @@ struct orf_prefix
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
void prefix_list_init (void);
|
extern void prefix_list_init (void);
|
||||||
void prefix_list_reset (void);
|
extern void prefix_list_reset (void);
|
||||||
void prefix_list_add_hook (void (*func) (struct prefix_list *));
|
extern void prefix_list_add_hook (void (*func) (struct prefix_list *));
|
||||||
void prefix_list_delete_hook (void (*func) (struct prefix_list *));
|
extern void prefix_list_delete_hook (void (*func) (struct prefix_list *));
|
||||||
|
|
||||||
struct prefix_list *prefix_list_lookup (afi_t, const char *);
|
extern struct prefix_list *prefix_list_lookup (afi_t, const char *);
|
||||||
enum prefix_list_type prefix_list_apply (struct prefix_list *, void *);
|
extern enum prefix_list_type prefix_list_apply (struct prefix_list *, void *);
|
||||||
|
|
||||||
struct stream *
|
extern struct stream * prefix_bgp_orf_entry (struct stream *,
|
||||||
prefix_bgp_orf_entry (struct stream *, struct prefix_list *,
|
struct prefix_list *,
|
||||||
u_char, u_char, u_char);
|
u_char, u_char, u_char);
|
||||||
int prefix_bgp_orf_set (char *, afi_t, struct orf_prefix *, int, int);
|
extern int prefix_bgp_orf_set (char *, afi_t, struct orf_prefix *, int, int);
|
||||||
void prefix_bgp_orf_remove_all (char *);
|
extern void prefix_bgp_orf_remove_all (char *);
|
||||||
int prefix_bgp_show_prefix_list (struct vty *, afi_t, char *);
|
extern int prefix_bgp_show_prefix_list (struct vty *, afi_t, char *);
|
||||||
|
|
||||||
|
#endif /* _QUAGGA_PLIST_H */
|
||||||
|
|
|
@ -106,7 +106,7 @@ trickle_down (int index, struct pqueue *queue)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pqueue *
|
struct pqueue *
|
||||||
pqueue_create ()
|
pqueue_create (void)
|
||||||
{
|
{
|
||||||
struct pqueue *queue;
|
struct pqueue *queue;
|
||||||
|
|
||||||
|
|
10
lib/pqueue.h
10
lib/pqueue.h
|
@ -33,12 +33,12 @@ struct pqueue
|
||||||
|
|
||||||
#define PQUEUE_INIT_ARRAYSIZE 32
|
#define PQUEUE_INIT_ARRAYSIZE 32
|
||||||
|
|
||||||
struct pqueue *pqueue_create ();
|
extern struct pqueue *pqueue_create (void);
|
||||||
void pqueue_delete (struct pqueue *queue);
|
extern void pqueue_delete (struct pqueue *queue);
|
||||||
|
|
||||||
void pqueue_enqueue (void *data, struct pqueue *queue);
|
extern void pqueue_enqueue (void *data, struct pqueue *queue);
|
||||||
void *pqueue_dequeue (struct pqueue *queue);
|
extern void *pqueue_dequeue (struct pqueue *queue);
|
||||||
|
|
||||||
void trickle_down (int index, struct pqueue *queue);
|
extern void trickle_down (int index, struct pqueue *queue);
|
||||||
|
|
||||||
#endif /* _ZEBRA_PQUEUE_H */
|
#endif /* _ZEBRA_PQUEUE_H */
|
||||||
|
|
10
lib/prefix.c
10
lib/prefix.c
|
@ -72,8 +72,8 @@ prefix_match (const struct prefix *n, const struct prefix *p)
|
||||||
int shift;
|
int shift;
|
||||||
|
|
||||||
/* Set both prefix's head pointer. */
|
/* Set both prefix's head pointer. */
|
||||||
u_char *np = (u_char *)&n->u.prefix;
|
const u_char *np = (const u_char *)&n->u.prefix;
|
||||||
u_char *pp = (u_char *)&p->u.prefix;
|
const u_char *pp = (const u_char *)&p->u.prefix;
|
||||||
|
|
||||||
/* If n's prefix is longer than p's one return 0. */
|
/* If n's prefix is longer than p's one return 0. */
|
||||||
if (n->prefixlen > p->prefixlen)
|
if (n->prefixlen > p->prefixlen)
|
||||||
|
@ -160,8 +160,8 @@ prefix_cmp (const struct prefix *p1, const struct prefix *p2)
|
||||||
int shift;
|
int shift;
|
||||||
|
|
||||||
/* Set both prefix's head pointer. */
|
/* Set both prefix's head pointer. */
|
||||||
u_char *pp1 = (u_char *)&p1->u.prefix;
|
const u_char *pp1 = (const u_char *)&p1->u.prefix;
|
||||||
u_char *pp2 = (u_char *)&p2->u.prefix;
|
const u_char *pp2 = (const u_char *)&p2->u.prefix;
|
||||||
|
|
||||||
if (p1->family != p2->family || p1->prefixlen != p2->prefixlen)
|
if (p1->family != p2->family || p1->prefixlen != p2->prefixlen)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -344,7 +344,7 @@ prefix_ipv4_any (const struct prefix_ipv4 *p)
|
||||||
|
|
||||||
/* Allocate a new ip version 6 route */
|
/* Allocate a new ip version 6 route */
|
||||||
struct prefix_ipv6 *
|
struct prefix_ipv6 *
|
||||||
prefix_ipv6_new ()
|
prefix_ipv6_new (void)
|
||||||
{
|
{
|
||||||
struct prefix_ipv6 *p;
|
struct prefix_ipv6 *p;
|
||||||
|
|
||||||
|
|
73
lib/prefix.h
73
lib/prefix.h
|
@ -23,6 +23,8 @@
|
||||||
#ifndef _ZEBRA_PREFIX_H
|
#ifndef _ZEBRA_PREFIX_H
|
||||||
#define _ZEBRA_PREFIX_H
|
#define _ZEBRA_PREFIX_H
|
||||||
|
|
||||||
|
#include "sockunion.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A struct prefix contains an address family, a prefix length, and an
|
* A struct prefix contains an address family, a prefix length, and an
|
||||||
* address. This can represent either a 'network prefix' as defined
|
* address. This can represent either a 'network prefix' as defined
|
||||||
|
@ -125,58 +127,59 @@ struct prefix_rd
|
||||||
#define PREFIX_FAMILY(p) ((p)->family)
|
#define PREFIX_FAMILY(p) ((p)->family)
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
int afi2family (int);
|
extern int afi2family (int);
|
||||||
int family2afi (int);
|
extern int family2afi (int);
|
||||||
|
|
||||||
struct prefix *prefix_new ();
|
extern struct prefix *prefix_new (void);
|
||||||
void prefix_free (struct prefix *);
|
extern void prefix_free (struct prefix *);
|
||||||
const char *prefix_family_str (const struct prefix *);
|
extern const char *prefix_family_str (const struct prefix *);
|
||||||
int prefix_blen (const struct prefix *);
|
extern int prefix_blen (const struct prefix *);
|
||||||
int str2prefix (const char *, struct prefix *);
|
extern int str2prefix (const char *, struct prefix *);
|
||||||
int prefix2str (const struct prefix *, char *, int);
|
extern int prefix2str (const struct prefix *, char *, int);
|
||||||
int prefix_match (const struct prefix *, const struct prefix *);
|
extern int prefix_match (const struct prefix *, const struct prefix *);
|
||||||
int prefix_same (const struct prefix *, const struct prefix *);
|
extern int prefix_same (const struct prefix *, const struct prefix *);
|
||||||
int prefix_cmp (const struct prefix *, const struct prefix *);
|
extern int prefix_cmp (const struct prefix *, const struct prefix *);
|
||||||
void prefix_copy (struct prefix *dest, const struct prefix *src);
|
extern void prefix_copy (struct prefix *dest, const struct prefix *src);
|
||||||
void apply_mask (struct prefix *);
|
extern void apply_mask (struct prefix *);
|
||||||
|
|
||||||
struct prefix *sockunion2prefix ();
|
extern struct prefix *sockunion2prefix (const union sockunion *dest,
|
||||||
struct prefix *sockunion2hostprefix ();
|
const union sockunion *mask);
|
||||||
|
extern struct prefix *sockunion2hostprefix (const union sockunion *);
|
||||||
|
|
||||||
struct prefix_ipv4 *prefix_ipv4_new ();
|
extern struct prefix_ipv4 *prefix_ipv4_new (void);
|
||||||
void prefix_ipv4_free (struct prefix_ipv4 *);
|
extern void prefix_ipv4_free (struct prefix_ipv4 *);
|
||||||
int str2prefix_ipv4 (const char *, struct prefix_ipv4 *);
|
extern int str2prefix_ipv4 (const char *, struct prefix_ipv4 *);
|
||||||
void apply_mask_ipv4 (struct prefix_ipv4 *);
|
extern void apply_mask_ipv4 (struct prefix_ipv4 *);
|
||||||
|
|
||||||
int prefix_ipv4_any (const struct prefix_ipv4 *);
|
extern int prefix_ipv4_any (const struct prefix_ipv4 *);
|
||||||
void apply_classful_mask_ipv4 (struct prefix_ipv4 *);
|
extern void apply_classful_mask_ipv4 (struct prefix_ipv4 *);
|
||||||
|
|
||||||
u_char ip_masklen (struct in_addr);
|
extern u_char ip_masklen (struct in_addr);
|
||||||
void masklen2ip (int, struct in_addr *);
|
extern void masklen2ip (int, struct in_addr *);
|
||||||
/* returns the network portion of the host address */
|
/* returns the network portion of the host address */
|
||||||
in_addr_t ipv4_network_addr (in_addr_t hostaddr, int masklen);
|
extern in_addr_t ipv4_network_addr (in_addr_t hostaddr, int masklen);
|
||||||
/* given the address of a host on a network and the network mask length,
|
/* given the address of a host on a network and the network mask length,
|
||||||
* calculate the broadcast address for that network;
|
* calculate the broadcast address for that network;
|
||||||
* special treatment for /31: returns the address of the other host
|
* special treatment for /31: returns the address of the other host
|
||||||
* on the network by flipping the host bit */
|
* on the network by flipping the host bit */
|
||||||
in_addr_t ipv4_broadcast_addr (in_addr_t hostaddr, int masklen);
|
extern in_addr_t ipv4_broadcast_addr (in_addr_t hostaddr, int masklen);
|
||||||
|
|
||||||
int netmask_str2prefix_str (const char *, const char *, char *);
|
extern int netmask_str2prefix_str (const char *, const char *, char *);
|
||||||
|
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
struct prefix_ipv6 *prefix_ipv6_new ();
|
extern struct prefix_ipv6 *prefix_ipv6_new (void);
|
||||||
void prefix_ipv6_free (struct prefix_ipv6 *);
|
extern void prefix_ipv6_free (struct prefix_ipv6 *);
|
||||||
int str2prefix_ipv6 (const char *, struct prefix_ipv6 *);
|
extern int str2prefix_ipv6 (const char *, struct prefix_ipv6 *);
|
||||||
void apply_mask_ipv6 (struct prefix_ipv6 *);
|
extern void apply_mask_ipv6 (struct prefix_ipv6 *);
|
||||||
|
|
||||||
int ip6_masklen (struct in6_addr);
|
extern int ip6_masklen (struct in6_addr);
|
||||||
void masklen2ip6 (int, struct in6_addr *);
|
extern void masklen2ip6 (int, struct in6_addr *);
|
||||||
|
|
||||||
void str2in6_addr (const char *, struct in6_addr *);
|
extern void str2in6_addr (const char *, struct in6_addr *);
|
||||||
const char *inet6_ntoa (struct in6_addr);
|
extern const char *inet6_ntoa (struct in6_addr);
|
||||||
|
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
int all_digit (const char *);
|
extern int all_digit (const char *);
|
||||||
|
|
||||||
#endif /* _ZEBRA_PREFIX_H */
|
#endif /* _ZEBRA_PREFIX_H */
|
||||||
|
|
|
@ -82,10 +82,10 @@ struct zprivs_ids_t
|
||||||
};
|
};
|
||||||
|
|
||||||
/* initialise zebra privileges */
|
/* initialise zebra privileges */
|
||||||
void zprivs_init (struct zebra_privs_t *zprivs);
|
extern void zprivs_init (struct zebra_privs_t *zprivs);
|
||||||
/* drop all and terminate privileges */
|
/* drop all and terminate privileges */
|
||||||
void zprivs_terminate (void);
|
extern void zprivs_terminate (void);
|
||||||
/* query for runtime uid's and gid's, eg vty needs this */
|
/* query for runtime uid's and gid's, eg vty needs this */
|
||||||
void zprivs_get_ids(struct zprivs_ids_t *);
|
extern void zprivs_get_ids(struct zprivs_ids_t *);
|
||||||
|
|
||||||
#endif /* _ZEBRA_PRIVS_H */
|
#endif /* _ZEBRA_PRIVS_H */
|
||||||
|
|
|
@ -159,7 +159,7 @@ route_map_lookup_by_name (const char *name)
|
||||||
|
|
||||||
/* Lookup route map. If there isn't route map create one and return
|
/* Lookup route map. If there isn't route map create one and return
|
||||||
it. */
|
it. */
|
||||||
struct route_map *
|
static struct route_map *
|
||||||
route_map_get (const char *name)
|
route_map_get (const char *name)
|
||||||
{
|
{
|
||||||
struct route_map *map;
|
struct route_map *map;
|
||||||
|
@ -171,7 +171,7 @@ route_map_get (const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return route map's type string. */
|
/* Return route map's type string. */
|
||||||
const static char *
|
static const char *
|
||||||
route_map_type_str (enum route_map_type type)
|
route_map_type_str (enum route_map_type type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -188,7 +188,7 @@ route_map_type_str (enum route_map_type type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
route_map_empty (struct route_map *map)
|
route_map_empty (struct route_map *map)
|
||||||
{
|
{
|
||||||
if (map->head == NULL && map->tail == NULL)
|
if (map->head == NULL && map->tail == NULL)
|
||||||
|
@ -245,7 +245,7 @@ vty_show_route_map_entry (struct vty *vty, struct route_map *map)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
vty_show_route_map (struct vty *vty, const char *name)
|
vty_show_route_map (struct vty *vty, const char *name)
|
||||||
{
|
{
|
||||||
struct route_map *map;
|
struct route_map *map;
|
||||||
|
@ -271,8 +271,8 @@ vty_show_route_map (struct vty *vty, const char *name)
|
||||||
|
|
||||||
/* New route map allocation. Please note route map's name must be
|
/* New route map allocation. Please note route map's name must be
|
||||||
specified. */
|
specified. */
|
||||||
struct route_map_index *
|
static struct route_map_index *
|
||||||
route_map_index_new ()
|
route_map_index_new (void)
|
||||||
{
|
{
|
||||||
struct route_map_index *new;
|
struct route_map_index *new;
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ route_map_index_delete (struct route_map_index *index, int notify)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup index from route map. */
|
/* Lookup index from route map. */
|
||||||
struct route_map_index *
|
static struct route_map_index *
|
||||||
route_map_index_lookup (struct route_map *map, enum route_map_type type,
|
route_map_index_lookup (struct route_map *map, enum route_map_type type,
|
||||||
int pref)
|
int pref)
|
||||||
{
|
{
|
||||||
|
@ -333,7 +333,7 @@ route_map_index_lookup (struct route_map *map, enum route_map_type type,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add new index to route map. */
|
/* Add new index to route map. */
|
||||||
struct route_map_index *
|
static struct route_map_index *
|
||||||
route_map_index_add (struct route_map *map, enum route_map_type type,
|
route_map_index_add (struct route_map *map, enum route_map_type type,
|
||||||
int pref)
|
int pref)
|
||||||
{
|
{
|
||||||
|
@ -385,7 +385,7 @@ route_map_index_add (struct route_map *map, enum route_map_type type,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get route map index. */
|
/* Get route map index. */
|
||||||
struct route_map_index *
|
static struct route_map_index *
|
||||||
route_map_index_get (struct route_map *map, enum route_map_type type,
|
route_map_index_get (struct route_map *map, enum route_map_type type,
|
||||||
int pref)
|
int pref)
|
||||||
{
|
{
|
||||||
|
@ -404,8 +404,8 @@ route_map_index_get (struct route_map *map, enum route_map_type type,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* New route map rule */
|
/* New route map rule */
|
||||||
struct route_map_rule *
|
static struct route_map_rule *
|
||||||
route_map_rule_new ()
|
route_map_rule_new (void)
|
||||||
{
|
{
|
||||||
struct route_map_rule *new;
|
struct route_map_rule *new;
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ route_map_install_set (struct route_map_rule_cmd *cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup rule command from match list. */
|
/* Lookup rule command from match list. */
|
||||||
struct route_map_rule_cmd *
|
static struct route_map_rule_cmd *
|
||||||
route_map_lookup_match (const char *name)
|
route_map_lookup_match (const char *name)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -442,7 +442,7 @@ route_map_lookup_match (const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup rule command from set list. */
|
/* Lookup rule command from set list. */
|
||||||
struct route_map_rule_cmd *
|
static struct route_map_rule_cmd *
|
||||||
route_map_lookup_set (const char *name)
|
route_map_lookup_set (const char *name)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -493,7 +493,7 @@ route_map_rule_delete (struct route_map_rule_list *list,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* strcmp wrapper function which don't crush even argument is NULL. */
|
/* strcmp wrapper function which don't crush even argument is NULL. */
|
||||||
int
|
static int
|
||||||
rulecmp (const char *dst, const char *src)
|
rulecmp (const char *dst, const char *src)
|
||||||
{
|
{
|
||||||
if (dst == NULL)
|
if (dst == NULL)
|
||||||
|
@ -731,7 +731,7 @@ route_map_delete_set (struct route_map_index *index, const char *set_name,
|
||||||
We need to make sure our route-map processing matches the above
|
We need to make sure our route-map processing matches the above
|
||||||
*/
|
*/
|
||||||
|
|
||||||
route_map_result_t
|
static route_map_result_t
|
||||||
route_map_apply_match (struct route_map_rule_list *match_list,
|
route_map_apply_match (struct route_map_rule_list *match_list,
|
||||||
struct prefix *prefix, route_map_object_t type,
|
struct prefix *prefix, route_map_object_t type,
|
||||||
void *object)
|
void *object)
|
||||||
|
@ -875,7 +875,7 @@ route_map_event_hook (void (*func) (route_map_event_t, const char *))
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
route_map_init ()
|
route_map_init (void)
|
||||||
{
|
{
|
||||||
/* Make vector for match and set. */
|
/* Make vector for match and set. */
|
||||||
route_match_vec = vector_init (1);
|
route_match_vec = vector_init (1);
|
||||||
|
@ -1230,7 +1230,7 @@ DEFUN (no_rmap_description,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configuration write function. */
|
/* Configuration write function. */
|
||||||
int
|
static int
|
||||||
route_map_config_write (struct vty *vty)
|
route_map_config_write (struct vty *vty)
|
||||||
{
|
{
|
||||||
struct route_map *map;
|
struct route_map *map;
|
||||||
|
@ -1286,7 +1286,7 @@ struct cmd_node rmap_node =
|
||||||
|
|
||||||
/* Initialization of route map vector. */
|
/* Initialization of route map vector. */
|
||||||
void
|
void
|
||||||
route_map_init_vty ()
|
route_map_init_vty (void)
|
||||||
{
|
{
|
||||||
/* Install route map top node. */
|
/* Install route map top node. */
|
||||||
install_node (&rmap_node, route_map_config_write);
|
install_node (&rmap_node, route_map_config_write);
|
||||||
|
|
|
@ -150,52 +150,46 @@ struct route_map
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
void route_map_init ();
|
extern void route_map_init (void);
|
||||||
void route_map_init_vty ();
|
extern void route_map_init_vty (void);
|
||||||
|
|
||||||
/* Add match statement to route map. */
|
/* Add match statement to route map. */
|
||||||
int
|
extern int route_map_add_match (struct route_map_index *index,
|
||||||
route_map_add_match (struct route_map_index *index,
|
const char *match_name,
|
||||||
const char *match_name,
|
const char *match_arg);
|
||||||
const char *match_arg);
|
|
||||||
|
|
||||||
/* Delete specified route match rule. */
|
/* Delete specified route match rule. */
|
||||||
int
|
extern int route_map_delete_match (struct route_map_index *index,
|
||||||
route_map_delete_match (struct route_map_index *index,
|
const char *match_name,
|
||||||
const char *match_name,
|
const char *match_arg);
|
||||||
const char *match_arg);
|
|
||||||
|
|
||||||
/* Add route-map set statement to the route map. */
|
/* Add route-map set statement to the route map. */
|
||||||
int
|
extern int route_map_add_set (struct route_map_index *index,
|
||||||
route_map_add_set (struct route_map_index *index,
|
const char *set_name,
|
||||||
const char *set_name,
|
const char *set_arg);
|
||||||
const char *set_arg);
|
|
||||||
|
|
||||||
/* Delete route map set rule. */
|
/* Delete route map set rule. */
|
||||||
int
|
extern int route_map_delete_set (struct route_map_index *index,
|
||||||
route_map_delete_set (struct route_map_index *index, const char *set_name,
|
const char *set_name,
|
||||||
const char *set_arg);
|
const char *set_arg);
|
||||||
|
|
||||||
/* Install rule command to the match list. */
|
/* Install rule command to the match list. */
|
||||||
void
|
extern void route_map_install_match (struct route_map_rule_cmd *cmd);
|
||||||
route_map_install_match (struct route_map_rule_cmd *cmd);
|
|
||||||
|
|
||||||
/* Install rule command to the set list. */
|
/* Install rule command to the set list. */
|
||||||
void
|
extern void route_map_install_set (struct route_map_rule_cmd *cmd);
|
||||||
route_map_install_set (struct route_map_rule_cmd *cmd);
|
|
||||||
|
|
||||||
/* Lookup route map by name. */
|
/* Lookup route map by name. */
|
||||||
struct route_map *
|
extern struct route_map * route_map_lookup_by_name (const char *name);
|
||||||
route_map_lookup_by_name (const char *name);
|
|
||||||
|
|
||||||
/* Apply route map to the object. */
|
/* Apply route map to the object. */
|
||||||
route_map_result_t
|
extern route_map_result_t route_map_apply (struct route_map *map,
|
||||||
route_map_apply (struct route_map *map, struct prefix *,
|
struct prefix *,
|
||||||
route_map_object_t object_type, void *object);
|
route_map_object_t object_type,
|
||||||
|
void *object);
|
||||||
void route_map_add_hook (void (*func) (const char *));
|
|
||||||
void route_map_delete_hook (void (*func) (const char *));
|
|
||||||
void route_map_event_hook (void (*func) (route_map_event_t, const char *));
|
|
||||||
|
|
||||||
|
extern void route_map_add_hook (void (*func) (const char *));
|
||||||
|
extern void route_map_delete_hook (void (*func) (const char *));
|
||||||
|
extern void route_map_event_hook (void (*func) (route_map_event_t, const char *));
|
||||||
|
|
||||||
#endif /* _ZEBRA_ROUTEMAP_H */
|
#endif /* _ZEBRA_ROUTEMAP_H */
|
||||||
|
|
|
@ -185,7 +185,7 @@ program_counter(void *context)
|
||||||
|
|
||||||
#endif /* SA_SIGINFO */
|
#endif /* SA_SIGINFO */
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((noreturn))
|
||||||
exit_handler(int signo
|
exit_handler(int signo
|
||||||
#ifdef SA_SIGINFO
|
#ifdef SA_SIGINFO
|
||||||
, siginfo_t *siginfo, void *context
|
, siginfo_t *siginfo, void *context
|
||||||
|
@ -200,7 +200,7 @@ exit_handler(int signo
|
||||||
_exit(128+signo);
|
_exit(128+signo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((noreturn))
|
||||||
core_handler(int signo
|
core_handler(int signo
|
||||||
#ifdef SA_SIGINFO
|
#ifdef SA_SIGINFO
|
||||||
, siginfo_t *siginfo, void *context
|
, siginfo_t *siginfo, void *context
|
||||||
|
|
|
@ -44,10 +44,10 @@ struct quagga_signal_t
|
||||||
* - array of quagga_signal_t's describing signals to handle
|
* - array of quagga_signal_t's describing signals to handle
|
||||||
* and handlers to use for each signal
|
* and handlers to use for each signal
|
||||||
*/
|
*/
|
||||||
void signal_init (struct thread_master *m, int sigc,
|
extern void signal_init (struct thread_master *m, int sigc,
|
||||||
struct quagga_signal_t *signals);
|
struct quagga_signal_t *signals);
|
||||||
|
|
||||||
/* check whether there are signals to handle, process any found */
|
/* check whether there are signals to handle, process any found */
|
||||||
int quagga_sigevent_process (void);
|
extern int quagga_sigevent_process (void);
|
||||||
|
|
||||||
#endif /* _QUAGGA_SIGNAL_H */
|
#endif /* _QUAGGA_SIGNAL_H */
|
||||||
|
|
23
lib/smux.h
23
lib/smux.h
|
@ -144,16 +144,17 @@ struct trap_object
|
||||||
(u_char *) &snmp_in_addr_val \
|
(u_char *) &snmp_in_addr_val \
|
||||||
)
|
)
|
||||||
|
|
||||||
void smux_init (struct thread_master *tm);
|
extern void smux_init (struct thread_master *tm);
|
||||||
void smux_start (void);
|
extern void smux_start (void);
|
||||||
void smux_register_mib(const char *, struct variable *, size_t, int, oid [], size_t);
|
extern void smux_register_mib(const char *, struct variable *,
|
||||||
int smux_header_generic (struct variable *, oid [], size_t *, int, size_t *,
|
size_t, int, oid [], size_t);
|
||||||
WriteMethod **);
|
extern int smux_header_generic (struct variable *, oid [], size_t *,
|
||||||
int smux_trap (oid *, size_t, oid *, size_t, struct trap_object *, size_t, unsigned int, u_char);
|
int, size_t *, WriteMethod **);
|
||||||
|
extern int smux_trap (oid *, size_t, oid *, size_t, struct trap_object *,
|
||||||
int oid_compare (oid *, int, oid *, int);
|
size_t, unsigned int, u_char);
|
||||||
void oid2in_addr (oid [], int, struct in_addr *);
|
extern int oid_compare (oid *, int, oid *, int);
|
||||||
void *oid_copy (void *, void *, size_t);
|
extern void oid2in_addr (oid [], int, struct in_addr *);
|
||||||
void oid_copy_addr (oid [], struct in_addr *, int);
|
extern void *oid_copy (void *, void *, size_t);
|
||||||
|
extern void oid_copy_addr (oid [], struct in_addr *, int);
|
||||||
|
|
||||||
#endif /* _ZEBRA_SNMP_H */
|
#endif /* _ZEBRA_SNMP_H */
|
||||||
|
|
|
@ -22,15 +22,15 @@
|
||||||
#ifndef _ZEBRA_SOCKOPT_H
|
#ifndef _ZEBRA_SOCKOPT_H
|
||||||
#define _ZEBRA_SOCKOPT_H
|
#define _ZEBRA_SOCKOPT_H
|
||||||
|
|
||||||
int setsockopt_so_recvbuf (int sock, int size);
|
extern int setsockopt_so_recvbuf (int sock, int size);
|
||||||
|
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
int setsockopt_ipv6_pktinfo (int, int);
|
extern int setsockopt_ipv6_pktinfo (int, int);
|
||||||
int setsockopt_ipv6_checksum (int, int);
|
extern int setsockopt_ipv6_checksum (int, int);
|
||||||
int setsockopt_ipv6_multicast_hops (int, int);
|
extern int setsockopt_ipv6_multicast_hops (int, int);
|
||||||
int setsockopt_ipv6_unicast_hops (int, int);
|
extern int setsockopt_ipv6_unicast_hops (int, int);
|
||||||
int setsockopt_ipv6_hoplimit (int, int);
|
extern int setsockopt_ipv6_hoplimit (int, int);
|
||||||
int setsockopt_ipv6_multicast_loop (int, int);
|
extern int setsockopt_ipv6_multicast_loop (int, int);
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -78,20 +78,19 @@ int setsockopt_ipv6_multicast_loop (int, int);
|
||||||
(((af) == AF_INET) : SOPT_SIZE_CMSG_IFINDEX_IPV4() \
|
(((af) == AF_INET) : SOPT_SIZE_CMSG_IFINDEX_IPV4() \
|
||||||
? SOPT_SIZE_CMSG_PKTINFO_IPV6())
|
? SOPT_SIZE_CMSG_PKTINFO_IPV6())
|
||||||
|
|
||||||
int setsockopt_multicast_ipv4(int sock,
|
extern int setsockopt_multicast_ipv4(int sock, int optname,
|
||||||
int optname,
|
struct in_addr if_addr,
|
||||||
struct in_addr if_addr,
|
unsigned int mcast_addr,
|
||||||
unsigned int mcast_addr,
|
unsigned int ifindex);
|
||||||
unsigned int ifindex);
|
|
||||||
|
|
||||||
/* Ask for, and get, ifindex, by whatever method is supported. */
|
/* Ask for, and get, ifindex, by whatever method is supported. */
|
||||||
int setsockopt_ifindex (int, int, int);
|
extern int setsockopt_ifindex (int, int, int);
|
||||||
int getsockopt_ifindex (int, struct msghdr *);
|
extern int getsockopt_ifindex (int, struct msghdr *);
|
||||||
|
|
||||||
/* swab the fields in iph between the host order and system order expected
|
/* swab the fields in iph between the host order and system order expected
|
||||||
* for IP_HDRINCL.
|
* for IP_HDRINCL.
|
||||||
*/
|
*/
|
||||||
void sockopt_iphdrincl_swab_htosys (struct ip *iph);
|
extern void sockopt_iphdrincl_swab_htosys (struct ip *iph);
|
||||||
void sockopt_iphdrincl_swab_systoh (struct ip *iph);
|
extern void sockopt_iphdrincl_swab_systoh (struct ip *iph);
|
||||||
|
|
||||||
#endif /*_ZEBRA_SOCKOPT_H */
|
#endif /*_ZEBRA_SOCKOPT_H */
|
||||||
|
|
|
@ -273,7 +273,7 @@ sockunion_accept (int sock, union sockunion *su)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return sizeof union sockunion. */
|
/* Return sizeof union sockunion. */
|
||||||
int
|
static int
|
||||||
sockunion_sizeof (union sockunion *su)
|
sockunion_sizeof (union sockunion *su)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -294,7 +294,7 @@ sockunion_sizeof (union sockunion *su)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return sockunion structure : this function should be revised. */
|
/* return sockunion structure : this function should be revised. */
|
||||||
char *
|
static char *
|
||||||
sockunion_log (union sockunion *su)
|
sockunion_log (union sockunion *su)
|
||||||
{
|
{
|
||||||
static char buf[SU_ADDRSTRLEN];
|
static char buf[SU_ADDRSTRLEN];
|
||||||
|
@ -662,7 +662,7 @@ sockunion_getpeername (int fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print sockunion structure */
|
/* Print sockunion structure */
|
||||||
void
|
static void __attribute__ ((unused))
|
||||||
sockunion_print (union sockunion *su)
|
sockunion_print (union sockunion *su)
|
||||||
{
|
{
|
||||||
if (su == NULL)
|
if (su == NULL)
|
||||||
|
@ -701,7 +701,7 @@ sockunion_print (union sockunion *su)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
int
|
static int
|
||||||
in6addr_cmp (struct in6_addr *addr1, struct in6_addr *addr2)
|
in6addr_cmp (struct in6_addr *addr1, struct in6_addr *addr2)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
|
@ -87,42 +87,42 @@ enum connect_result
|
||||||
#define sockunion_family(X) (X)->sa.sa_family
|
#define sockunion_family(X) (X)->sa.sa_family
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
int str2sockunion (const char *, union sockunion *);
|
extern int str2sockunion (const char *, union sockunion *);
|
||||||
const char *sockunion2str (union sockunion *, char *, size_t);
|
extern const char *sockunion2str (union sockunion *, char *, size_t);
|
||||||
int sockunion_cmp (union sockunion *, union sockunion *);
|
extern int sockunion_cmp (union sockunion *, union sockunion *);
|
||||||
int sockunion_same (union sockunion *, union sockunion *);
|
extern int sockunion_same (union sockunion *, union sockunion *);
|
||||||
|
|
||||||
char *sockunion_su2str (union sockunion *su);
|
extern char *sockunion_su2str (union sockunion *su);
|
||||||
union sockunion *sockunion_str2su (const char *str);
|
extern union sockunion *sockunion_str2su (const char *str);
|
||||||
struct in_addr sockunion_get_in_addr (union sockunion *su);
|
extern struct in_addr sockunion_get_in_addr (union sockunion *su);
|
||||||
int sockunion_accept (int sock, union sockunion *);
|
extern int sockunion_accept (int sock, union sockunion *);
|
||||||
int sockunion_stream_socket (union sockunion *);
|
extern int sockunion_stream_socket (union sockunion *);
|
||||||
int sockopt_reuseaddr (int);
|
extern int sockopt_reuseaddr (int);
|
||||||
int sockopt_reuseport (int);
|
extern int sockopt_reuseport (int);
|
||||||
int sockunion_bind (int sock, union sockunion *, unsigned short, union sockunion *);
|
extern int sockunion_bind (int sock, union sockunion *,
|
||||||
int sockopt_ttl (int family, int sock, int ttl);
|
unsigned short, union sockunion *);
|
||||||
int sockunion_socket (union sockunion *su);
|
extern int sockopt_ttl (int family, int sock, int ttl);
|
||||||
const char *inet_sutop (union sockunion *su, char *str);
|
extern int sockunion_socket (union sockunion *su);
|
||||||
enum connect_result
|
extern const char *inet_sutop (union sockunion *su, char *str);
|
||||||
sockunion_connect (int fd, union sockunion *su, unsigned short port, unsigned int);
|
extern enum connect_result sockunion_connect (int fd, union sockunion *su,
|
||||||
union sockunion *sockunion_getsockname (int);
|
unsigned short port,
|
||||||
union sockunion *sockunion_getpeername (int);
|
unsigned int);
|
||||||
union sockunion *sockunion_dup (union sockunion *);
|
extern union sockunion *sockunion_getsockname (int);
|
||||||
void sockunion_free (union sockunion *);
|
extern union sockunion *sockunion_getpeername (int);
|
||||||
|
extern union sockunion *sockunion_dup (union sockunion *);
|
||||||
|
extern void sockunion_free (union sockunion *);
|
||||||
|
|
||||||
#ifndef HAVE_INET_NTOP
|
#ifndef HAVE_INET_NTOP
|
||||||
const char *
|
extern const char * inet_ntop (int family, const void *addrptr,
|
||||||
inet_ntop (int family, const void *addrptr, char *strptr, size_t len);
|
char *strptr, size_t len);
|
||||||
#endif /* HAVE_INET_NTOP */
|
#endif /* HAVE_INET_NTOP */
|
||||||
|
|
||||||
#ifndef HAVE_INET_PTON
|
#ifndef HAVE_INET_PTON
|
||||||
int
|
extern int inet_pton (int family, const char *strptr, void *addrptr);
|
||||||
inet_pton (int family, const char *strptr, void *addrptr);
|
|
||||||
#endif /* HAVE_INET_PTON */
|
#endif /* HAVE_INET_PTON */
|
||||||
|
|
||||||
#ifndef HAVE_INET_ATON
|
#ifndef HAVE_INET_ATON
|
||||||
int
|
extern int inet_aton (const char *cp, struct in_addr *inaddr);
|
||||||
inet_aton (const char *cp, struct in_addr *inaddr);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _ZEBRA_SOCKUNION_H */
|
#endif /* _ZEBRA_SOCKUNION_H */
|
||||||
|
|
11
lib/str.h
11
lib/str.h
|
@ -1,12 +1,12 @@
|
||||||
/*
|
/*
|
||||||
* $Id: str.h,v 1.2 2005/04/02 16:01:05 ajs Exp $
|
* $Id: str.h,v 1.3 2005/05/06 21:25:49 paul Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ZEBRA_STR_H
|
#ifndef _ZEBRA_STR_H
|
||||||
#define _ZEBRA_STR_H
|
#define _ZEBRA_STR_H
|
||||||
|
|
||||||
#ifndef HAVE_SNPRINTF
|
#ifndef HAVE_SNPRINTF
|
||||||
int snprintf(char *, size_t, const char *, ...);
|
extern int snprintf(char *, size_t, const char *, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_VSNPRINTF
|
#ifndef HAVE_VSNPRINTF
|
||||||
|
@ -14,15 +14,16 @@ int snprintf(char *, size_t, const char *, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRLCPY
|
#ifndef HAVE_STRLCPY
|
||||||
size_t strlcpy(char *, const char *, size_t);
|
extern size_t strlcpy(char *, const char *, size_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRLCAT
|
#ifndef HAVE_STRLCAT
|
||||||
size_t strlcat(char *, const char *, size_t);
|
extern size_t strlcat(char *, const char *, size_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRNLEN
|
#ifndef HAVE_STRNLEN
|
||||||
extern size_t strnlen(const char *s, size_t maxlen);
|
extern size_t strnlen(const char *s, size_t maxlen);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif /* _ZEBRA_STR_H */
|
||||||
|
|
||||||
|
|
93
lib/stream.h
93
lib/stream.h
|
@ -128,50 +128,51 @@ struct stream_fifo
|
||||||
#define STREAM_REMAIN(S) STREAM_WRITEABLE((S))
|
#define STREAM_REMAIN(S) STREAM_WRITEABLE((S))
|
||||||
|
|
||||||
/* Stream prototypes. */
|
/* Stream prototypes. */
|
||||||
struct stream *stream_new (size_t);
|
extern struct stream *stream_new (size_t);
|
||||||
void stream_free (struct stream *);
|
extern void stream_free (struct stream *);
|
||||||
struct stream * stream_copy (struct stream *new, struct stream *src);
|
extern struct stream * stream_copy (struct stream *new, struct stream *src);
|
||||||
struct stream *stream_dup (struct stream *);
|
extern struct stream *stream_dup (struct stream *);
|
||||||
|
|
||||||
size_t stream_get_getp (struct stream *);
|
extern size_t stream_get_getp (struct stream *);
|
||||||
size_t stream_get_endp (struct stream *);
|
extern size_t stream_get_endp (struct stream *);
|
||||||
size_t stream_get_size (struct stream *);
|
extern size_t stream_get_size (struct stream *);
|
||||||
u_char *stream_get_data (struct stream *);
|
extern u_char *stream_get_data (struct stream *);
|
||||||
|
|
||||||
void stream_set_getp (struct stream *, size_t);
|
extern void stream_set_getp (struct stream *, size_t);
|
||||||
void stream_forward_getp (struct stream *, size_t);
|
extern void stream_forward_getp (struct stream *, size_t);
|
||||||
void stream_forward_endp (struct stream *, size_t);
|
extern void stream_forward_endp (struct stream *, size_t);
|
||||||
|
|
||||||
void stream_put (struct stream *, void *, size_t); /* NULL source zeroes */
|
/* steam_put: NULL source zeroes out size_t bytes of stream */
|
||||||
int stream_putc (struct stream *, u_char);
|
extern void stream_put (struct stream *, void *, size_t);
|
||||||
int stream_putc_at (struct stream *, size_t, u_char);
|
extern int stream_putc (struct stream *, u_char);
|
||||||
int stream_putw (struct stream *, u_int16_t);
|
extern int stream_putc_at (struct stream *, size_t, u_char);
|
||||||
int stream_putw_at (struct stream *, size_t, u_int16_t);
|
extern int stream_putw (struct stream *, u_int16_t);
|
||||||
int stream_putl (struct stream *, u_int32_t);
|
extern int stream_putw_at (struct stream *, size_t, u_int16_t);
|
||||||
int stream_putl_at (struct stream *, size_t, u_int32_t);
|
extern int stream_putl (struct stream *, u_int32_t);
|
||||||
int stream_put_ipv4 (struct stream *, u_int32_t);
|
extern int stream_putl_at (struct stream *, size_t, u_int32_t);
|
||||||
int stream_put_in_addr (struct stream *, struct in_addr *);
|
extern int stream_put_ipv4 (struct stream *, u_int32_t);
|
||||||
int stream_put_prefix (struct stream *, struct prefix *);
|
extern int stream_put_in_addr (struct stream *, struct in_addr *);
|
||||||
|
extern int stream_put_prefix (struct stream *, struct prefix *);
|
||||||
|
|
||||||
void stream_get (void *, struct stream *, size_t);
|
extern void stream_get (void *, struct stream *, size_t);
|
||||||
u_char stream_getc (struct stream *);
|
extern u_char stream_getc (struct stream *);
|
||||||
u_char stream_getc_from (struct stream *, size_t);
|
extern u_char stream_getc_from (struct stream *, size_t);
|
||||||
u_int16_t stream_getw (struct stream *);
|
extern u_int16_t stream_getw (struct stream *);
|
||||||
u_int16_t stream_getw_from (struct stream *, size_t);
|
extern u_int16_t stream_getw_from (struct stream *, size_t);
|
||||||
u_int32_t stream_getl (struct stream *);
|
extern u_int32_t stream_getl (struct stream *);
|
||||||
u_int32_t stream_getl_from (struct stream *, size_t);
|
extern u_int32_t stream_getl_from (struct stream *, size_t);
|
||||||
u_int32_t stream_get_ipv4 (struct stream *);
|
extern u_int32_t stream_get_ipv4 (struct stream *);
|
||||||
|
|
||||||
#undef stream_read
|
#undef stream_read
|
||||||
#undef stream_write
|
#undef stream_write
|
||||||
|
|
||||||
/* Deprecated: assumes blocking I/O. Will be removed.
|
/* Deprecated: assumes blocking I/O. Will be removed.
|
||||||
Use stream_read_try instead. */
|
Use stream_read_try instead. */
|
||||||
int stream_read (struct stream *, int, size_t);
|
extern int stream_read (struct stream *, int, size_t);
|
||||||
|
|
||||||
/* Deprecated: all file descriptors should already be non-blocking.
|
/* Deprecated: all file descriptors should already be non-blocking.
|
||||||
Will be removed. Use stream_read_try instead. */
|
Will be removed. Use stream_read_try instead. */
|
||||||
int stream_read_unblock (struct stream *, int, size_t);
|
extern int stream_read_unblock (struct stream *, int, size_t);
|
||||||
|
|
||||||
/* Read up to size bytes into the stream.
|
/* Read up to size bytes into the stream.
|
||||||
Return code:
|
Return code:
|
||||||
|
@ -184,24 +185,26 @@ int stream_read_unblock (struct stream *, int, size_t);
|
||||||
extern ssize_t stream_read_try(struct stream *s, int fd, size_t size);
|
extern ssize_t stream_read_try(struct stream *s, int fd, size_t size);
|
||||||
|
|
||||||
extern ssize_t stream_recvmsg (struct stream *s, int fd, struct msghdr *,
|
extern ssize_t stream_recvmsg (struct stream *s, int fd, struct msghdr *,
|
||||||
int flags, size_t size);
|
int flags, size_t size);
|
||||||
extern ssize_t stream_recvfrom (struct stream *s, int fd, size_t len, int flags,
|
extern ssize_t stream_recvfrom (struct stream *s, int fd, size_t len,
|
||||||
struct sockaddr *from, socklen_t *fromlen);
|
int flags, struct sockaddr *from,
|
||||||
size_t stream_write (struct stream *, u_char *, size_t);
|
socklen_t *fromlen);
|
||||||
|
extern size_t stream_write (struct stream *, u_char *, size_t);
|
||||||
|
|
||||||
void stream_reset (struct stream *); /* reset the stream. See Note above */
|
/* reset the stream. See Note above */
|
||||||
int stream_flush (struct stream *, int);
|
extern void stream_reset (struct stream *);
|
||||||
int stream_empty (struct stream *); /* is the stream empty? */
|
extern int stream_flush (struct stream *, int);
|
||||||
|
extern int stream_empty (struct stream *); /* is the stream empty? */
|
||||||
|
|
||||||
/* deprecated */
|
/* deprecated */
|
||||||
u_char *stream_pnt (struct stream *);
|
extern u_char *stream_pnt (struct stream *);
|
||||||
|
|
||||||
/* Stream fifo. */
|
/* Stream fifo. */
|
||||||
struct stream_fifo *stream_fifo_new (void);
|
extern struct stream_fifo *stream_fifo_new (void);
|
||||||
void stream_fifo_push (struct stream_fifo *fifo, struct stream *s);
|
extern void stream_fifo_push (struct stream_fifo *fifo, struct stream *s);
|
||||||
struct stream *stream_fifo_pop (struct stream_fifo *fifo);
|
extern struct stream *stream_fifo_pop (struct stream_fifo *fifo);
|
||||||
struct stream *stream_fifo_head (struct stream_fifo *fifo);
|
extern struct stream *stream_fifo_head (struct stream_fifo *fifo);
|
||||||
void stream_fifo_clean (struct stream_fifo *fifo);
|
extern void stream_fifo_clean (struct stream_fifo *fifo);
|
||||||
void stream_fifo_free (struct stream_fifo *fifo);
|
extern void stream_fifo_free (struct stream_fifo *fifo);
|
||||||
|
|
||||||
#endif /* _ZEBRA_STREAM_H */
|
#endif /* _ZEBRA_STREAM_H */
|
||||||
|
|
10
lib/table.c
10
lib/table.c
|
@ -46,8 +46,8 @@ route_table_finish (struct route_table *rt)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate new route node. */
|
/* Allocate new route node. */
|
||||||
struct route_node *
|
static struct route_node *
|
||||||
route_node_new ()
|
route_node_new (void)
|
||||||
{
|
{
|
||||||
struct route_node *node;
|
struct route_node *node;
|
||||||
node = XCALLOC (MTYPE_ROUTE_NODE, sizeof (struct route_node));
|
node = XCALLOC (MTYPE_ROUTE_NODE, sizeof (struct route_node));
|
||||||
|
@ -55,7 +55,7 @@ route_node_new ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate new route node with prefix set. */
|
/* Allocate new route node with prefix set. */
|
||||||
struct route_node *
|
static struct route_node *
|
||||||
route_node_set (struct route_table *table, struct prefix *prefix)
|
route_node_set (struct route_table *table, struct prefix *prefix)
|
||||||
{
|
{
|
||||||
struct route_node *node;
|
struct route_node *node;
|
||||||
|
@ -69,7 +69,7 @@ route_node_set (struct route_table *table, struct prefix *prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free route node. */
|
/* Free route node. */
|
||||||
void
|
static void
|
||||||
route_node_free (struct route_node *node)
|
route_node_free (struct route_node *node)
|
||||||
{
|
{
|
||||||
XFREE (MTYPE_ROUTE_NODE, node);
|
XFREE (MTYPE_ROUTE_NODE, node);
|
||||||
|
@ -220,7 +220,7 @@ route_unlock_node (struct route_node *node)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump routing table. */
|
/* Dump routing table. */
|
||||||
void
|
static void __attribute__ ((unused))
|
||||||
route_dump_node (struct route_table *t)
|
route_dump_node (struct route_table *t)
|
||||||
{
|
{
|
||||||
struct route_node *node;
|
struct route_node *node;
|
||||||
|
|
30
lib/table.h
30
lib/table.h
|
@ -53,21 +53,25 @@ struct route_node
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
struct route_table *route_table_init (void);
|
extern struct route_table *route_table_init (void);
|
||||||
void route_table_finish (struct route_table *);
|
extern void route_table_finish (struct route_table *);
|
||||||
void route_unlock_node (struct route_node *node);
|
extern void route_unlock_node (struct route_node *node);
|
||||||
void route_node_delete (struct route_node *node);
|
extern void route_node_delete (struct route_node *node);
|
||||||
struct route_node *route_top (struct route_table *);
|
extern struct route_node *route_top (struct route_table *);
|
||||||
struct route_node *route_next (struct route_node *);
|
extern struct route_node *route_next (struct route_node *);
|
||||||
struct route_node *route_next_until (struct route_node *, struct route_node *);
|
extern struct route_node *route_next_until (struct route_node *,
|
||||||
struct route_node *route_node_get (struct route_table *, struct prefix *);
|
struct route_node *);
|
||||||
struct route_node *route_node_lookup (struct route_table *, struct prefix *);
|
extern struct route_node *route_node_get (struct route_table *,
|
||||||
struct route_node *route_lock_node (struct route_node *node);
|
struct prefix *);
|
||||||
struct route_node *route_node_match (struct route_table *, struct prefix *);
|
extern struct route_node *route_node_lookup (struct route_table *,
|
||||||
struct route_node *route_node_match_ipv4 (struct route_table *,
|
struct prefix *);
|
||||||
|
extern struct route_node *route_lock_node (struct route_node *node);
|
||||||
|
extern struct route_node *route_node_match (struct route_table *,
|
||||||
|
struct prefix *);
|
||||||
|
extern struct route_node *route_node_match_ipv4 (struct route_table *,
|
||||||
struct in_addr *);
|
struct in_addr *);
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
struct route_node *route_node_match_ipv6 (struct route_table *,
|
extern struct route_node *route_node_match_ipv6 (struct route_table *,
|
||||||
struct in6_addr *);
|
struct in6_addr *);
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
|
|
36
lib/thread.c
36
lib/thread.c
|
@ -88,7 +88,7 @@ timeval_elapsed (struct timeval a, struct timeval b)
|
||||||
static unsigned int
|
static unsigned int
|
||||||
cpu_record_hash_key (struct cpu_thread_history *a)
|
cpu_record_hash_key (struct cpu_thread_history *a)
|
||||||
{
|
{
|
||||||
return (unsigned int) a->func;
|
return (uintptr_t) a->func;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -98,7 +98,7 @@ cpu_record_hash_cmp (struct cpu_thread_history *a,
|
||||||
return a->func == b->func;
|
return a->func == b->func;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void*
|
static void *
|
||||||
cpu_record_hash_alloc (struct cpu_thread_history *a)
|
cpu_record_hash_alloc (struct cpu_thread_history *a)
|
||||||
{
|
{
|
||||||
struct cpu_thread_history *new;
|
struct cpu_thread_history *new;
|
||||||
|
@ -252,7 +252,7 @@ thread_list_debug (struct thread_list *list)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Debug print for thread_master. */
|
/* Debug print for thread_master. */
|
||||||
void
|
static void __attribute__ ((unused))
|
||||||
thread_master_debug (struct thread_master *m)
|
thread_master_debug (struct thread_master *m)
|
||||||
{
|
{
|
||||||
printf ("-----------\n");
|
printf ("-----------\n");
|
||||||
|
@ -277,8 +277,9 @@ struct thread_master *
|
||||||
thread_master_create ()
|
thread_master_create ()
|
||||||
{
|
{
|
||||||
if (cpu_record == NULL)
|
if (cpu_record == NULL)
|
||||||
cpu_record = hash_create_size (1011, cpu_record_hash_key,
|
cpu_record
|
||||||
cpu_record_hash_cmp);
|
= hash_create_size (1011, (unsigned int (*) (void *))cpu_record_hash_key,
|
||||||
|
(int (*) (void *, void *))cpu_record_hash_cmp);
|
||||||
|
|
||||||
return (struct thread_master *) XCALLOC (MTYPE_THREAD_MASTER,
|
return (struct thread_master *) XCALLOC (MTYPE_THREAD_MASTER,
|
||||||
sizeof (struct thread_master));
|
sizeof (struct thread_master));
|
||||||
|
@ -375,22 +376,22 @@ thread_master_free (struct thread_master *m)
|
||||||
XFREE (MTYPE_THREAD_MASTER, m);
|
XFREE (MTYPE_THREAD_MASTER, m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Thread list is empty or not. */
|
||||||
|
static inline int
|
||||||
|
thread_empty (struct thread_list *list)
|
||||||
|
{
|
||||||
|
return list->head ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Delete top of the list and return it. */
|
/* Delete top of the list and return it. */
|
||||||
static struct thread *
|
static struct thread *
|
||||||
thread_trim_head (struct thread_list *list)
|
thread_trim_head (struct thread_list *list)
|
||||||
{
|
{
|
||||||
if (list->head)
|
if (!thread_empty (list))
|
||||||
return thread_list_delete (list, list->head);
|
return thread_list_delete (list, list->head);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Thread list is empty or not. */
|
|
||||||
int
|
|
||||||
thread_empty (struct thread_list *list)
|
|
||||||
{
|
|
||||||
return list->head ? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return remain time in second. */
|
/* Return remain time in second. */
|
||||||
unsigned long
|
unsigned long
|
||||||
thread_timer_remain_second (struct thread *thread)
|
thread_timer_remain_second (struct thread *thread)
|
||||||
|
@ -437,7 +438,7 @@ thread_get (struct thread_master *m, u_char type,
|
||||||
{
|
{
|
||||||
struct thread *thread;
|
struct thread *thread;
|
||||||
|
|
||||||
if (m->unuse.head)
|
if (!thread_empty (&m->unuse))
|
||||||
{
|
{
|
||||||
thread = thread_trim_head (&m->unuse);
|
thread = thread_trim_head (&m->unuse);
|
||||||
if (thread->funcname)
|
if (thread->funcname)
|
||||||
|
@ -687,7 +688,7 @@ thread_cancel_event (struct thread_master *m, void *arg)
|
||||||
static struct timeval *
|
static struct timeval *
|
||||||
thread_timer_wait (struct thread_list *tlist, struct timeval *timer_val)
|
thread_timer_wait (struct thread_list *tlist, struct timeval *timer_val)
|
||||||
{
|
{
|
||||||
if (tlist->head)
|
if (!thread_empty (tlist))
|
||||||
{
|
{
|
||||||
*timer_val = timeval_subtract (tlist->head->u.sands, recent_time);
|
*timer_val = timeval_subtract (tlist->head->u.sands, recent_time);
|
||||||
return timer_val;
|
return timer_val;
|
||||||
|
@ -695,7 +696,7 @@ thread_timer_wait (struct thread_list *tlist, struct timeval *timer_val)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct thread *
|
static struct thread *
|
||||||
thread_run (struct thread_master *m, struct thread *thread,
|
thread_run (struct thread_master *m, struct thread *thread,
|
||||||
struct thread *fetch)
|
struct thread *fetch)
|
||||||
{
|
{
|
||||||
|
@ -879,7 +880,8 @@ thread_call (struct thread *thread)
|
||||||
|
|
||||||
tmp.func = thread->func;
|
tmp.func = thread->func;
|
||||||
tmp.funcname = thread->funcname;
|
tmp.funcname = thread->funcname;
|
||||||
cpu = hash_get(cpu_record, &tmp, cpu_record_hash_alloc);
|
cpu = hash_get (cpu_record, &tmp,
|
||||||
|
(void * (*) (void *))cpu_record_hash_alloc);
|
||||||
|
|
||||||
GETRUSAGE (&thread->ru);
|
GETRUSAGE (&thread->ru);
|
||||||
|
|
||||||
|
|
52
lib/thread.h
52
lib/thread.h
|
@ -158,32 +158,38 @@ struct cpu_thread_history
|
||||||
#define thread_add_background(m,f,a,v) funcname_thread_add_background(m,f,a,v,#f)
|
#define thread_add_background(m,f,a,v) funcname_thread_add_background(m,f,a,v,#f)
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
struct thread_master *thread_master_create ();
|
extern struct thread_master *thread_master_create (void);
|
||||||
struct thread *funcname_thread_add_read (struct thread_master *,
|
extern void thread_master_free (struct thread_master *);
|
||||||
int (*)(struct thread *), void *, int, const char*);
|
|
||||||
struct thread *funcname_thread_add_write (struct thread_master *,
|
extern struct thread *funcname_thread_add_read (struct thread_master *,
|
||||||
int (*)(struct thread *), void *, int, const char*);
|
int (*)(struct thread *),
|
||||||
struct thread *funcname_thread_add_timer (struct thread_master *,
|
void *, int, const char*);
|
||||||
int (*)(struct thread *), void *, long, const char*);
|
extern struct thread *funcname_thread_add_write (struct thread_master *,
|
||||||
struct thread *funcname_thread_add_timer_msec (struct thread_master *,
|
int (*)(struct thread *),
|
||||||
int (*)(struct thread *), void *, long, const char*);
|
void *, int, const char*);
|
||||||
struct thread *funcname_thread_add_event (struct thread_master *,
|
extern struct thread *funcname_thread_add_timer (struct thread_master *,
|
||||||
int (*)(struct thread *), void *, int, const char*);
|
int (*)(struct thread *),
|
||||||
struct thread *funcname_thread_add_background (struct thread_master *,
|
void *, long, const char*);
|
||||||
int (*func)(struct thread *),
|
extern struct thread *funcname_thread_add_timer_msec (struct thread_master *,
|
||||||
|
int (*)(struct thread *),
|
||||||
|
void *, long, const char*);
|
||||||
|
extern struct thread *funcname_thread_add_event (struct thread_master *,
|
||||||
|
int (*)(struct thread *),
|
||||||
|
void *, int, const char*);
|
||||||
|
extern struct thread *funcname_thread_add_background (struct thread_master *,
|
||||||
|
int (*func)(struct thread *),
|
||||||
void *arg,
|
void *arg,
|
||||||
long milliseconds_to_delay,
|
long milliseconds_to_delay,
|
||||||
const char *funcname);
|
const char *funcname);
|
||||||
|
extern struct thread *funcname_thread_execute (struct thread_master *,
|
||||||
void thread_cancel (struct thread *);
|
int (*)(struct thread *),
|
||||||
void thread_cancel_event (struct thread_master *, void *);
|
void *, int, const char *);
|
||||||
|
extern void thread_cancel (struct thread *);
|
||||||
struct thread *thread_fetch (struct thread_master *, struct thread *);
|
extern void thread_cancel_event (struct thread_master *, void *);
|
||||||
struct thread *funcname_thread_execute (struct thread_master *,
|
extern struct thread *thread_fetch (struct thread_master *, struct thread *);
|
||||||
int (*)(struct thread *), void *, int, const char *);
|
extern void thread_call (struct thread *);
|
||||||
void thread_call (struct thread *);
|
extern unsigned long thread_timer_remain_second (struct thread *);
|
||||||
unsigned long thread_timer_remain_second (struct thread *);
|
extern int thread_should_yield (struct thread *);
|
||||||
int thread_should_yield (struct thread *);
|
|
||||||
|
|
||||||
extern struct cmd_element show_thread_cpu_cmd;
|
extern struct cmd_element show_thread_cpu_cmd;
|
||||||
|
|
||||||
|
|
26
lib/vector.h
26
lib/vector.h
|
@ -45,19 +45,19 @@ typedef struct _vector *vector;
|
||||||
#define vector_active(V) ((V)->active)
|
#define vector_active(V) ((V)->active)
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
vector vector_init (unsigned int size);
|
extern vector vector_init (unsigned int size);
|
||||||
void vector_ensure (vector v, unsigned int num);
|
extern void vector_ensure (vector v, unsigned int num);
|
||||||
int vector_empty_slot (vector v);
|
extern int vector_empty_slot (vector v);
|
||||||
int vector_set (vector v, void *val);
|
extern int vector_set (vector v, void *val);
|
||||||
int vector_set_index (vector v, unsigned int i, void *val);
|
extern int vector_set_index (vector v, unsigned int i, void *val);
|
||||||
void vector_unset (vector v, unsigned int i);
|
extern void vector_unset (vector v, unsigned int i);
|
||||||
unsigned int vector_count (vector v);
|
extern unsigned int vector_count (vector v);
|
||||||
void vector_only_wrapper_free (vector v);
|
extern void vector_only_wrapper_free (vector v);
|
||||||
void vector_only_index_free (void *index);
|
extern void vector_only_index_free (void *index);
|
||||||
void vector_free (vector v);
|
extern void vector_free (vector v);
|
||||||
vector vector_copy (vector v);
|
extern vector vector_copy (vector v);
|
||||||
|
|
||||||
void *vector_lookup (vector, unsigned int);
|
extern void *vector_lookup (vector, unsigned int);
|
||||||
void *vector_lookup_ensure (vector, unsigned int);
|
extern void *vector_lookup_ensure (vector, unsigned int);
|
||||||
|
|
||||||
#endif /* _ZEBRA_VECTOR_H */
|
#endif /* _ZEBRA_VECTOR_H */
|
||||||
|
|
55
lib/vty.h
55
lib/vty.h
|
@ -174,26 +174,49 @@ struct vty
|
||||||
#define VTY_GET_INTEGER(NAME,V,STR) \
|
#define VTY_GET_INTEGER(NAME,V,STR) \
|
||||||
VTY_GET_INTEGER_RANGE(NAME,V,STR,0U,UINT32_MAX)
|
VTY_GET_INTEGER_RANGE(NAME,V,STR,0U,UINT32_MAX)
|
||||||
|
|
||||||
|
#define VTY_GET_IPV4_ADDRESS(NAME,V,STR) \
|
||||||
|
{ \
|
||||||
|
int retv; \
|
||||||
|
retv = inet_aton ((STR), &(V)); \
|
||||||
|
if (!retv) \
|
||||||
|
{ \
|
||||||
|
vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
|
||||||
|
return CMD_WARNING; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define VTY_GET_IPV4_PREFIX(NAME,V,STR) \
|
||||||
|
{ \
|
||||||
|
int retv; \
|
||||||
|
retv = str2prefix_ipv4 ((STR), &(V)); \
|
||||||
|
if (retv <= 0) \
|
||||||
|
{ \
|
||||||
|
vty_out (vty, "%% Invalid %s value%s", NAME, VTY_NEWLINE); \
|
||||||
|
return CMD_WARNING; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
/* Exported variables */
|
/* Exported variables */
|
||||||
extern char integrate_default[];
|
extern char integrate_default[];
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
void vty_init (struct thread_master *);
|
extern void vty_init (struct thread_master *);
|
||||||
void vty_init_vtysh (void);
|
extern void vty_init_vtysh (void);
|
||||||
void vty_reset (void);
|
extern void vty_reset (void);
|
||||||
struct vty *vty_new (void);
|
extern struct vty *vty_new (void);
|
||||||
int vty_out (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
|
extern int vty_out (struct vty *, const char *, ...) PRINTF_ATTRIBUTE(2, 3);
|
||||||
void vty_read_config (char *, char *);
|
extern void vty_read_config (char *, char *);
|
||||||
void vty_time_print (struct vty *, int);
|
extern void vty_time_print (struct vty *, int);
|
||||||
void vty_serv_sock (const char *, unsigned short, const char *);
|
extern void vty_serv_sock (const char *, unsigned short, const char *);
|
||||||
void vty_close (struct vty *);
|
extern void vty_close (struct vty *);
|
||||||
char *vty_get_cwd (void);
|
extern char *vty_get_cwd (void);
|
||||||
void vty_log (const char *level, const char *proto, const char *fmt, va_list);
|
extern void vty_log (const char *level, const char *proto,
|
||||||
int vty_config_lock (struct vty *);
|
const char *fmt, va_list);
|
||||||
int vty_config_unlock (struct vty *);
|
extern int vty_config_lock (struct vty *);
|
||||||
int vty_shell (struct vty *);
|
extern int vty_config_unlock (struct vty *);
|
||||||
int vty_shell_serv (struct vty *);
|
extern int vty_shell (struct vty *);
|
||||||
void vty_hello (struct vty *);
|
extern int vty_shell_serv (struct vty *);
|
||||||
|
extern void vty_hello (struct vty *);
|
||||||
|
|
||||||
/* Send a fixed-size message to all vty terminal monitors; this should be
|
/* Send a fixed-size message to all vty terminal monitors; this should be
|
||||||
an async-signal-safe function. */
|
an async-signal-safe function. */
|
||||||
|
|
|
@ -54,13 +54,13 @@ struct work_queue
|
||||||
/* specification for this work queue */
|
/* specification for this work queue */
|
||||||
struct {
|
struct {
|
||||||
/* work function to process items with */
|
/* work function to process items with */
|
||||||
wq_item_status (*workfunc) ();
|
wq_item_status (*workfunc) (void *);
|
||||||
|
|
||||||
/* error handling function, optional */
|
/* error handling function, optional */
|
||||||
void (*errorfunc) (struct work_queue *, struct work_queue_item *);
|
void (*errorfunc) (struct work_queue *, struct work_queue_item *);
|
||||||
|
|
||||||
/* callback to delete user specific item data */
|
/* callback to delete user specific item data */
|
||||||
void (*del_item_data) ();
|
void (*del_item_data) (void *);
|
||||||
|
|
||||||
/* max number of retries to make for item that errors */
|
/* max number of retries to make for item that errors */
|
||||||
unsigned int max_retries;
|
unsigned int max_retries;
|
||||||
|
@ -81,11 +81,12 @@ struct work_queue
|
||||||
};
|
};
|
||||||
|
|
||||||
/* User API */
|
/* User API */
|
||||||
struct work_queue *work_queue_new (struct thread_master *, const char *);
|
extern struct work_queue *work_queue_new (struct thread_master *,
|
||||||
void work_queue_free (struct work_queue *);
|
const char *);
|
||||||
void work_queue_add (struct work_queue *, void *);
|
extern void work_queue_free (struct work_queue *);
|
||||||
|
extern void work_queue_add (struct work_queue *, void *);
|
||||||
|
|
||||||
/* Helpers, exported for thread.c and command.c */
|
/* Helpers, exported for thread.c and command.c */
|
||||||
int work_queue_run (struct thread *);
|
extern int work_queue_run (struct thread *);
|
||||||
extern struct cmd_element show_work_queues_cmd;
|
extern struct cmd_element show_work_queues_cmd;
|
||||||
#endif /* _QUAGGA_WORK_QUEUE_H */
|
#endif /* _QUAGGA_WORK_QUEUE_H */
|
||||||
|
|
|
@ -32,9 +32,6 @@
|
||||||
#include "zclient.h"
|
#include "zclient.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
|
|
||||||
#include "zebra/rib.h"
|
|
||||||
#include "zebra/zserv.h"
|
|
||||||
|
|
||||||
/* Zebra client events. */
|
/* Zebra client events. */
|
||||||
enum event {ZCLIENT_SCHEDULE, ZCLIENT_READ, ZCLIENT_CONNECT};
|
enum event {ZCLIENT_SCHEDULE, ZCLIENT_READ, ZCLIENT_CONNECT};
|
||||||
|
|
|
@ -108,38 +108,38 @@ struct zapi_ipv4
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Prototypes of zebra client service functions. */
|
/* Prototypes of zebra client service functions. */
|
||||||
struct zclient *zclient_new (void);
|
extern struct zclient *zclient_new (void);
|
||||||
void zclient_init (struct zclient *, int);
|
extern void zclient_init (struct zclient *, int);
|
||||||
int zclient_start (struct zclient *);
|
extern int zclient_start (struct zclient *);
|
||||||
void zclient_stop (struct zclient *);
|
extern void zclient_stop (struct zclient *);
|
||||||
void zclient_reset (struct zclient *);
|
extern void zclient_reset (struct zclient *);
|
||||||
|
|
||||||
/* Get TCP socket connection to zebra daemon at loopback address. */
|
/* Get TCP socket connection to zebra daemon at loopback address. */
|
||||||
int zclient_socket (void);
|
extern int zclient_socket (void);
|
||||||
|
|
||||||
/* Get unix stream socket connection to zebra daemon at given path. */
|
/* Get unix stream socket connection to zebra daemon at given path. */
|
||||||
int zclient_socket_un (const char *);
|
extern int zclient_socket_un (const char *);
|
||||||
|
|
||||||
/* Send redistribute command to zebra daemon. Do not update zclient state. */
|
/* Send redistribute command to zebra daemon. Do not update zclient state. */
|
||||||
int zebra_redistribute_send (int command, struct zclient *, int type);
|
extern int zebra_redistribute_send (int command, struct zclient *, int type);
|
||||||
|
|
||||||
/* If state has changed, update state and call zebra_redistribute_send. */
|
/* If state has changed, update state and call zebra_redistribute_send. */
|
||||||
void zclient_redistribute (int command, struct zclient *, int type);
|
extern void zclient_redistribute (int command, struct zclient *, int type);
|
||||||
|
|
||||||
/* If state has changed, update state and send the command to zebra. */
|
/* If state has changed, update state and send the command to zebra. */
|
||||||
void zclient_redistribute_default (int command, struct zclient *);
|
extern void zclient_redistribute_default (int command, struct zclient *);
|
||||||
|
|
||||||
/* Send the message in zclient->obuf to the zebra daemon (or enqueue it).
|
/* Send the message in zclient->obuf to the zebra daemon (or enqueue it).
|
||||||
Returns 0 for success or -1 on an I/O error. */
|
Returns 0 for success or -1 on an I/O error. */
|
||||||
extern int zclient_send_message(struct zclient *);
|
extern int zclient_send_message(struct zclient *);
|
||||||
|
|
||||||
struct interface *zebra_interface_add_read (struct stream *);
|
extern struct interface *zebra_interface_add_read (struct stream *);
|
||||||
struct interface *zebra_interface_state_read (struct stream *s);
|
extern struct interface *zebra_interface_state_read (struct stream *s);
|
||||||
struct connected *zebra_interface_address_read (int, struct stream *);
|
extern struct connected *zebra_interface_address_read (int, struct stream *);
|
||||||
void zebra_interface_if_set_value (struct stream *, struct interface *);
|
extern void zebra_interface_if_set_value (struct stream *, struct interface *);
|
||||||
void zebra_router_id_update_read (struct stream *s, struct prefix *rid);
|
extern void zebra_router_id_update_read (struct stream *s, struct prefix *rid);
|
||||||
int zapi_ipv4_route (u_char, struct zclient *, struct prefix_ipv4 *,
|
extern int zapi_ipv4_route (u_char, struct zclient *, struct prefix_ipv4 *,
|
||||||
struct zapi_ipv4 *);
|
struct zapi_ipv4 *);
|
||||||
|
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
/* IPv6 prefix add and delete function prototype. */
|
/* IPv6 prefix add and delete function prototype. */
|
||||||
|
@ -163,7 +163,7 @@ struct zapi_ipv6
|
||||||
u_int32_t metric;
|
u_int32_t metric;
|
||||||
};
|
};
|
||||||
|
|
||||||
int zapi_ipv6_route (u_char cmd, struct zclient *zclient,
|
extern int zapi_ipv6_route (u_char cmd, struct zclient *zclient,
|
||||||
struct prefix_ipv6 *p, struct zapi_ipv6 *api);
|
struct prefix_ipv6 *p, struct zapi_ipv6 *api);
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
|
|
|
@ -345,6 +345,9 @@ struct in_pktinfo
|
||||||
#define IN6_ARE_ADDR_EQUAL IN6_IS_ADDR_EQUAL
|
#define IN6_ARE_ADDR_EQUAL IN6_IS_ADDR_EQUAL
|
||||||
#endif /* IN6_ARE_ADDR_EQUAL */
|
#endif /* IN6_ARE_ADDR_EQUAL */
|
||||||
|
|
||||||
|
/* default zebra TCP port for zclient */
|
||||||
|
#define ZEBRA_PORT 2600
|
||||||
|
|
||||||
/* Zebra message types. */
|
/* Zebra message types. */
|
||||||
#define ZEBRA_INTERFACE_ADD 1
|
#define ZEBRA_INTERFACE_ADD 1
|
||||||
#define ZEBRA_INTERFACE_DELETE 2
|
#define ZEBRA_INTERFACE_DELETE 2
|
||||||
|
|
Loading…
Reference in a new issue