forked from Mirror/frr
2004-10-13 Paul Jakma <paul@dishone.st>
* (global) more const'ification and fixups of types to clean up code. * bgp_mplsvpn.{c,h}: (str2tag) fix abuse. Still not perfect, should use something like the VTY_GET_INTEGER macro, but without the vty_out bits.. * bgp_routemap.c: (set_aggregator_as) use VTY_GET_INTEGER_RANGE (no_set_aggregator_as) ditto. * bgpd.c: (peer_uptime) fix unlikely bug, where no buffer is returned, add comments about troublesome return value.
This commit is contained in:
parent
39db97e4e0
commit
fd79ac918b
|
@ -1,3 +1,14 @@
|
||||||
|
2004-10-13 Paul Jakma <paul@dishone.st>
|
||||||
|
|
||||||
|
* (global) more const'ification and fixups of types to clean up code.
|
||||||
|
* bgp_mplsvpn.{c,h}: (str2tag) fix abuse. Still not perfect,
|
||||||
|
should use something like the VTY_GET_INTEGER macro, but without
|
||||||
|
the vty_out bits..
|
||||||
|
* bgp_routemap.c: (set_aggregator_as) use VTY_GET_INTEGER_RANGE
|
||||||
|
(no_set_aggregator_as) ditto.
|
||||||
|
* bgpd.c: (peer_uptime) fix unlikely bug, where no buffer is
|
||||||
|
returned, add comments about troublesome return value.
|
||||||
|
|
||||||
2004-10-03 James R. Leu <jleu at mindspring.com>
|
2004-10-03 James R. Leu <jleu at mindspring.com>
|
||||||
|
|
||||||
* bgp_vty.c: Router id from zebra can be manually overriden.
|
* bgp_vty.c: Router id from zebra can be manually overriden.
|
||||||
|
|
|
@ -993,10 +993,10 @@ enum as_token
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Return next token and point for string parse. */
|
/* Return next token and point for string parse. */
|
||||||
char *
|
const char *
|
||||||
aspath_gettoken (char *buf, enum as_token *token, u_short *asno)
|
aspath_gettoken (const char *buf, enum as_token *token, u_short *asno)
|
||||||
{
|
{
|
||||||
char *p = buf;
|
const char *p = buf;
|
||||||
|
|
||||||
/* Skip space. */
|
/* Skip space. */
|
||||||
while (isspace ((int) *p))
|
while (isspace ((int) *p))
|
||||||
|
@ -1055,7 +1055,7 @@ aspath_gettoken (char *buf, enum as_token *token, u_short *asno)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct aspath *
|
struct aspath *
|
||||||
aspath_str2aspath (char *str)
|
aspath_str2aspath (const char *str)
|
||||||
{
|
{
|
||||||
enum as_token token;
|
enum as_token token;
|
||||||
u_short as_type;
|
u_short as_type;
|
||||||
|
|
|
@ -25,8 +25,10 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
#define AS_CONFED_SET 4
|
#define AS_CONFED_SET 4
|
||||||
|
|
||||||
/* Private AS range defined in RFC2270. */
|
/* Private AS range defined in RFC2270. */
|
||||||
#define BGP_PRIVATE_AS_MIN 64512
|
#define BGP_PRIVATE_AS_MIN 64512U
|
||||||
#define BGP_PRIVATE_AS_MAX 65535
|
#define BGP_PRIVATE_AS_MAX 65535U
|
||||||
|
|
||||||
|
#define BGP_AS_MAX 65535U
|
||||||
|
|
||||||
/* AS path may be include some AsSegments. */
|
/* AS path may be include some AsSegments. */
|
||||||
struct aspath
|
struct aspath
|
||||||
|
@ -63,7 +65,7 @@ int aspath_cmp_left_confed (struct aspath *, struct aspath *);
|
||||||
struct aspath *aspath_delete_confed_seq (struct aspath *);
|
struct aspath *aspath_delete_confed_seq (struct aspath *);
|
||||||
struct aspath *aspath_empty ();
|
struct aspath *aspath_empty ();
|
||||||
struct aspath *aspath_empty_get ();
|
struct aspath *aspath_empty_get ();
|
||||||
struct aspath *aspath_str2aspath (char *);
|
struct aspath *aspath_str2aspath (const char *);
|
||||||
void aspath_free (struct aspath *);
|
void aspath_free (struct aspath *);
|
||||||
struct aspath *aspath_intern (struct aspath *);
|
struct aspath *aspath_intern (struct aspath *);
|
||||||
void aspath_unintern (struct aspath *);
|
void aspath_unintern (struct aspath *);
|
||||||
|
|
|
@ -115,9 +115,9 @@ community_list_free (struct community_list *list)
|
||||||
|
|
||||||
struct community_list *
|
struct community_list *
|
||||||
community_list_insert (struct community_list_handler *ch,
|
community_list_insert (struct community_list_handler *ch,
|
||||||
char *name, int style)
|
const char *name, int style)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
long number;
|
long number;
|
||||||
struct community_list *new;
|
struct community_list *new;
|
||||||
struct community_list *point;
|
struct community_list *point;
|
||||||
|
@ -209,7 +209,7 @@ community_list_insert (struct community_list_handler *ch,
|
||||||
|
|
||||||
struct community_list *
|
struct community_list *
|
||||||
community_list_lookup (struct community_list_handler *ch,
|
community_list_lookup (struct community_list_handler *ch,
|
||||||
char *name, int style)
|
const char *name, int style)
|
||||||
{
|
{
|
||||||
struct community_list *list;
|
struct community_list *list;
|
||||||
struct community_list_master *cm;
|
struct community_list_master *cm;
|
||||||
|
@ -232,7 +232,8 @@ community_list_lookup (struct community_list_handler *ch,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct community_list *
|
struct community_list *
|
||||||
community_list_get (struct community_list_handler *ch, char *name, int style)
|
community_list_get (struct community_list_handler *ch,
|
||||||
|
const char *name, int style)
|
||||||
{
|
{
|
||||||
struct community_list *list;
|
struct community_list *list;
|
||||||
|
|
||||||
|
@ -313,7 +314,7 @@ community_list_entry_delete (struct community_list *list,
|
||||||
|
|
||||||
/* Lookup community-list entry from the list. */
|
/* Lookup community-list entry from the list. */
|
||||||
static struct community_entry *
|
static struct community_entry *
|
||||||
community_list_entry_lookup (struct community_list *list, void *arg,
|
community_list_entry_lookup (struct community_list *list, const void *arg,
|
||||||
int direct)
|
int direct)
|
||||||
{
|
{
|
||||||
struct community_entry *entry;
|
struct community_entry *entry;
|
||||||
|
@ -347,7 +348,7 @@ community_list_entry_lookup (struct community_list *list, void *arg,
|
||||||
static int
|
static int
|
||||||
community_regexp_match (struct community *com, regex_t * reg)
|
community_regexp_match (struct community *com, regex_t * reg)
|
||||||
{
|
{
|
||||||
char *str;
|
const char *str;
|
||||||
|
|
||||||
/* When there is no communities attribute it is treated as empty
|
/* When there is no communities attribute it is treated as empty
|
||||||
string. */
|
string. */
|
||||||
|
@ -367,7 +368,7 @@ community_regexp_match (struct community *com, regex_t * reg)
|
||||||
static int
|
static int
|
||||||
ecommunity_regexp_match (struct ecommunity *ecom, regex_t * reg)
|
ecommunity_regexp_match (struct ecommunity *ecom, regex_t * reg)
|
||||||
{
|
{
|
||||||
char *str;
|
const char *str;
|
||||||
|
|
||||||
/* When there is no communities attribute it is treated as empty
|
/* When there is no communities attribute it is treated as empty
|
||||||
string. */
|
string. */
|
||||||
|
@ -393,7 +394,7 @@ community_regexp_delete (struct community *com, regex_t * reg)
|
||||||
u_int32_t comval;
|
u_int32_t comval;
|
||||||
/* Maximum is "65535:65535" + '\0'. */
|
/* Maximum is "65535:65535" + '\0'. */
|
||||||
char c[12];
|
char c[12];
|
||||||
char *str;
|
const char *str;
|
||||||
|
|
||||||
if (!com)
|
if (!com)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -606,7 +607,7 @@ community_list_dup_check (struct community_list *list,
|
||||||
/* Set community-list. */
|
/* Set community-list. */
|
||||||
int
|
int
|
||||||
community_list_set (struct community_list_handler *ch,
|
community_list_set (struct community_list_handler *ch,
|
||||||
char *name, char *str, int direct, int style)
|
const char *name, const char *str, int direct, int style)
|
||||||
{
|
{
|
||||||
struct community_entry *entry;
|
struct community_entry *entry;
|
||||||
struct community_list *list;
|
struct community_list *list;
|
||||||
|
@ -702,7 +703,8 @@ community_list_set (struct community_list_handler *ch,
|
||||||
community-list entry belongs to the specified name. */
|
community-list entry belongs to the specified name. */
|
||||||
int
|
int
|
||||||
community_list_unset (struct community_list_handler *ch,
|
community_list_unset (struct community_list_handler *ch,
|
||||||
char *name, char *str, int direct, int style)
|
const char *name, const char *str,
|
||||||
|
int direct, int style)
|
||||||
{
|
{
|
||||||
struct community_entry *entry;
|
struct community_entry *entry;
|
||||||
struct community_list *list;
|
struct community_list *list;
|
||||||
|
@ -766,7 +768,8 @@ community_list_unset (struct community_list_handler *ch,
|
||||||
/* Set extcommunity-list. */
|
/* Set extcommunity-list. */
|
||||||
int
|
int
|
||||||
extcommunity_list_set (struct community_list_handler *ch,
|
extcommunity_list_set (struct community_list_handler *ch,
|
||||||
char *name, char *str, int direct, int style)
|
const char *name, const char *str,
|
||||||
|
int direct, int style)
|
||||||
{
|
{
|
||||||
struct community_entry *entry;
|
struct community_entry *entry;
|
||||||
struct community_list *list;
|
struct community_list *list;
|
||||||
|
@ -869,7 +872,8 @@ extcommunity_list_set (struct community_list_handler *ch,
|
||||||
extcommunity-list entry belongs to the specified name. */
|
extcommunity-list entry belongs to the specified name. */
|
||||||
int
|
int
|
||||||
extcommunity_list_unset (struct community_list_handler *ch,
|
extcommunity_list_unset (struct community_list_handler *ch,
|
||||||
char *name, char *str, int direct, int style)
|
const char *name, const char *str,
|
||||||
|
int direct, int style)
|
||||||
{
|
{
|
||||||
struct community_entry *entry;
|
struct community_entry *entry;
|
||||||
struct community_list *list;
|
struct community_list *list;
|
||||||
|
|
|
@ -121,22 +121,24 @@ extern struct community_list_handler *bgp_clist;
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
struct community_list_handler *community_list_init ();
|
struct community_list_handler *community_list_init ();
|
||||||
|
|
||||||
int community_list_set (struct community_list_handler *ch,
|
int community_list_set (struct community_list_handler *ch, const char *name,
|
||||||
char *name, char *str, int direct, int style);
|
const char *str, int direct, int style);
|
||||||
int community_list_unset (struct community_list_handler *ch,
|
int community_list_unset (struct community_list_handler *ch, const char *name,
|
||||||
char *name, char *str, int direct, int style);
|
const char *str, int direct, int style);
|
||||||
int extcommunity_list_set (struct community_list_handler *ch,
|
int extcommunity_list_set (struct community_list_handler *ch, const char *name,
|
||||||
char *name, char *str, int direct, int style);
|
const char *str, int direct, int style);
|
||||||
int extcommunity_list_unset (struct community_list_handler *ch,
|
int extcommunity_list_unset (struct community_list_handler *ch,
|
||||||
char *name, char *str, int direct, int style);
|
const char *name, const char *str,
|
||||||
|
int direct, int style);
|
||||||
|
|
||||||
struct community_list_master *
|
struct community_list_master *
|
||||||
community_list_master_lookup (struct community_list_handler *, int);
|
community_list_master_lookup (struct community_list_handler *, int);
|
||||||
|
|
||||||
struct community_list *
|
struct community_list *
|
||||||
community_list_lookup (struct community_list_handler *, char *, int);
|
community_list_lookup (struct community_list_handler *, const char *, int);
|
||||||
|
|
||||||
int community_list_match (struct community *, struct community_list *);
|
int community_list_match (struct community *, struct community_list *);
|
||||||
|
int ecommunity_list_match (struct ecommunity *, struct community_list *);
|
||||||
int community_list_exact_match (struct community *, struct community_list *);
|
int community_list_exact_match (struct community *, struct community_list *);
|
||||||
struct community *
|
struct community *
|
||||||
community_list_match_delete (struct community *,
|
community_list_match_delete (struct community *,
|
||||||
|
|
|
@ -401,7 +401,7 @@ community_hash_make (struct community *com)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
community_match (struct community *com1, struct community *com2)
|
community_match (const struct community *com1, const struct community *com2)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
@ -432,7 +432,7 @@ community_match (struct community *com1, struct community *com2)
|
||||||
/* If two aspath have same value then return 1 else return 0. This
|
/* If two aspath have same value then return 1 else return 0. This
|
||||||
function is used by hash package. */
|
function is used by hash package. */
|
||||||
int
|
int
|
||||||
community_cmp (struct community *com1, struct community *com2)
|
community_cmp (const struct community *com1, const struct community *com2)
|
||||||
{
|
{
|
||||||
if (com1 == NULL && com2 == NULL)
|
if (com1 == NULL && com2 == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -472,10 +472,11 @@ enum community_token
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Get next community token from string. */
|
/* Get next community token from string. */
|
||||||
char *
|
const char *
|
||||||
community_gettoken (char *buf, enum community_token *token, u_int32_t *val)
|
community_gettoken (const char *buf, enum community_token *token,
|
||||||
|
u_int32_t *val)
|
||||||
{
|
{
|
||||||
char *p = buf;
|
const char *p = buf;
|
||||||
|
|
||||||
/* Skip white space. */
|
/* Skip white space. */
|
||||||
while (isspace ((int) *p))
|
while (isspace ((int) *p))
|
||||||
|
@ -570,7 +571,7 @@ community_gettoken (char *buf, enum community_token *token, u_int32_t *val)
|
||||||
|
|
||||||
/* convert string to community structure */
|
/* convert string to community structure */
|
||||||
struct community *
|
struct community *
|
||||||
community_str2com (char *str)
|
community_str2com (const char *str)
|
||||||
{
|
{
|
||||||
struct community *com = NULL;
|
struct community *com = NULL;
|
||||||
struct community *com_sort = NULL;
|
struct community *com_sort = NULL;
|
||||||
|
|
|
@ -56,9 +56,9 @@ struct community *community_intern (struct community *);
|
||||||
void community_unintern (struct community *);
|
void community_unintern (struct community *);
|
||||||
char *community_str (struct community *);
|
char *community_str (struct community *);
|
||||||
unsigned int community_hash_make (struct community *);
|
unsigned int community_hash_make (struct community *);
|
||||||
struct community *community_str2com (char *);
|
struct community *community_str2com (const char *);
|
||||||
int community_match (struct community *, struct community *);
|
int community_match (const struct community *, const struct community *);
|
||||||
int community_cmp (struct community *, struct community *);
|
int community_cmp (const struct community *, const struct community *);
|
||||||
struct community *community_merge (struct community *, struct community *);
|
struct community *community_merge (struct community *, struct community *);
|
||||||
struct community *community_delete (struct community *, struct community *);
|
struct community *community_delete (struct community *, struct community *);
|
||||||
struct community *community_dup (struct community *);
|
struct community *community_dup (struct community *);
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct bgp_damp_config *damp = &bgp_damp_cfg;
|
||||||
static int
|
static int
|
||||||
bgp_reuse_index (int penalty)
|
bgp_reuse_index (int penalty)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
i = (int)(((double) penalty / damp->reuse_limit - 1.0) * damp->scale_factor);
|
i = (int)(((double) penalty / damp->reuse_limit - 1.0) * damp->scale_factor);
|
||||||
|
@ -91,7 +91,7 @@ bgp_reuse_list_delete (struct bgp_damp_info *bdi)
|
||||||
int
|
int
|
||||||
bgp_damp_decay (time_t tdiff, int penalty)
|
bgp_damp_decay (time_t tdiff, int penalty)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
i = (int) ((double) tdiff / DELTA_T);
|
i = (int) ((double) tdiff / DELTA_T);
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ void
|
||||||
bgp_damp_parameter_set (int hlife, int reuse, int sup, int maxsup)
|
bgp_damp_parameter_set (int hlife, int reuse, int sup, int maxsup)
|
||||||
{
|
{
|
||||||
double reuse_max_ratio;
|
double reuse_max_ratio;
|
||||||
int i;
|
unsigned int i;
|
||||||
double j;
|
double j;
|
||||||
|
|
||||||
damp->suppress_value = sup;
|
damp->suppress_value = sup;
|
||||||
|
@ -438,8 +438,8 @@ bgp_damp_parameter_set (int hlife, int reuse, int sup, int maxsup)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_damp_enable (struct bgp *bgp, afi_t afi, safi_t safi, int half,
|
bgp_damp_enable (struct bgp *bgp, afi_t afi, safi_t safi, time_t half,
|
||||||
int reuse, int suppress, int max)
|
unsigned int reuse, unsigned int suppress, time_t max)
|
||||||
{
|
{
|
||||||
if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
|
if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
|
||||||
{
|
{
|
||||||
|
@ -479,7 +479,7 @@ bgp_damp_config_clean (struct bgp_damp_config *damp)
|
||||||
void
|
void
|
||||||
bgp_damp_info_clean ()
|
bgp_damp_info_clean ()
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
struct bgp_damp_info *bdi, *next;
|
struct bgp_damp_info *bdi, *next;
|
||||||
|
|
||||||
damp->reuse_offset = 0;
|
damp->reuse_offset = 0;
|
||||||
|
@ -537,11 +537,11 @@ bgp_config_write_damp (struct vty *vty)
|
||||||
&& bgp_damp_cfg.reuse_limit == DEFAULT_REUSE
|
&& bgp_damp_cfg.reuse_limit == DEFAULT_REUSE
|
||||||
&& bgp_damp_cfg.suppress_value == DEFAULT_SUPPRESS
|
&& bgp_damp_cfg.suppress_value == DEFAULT_SUPPRESS
|
||||||
&& bgp_damp_cfg.max_suppress_time == bgp_damp_cfg.half_life*4)
|
&& bgp_damp_cfg.max_suppress_time == bgp_damp_cfg.half_life*4)
|
||||||
vty_out (vty, " bgp dampening %d%s",
|
vty_out (vty, " bgp dampening %ld%s",
|
||||||
bgp_damp_cfg.half_life/60,
|
bgp_damp_cfg.half_life/60,
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
else
|
else
|
||||||
vty_out (vty, " bgp dampening %d %d %d %d%s",
|
vty_out (vty, " bgp dampening %ld %d %d %ld%s",
|
||||||
bgp_damp_cfg.half_life/60,
|
bgp_damp_cfg.half_life/60,
|
||||||
bgp_damp_cfg.reuse_limit,
|
bgp_damp_cfg.reuse_limit,
|
||||||
bgp_damp_cfg.suppress_value,
|
bgp_damp_cfg.suppress_value,
|
||||||
|
@ -555,7 +555,7 @@ bgp_config_write_damp (struct vty *vty)
|
||||||
#define BGP_UPTIME_LEN 25
|
#define BGP_UPTIME_LEN 25
|
||||||
|
|
||||||
char *
|
char *
|
||||||
bgp_get_reuse_time (int penalty, char *buf, size_t len)
|
bgp_get_reuse_time (unsigned int penalty, char *buf, size_t len)
|
||||||
{
|
{
|
||||||
time_t reuse_time = 0;
|
time_t reuse_time = 0;
|
||||||
struct tm *tm = NULL;
|
struct tm *tm = NULL;
|
||||||
|
|
|
@ -27,10 +27,10 @@ struct bgp_damp_info
|
||||||
struct bgp_damp_info *prev;
|
struct bgp_damp_info *prev;
|
||||||
|
|
||||||
/* Figure-of-merit. */
|
/* Figure-of-merit. */
|
||||||
int penalty;
|
unsigned int penalty;
|
||||||
|
|
||||||
/* Number of flapping. */
|
/* Number of flapping. */
|
||||||
int flap;
|
unsigned int flap;
|
||||||
|
|
||||||
/* First flap time */
|
/* First flap time */
|
||||||
time_t start_time;
|
time_t start_time;
|
||||||
|
@ -52,8 +52,8 @@ struct bgp_damp_info
|
||||||
|
|
||||||
/* Last time message type. */
|
/* Last time message type. */
|
||||||
u_char lastrecord;
|
u_char lastrecord;
|
||||||
#define BGP_RECORD_UPDATE 1
|
#define BGP_RECORD_UPDATE 1U
|
||||||
#define BGP_RECORD_WITHDRAW 2
|
#define BGP_RECORD_WITHDRAW 2U
|
||||||
|
|
||||||
afi_t afi;
|
afi_t afi;
|
||||||
safi_t safi;
|
safi_t safi;
|
||||||
|
@ -63,32 +63,32 @@ struct bgp_damp_info
|
||||||
struct bgp_damp_config
|
struct bgp_damp_config
|
||||||
{
|
{
|
||||||
/* Value over which routes suppressed. */
|
/* Value over which routes suppressed. */
|
||||||
int suppress_value;
|
unsigned int suppress_value;
|
||||||
|
|
||||||
/* Value below which suppressed routes reused. */
|
/* Value below which suppressed routes reused. */
|
||||||
int reuse_limit;
|
unsigned int reuse_limit;
|
||||||
|
|
||||||
/* Max time a route can be suppressed. */
|
/* Max time a route can be suppressed. */
|
||||||
int max_suppress_time;
|
time_t max_suppress_time;
|
||||||
|
|
||||||
/* Time during which accumulated penalty reduces by half. */
|
/* Time during which accumulated penalty reduces by half. */
|
||||||
int half_life;
|
time_t half_life;
|
||||||
|
|
||||||
/* Non-configurable parameters but fixed at implementation time.
|
/* Non-configurable parameters but fixed at implementation time.
|
||||||
* To change this values, init_bgp_damp() should be modified.
|
* To change this values, init_bgp_damp() should be modified.
|
||||||
*/
|
*/
|
||||||
int tmax; /* Max time previous instability retained */
|
time_t tmax; /* Max time previous instability retained */
|
||||||
int reuse_list_size; /* Number of reuse lists */
|
unsigned int reuse_list_size; /* Number of reuse lists */
|
||||||
int reuse_index_size; /* Size of reuse index array */
|
unsigned int reuse_index_size; /* Size of reuse index array */
|
||||||
|
|
||||||
/* Non-configurable parameters. Most of these are calculated from
|
/* Non-configurable parameters. Most of these are calculated from
|
||||||
* the configurable parameters above.
|
* the configurable parameters above.
|
||||||
*/
|
*/
|
||||||
unsigned int ceiling; /* Max value a penalty can attain */
|
unsigned int ceiling; /* Max value a penalty can attain */
|
||||||
int decay_rate_per_tick; /* Calculated from half-life */
|
unsigned int decay_rate_per_tick; /* Calculated from half-life */
|
||||||
int decay_array_size; /* Calculated using config parameters */
|
unsigned int decay_array_size; /* Calculated using config parameters */
|
||||||
double scale_factor;
|
double scale_factor;
|
||||||
int reuse_scale_factor;
|
unsigned int reuse_scale_factor;
|
||||||
|
|
||||||
/* Decay array per-set based. */
|
/* Decay array per-set based. */
|
||||||
double *decay_array;
|
double *decay_array;
|
||||||
|
@ -126,7 +126,8 @@ struct bgp_damp_config
|
||||||
#define REUSE_LIST_SIZE 256
|
#define REUSE_LIST_SIZE 256
|
||||||
#define REUSE_ARRAY_SIZE 1024
|
#define REUSE_ARRAY_SIZE 1024
|
||||||
|
|
||||||
int bgp_damp_enable (struct bgp *, afi_t, safi_t, int, int, int, int);
|
int bgp_damp_enable (struct bgp *, afi_t, safi_t, time_t, unsigned int,
|
||||||
|
unsigned int, time_t);
|
||||||
int bgp_damp_disable (struct bgp *, afi_t, safi_t);
|
int bgp_damp_disable (struct bgp *, afi_t, safi_t);
|
||||||
int bgp_damp_withdraw (struct bgp_info *, struct bgp_node *,
|
int bgp_damp_withdraw (struct bgp_info *, struct bgp_node *,
|
||||||
afi_t, safi_t, int);
|
afi_t, safi_t, int);
|
||||||
|
@ -134,7 +135,7 @@ int bgp_damp_update (struct bgp_info *, struct bgp_node *, afi_t, safi_t);
|
||||||
int bgp_damp_scan (struct bgp_info *, afi_t, safi_t);
|
int bgp_damp_scan (struct bgp_info *, afi_t, safi_t);
|
||||||
void bgp_damp_info_free (struct bgp_damp_info *, int);
|
void bgp_damp_info_free (struct bgp_damp_info *, int);
|
||||||
void bgp_damp_info_clean ();
|
void bgp_damp_info_clean ();
|
||||||
char * bgp_get_reuse_time (int, char*, size_t);
|
char * bgp_get_reuse_time (unsigned int, char*, size_t);
|
||||||
int bgp_damp_decay (time_t, int);
|
int bgp_damp_decay (time_t, int);
|
||||||
int bgp_config_write_damp (struct vty *);
|
int bgp_config_write_damp (struct vty *);
|
||||||
void bgp_damp_info_vty (struct vty *, struct bgp_info *);
|
void bgp_damp_info_vty (struct vty *, struct bgp_info *);
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct message bgp_status_msg[] =
|
||||||
int bgp_status_msg_max = BGP_STATUS_MAX;
|
int bgp_status_msg_max = BGP_STATUS_MAX;
|
||||||
|
|
||||||
/* BGP message type string. */
|
/* BGP message type string. */
|
||||||
char *bgp_type_str[] =
|
const char *bgp_type_str[] =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
"OPEN",
|
"OPEN",
|
||||||
|
@ -154,8 +154,8 @@ struct message bgp_notify_capability_msg[] =
|
||||||
int bgp_notify_capability_msg_max = BGP_NOTIFY_CAPABILITY_MAX;
|
int bgp_notify_capability_msg_max = BGP_NOTIFY_CAPABILITY_MAX;
|
||||||
|
|
||||||
/* Origin strings. */
|
/* Origin strings. */
|
||||||
char *bgp_origin_str[] = {"i","e","?"};
|
const char *bgp_origin_str[] = {"i","e","?"};
|
||||||
char *bgp_origin_long_str[] = {"IGP","EGP","incomplete"};
|
const char *bgp_origin_long_str[] = {"IGP","EGP","incomplete"};
|
||||||
|
|
||||||
/* Dump attribute. */
|
/* Dump attribute. */
|
||||||
int
|
int
|
||||||
|
@ -233,9 +233,10 @@ bgp_dump_attr (struct peer *peer, struct attr *attr, char *buf, size_t size)
|
||||||
|
|
||||||
/* dump notify packet */
|
/* dump notify packet */
|
||||||
void
|
void
|
||||||
bgp_notify_print(struct peer *peer, struct bgp_notify *bgp_notify, char *direct)
|
bgp_notify_print(struct peer *peer, struct bgp_notify *bgp_notify,
|
||||||
|
const char *direct)
|
||||||
{
|
{
|
||||||
char *subcode_str;
|
const char *subcode_str;
|
||||||
|
|
||||||
subcode_str = "";
|
subcode_str = "";
|
||||||
|
|
||||||
|
|
|
@ -104,10 +104,10 @@ extern unsigned long term_bgp_debug_normal;
|
||||||
#define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b)
|
#define BGP_DEBUG(a, b) (term_bgp_debug_ ## a & BGP_DEBUG_ ## b)
|
||||||
#define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b)
|
#define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b)
|
||||||
|
|
||||||
extern char *bgp_type_str[];
|
const extern char *bgp_type_str[];
|
||||||
|
|
||||||
int bgp_dump_attr (struct peer *, struct attr *, char *, size_t);
|
int bgp_dump_attr (struct peer *, struct attr *, char *, size_t);
|
||||||
void bgp_notify_print (struct peer *, struct bgp_notify *, char *);
|
void bgp_notify_print (struct peer *, struct bgp_notify *, const char *);
|
||||||
|
|
||||||
extern struct message bgp_status_msg[];
|
extern struct message bgp_status_msg[];
|
||||||
extern int bgp_status_msg_max;
|
extern int bgp_status_msg_max;
|
||||||
|
|
|
@ -462,7 +462,7 @@ bgp_dump_packet (struct peer *peer, int type, struct stream *packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
bgp_dump_parse_time (char *str)
|
bgp_dump_parse_time (const char *str)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int len;
|
int len;
|
||||||
|
@ -510,7 +510,7 @@ bgp_dump_parse_time (char *str)
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_dump_set (struct vty *vty, struct bgp_dump *bgp_dump, int type,
|
bgp_dump_set (struct vty *vty, struct bgp_dump *bgp_dump, int type,
|
||||||
char *path, char *interval_str)
|
const char *path, const char *interval_str)
|
||||||
{
|
{
|
||||||
unsigned int interval;
|
unsigned int interval;
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,8 @@ ecommunity_hash_make (struct ecommunity *ecom)
|
||||||
|
|
||||||
/* Compare two Extended Communities Attribute structure. */
|
/* Compare two Extended Communities Attribute structure. */
|
||||||
int
|
int
|
||||||
ecommunity_cmp (struct ecommunity *ecom1, struct ecommunity *ecom2)
|
ecommunity_cmp (const struct ecommunity *ecom1,
|
||||||
|
const struct ecommunity *ecom2)
|
||||||
{
|
{
|
||||||
if (ecom1->size == ecom2->size
|
if (ecom1->size == ecom2->size
|
||||||
&& memcmp (ecom1->val, ecom2->val, ecom1->size * ECOMMUNITY_SIZE) == 0)
|
&& memcmp (ecom1->val, ecom2->val, ecom1->size * ECOMMUNITY_SIZE) == 0)
|
||||||
|
@ -270,8 +271,8 @@ enum ecommunity_token
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Get next Extended Communities token from the string. */
|
/* Get next Extended Communities token from the string. */
|
||||||
char *
|
const char *
|
||||||
ecommunity_gettoken (char *str, struct ecommunity_val *eval,
|
ecommunity_gettoken (const char *str, struct ecommunity_val *eval,
|
||||||
enum ecommunity_token *token)
|
enum ecommunity_token *token)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -280,7 +281,7 @@ ecommunity_gettoken (char *str, struct ecommunity_val *eval,
|
||||||
int separator = 0;
|
int separator = 0;
|
||||||
u_int32_t val_low = 0;
|
u_int32_t val_low = 0;
|
||||||
u_int32_t val_high = 0;
|
u_int32_t val_high = 0;
|
||||||
char *p = str;
|
const char *p = str;
|
||||||
struct in_addr ip;
|
struct in_addr ip;
|
||||||
char ipstr[INET_ADDRSTRLEN + 1];
|
char ipstr[INET_ADDRSTRLEN + 1];
|
||||||
|
|
||||||
|
@ -448,7 +449,7 @@ ecommunity_gettoken (char *str, struct ecommunity_val *eval,
|
||||||
keyword_include = 1
|
keyword_include = 1
|
||||||
*/
|
*/
|
||||||
struct ecommunity *
|
struct ecommunity *
|
||||||
ecommunity_str2com (char *str, int type, int keyword_included)
|
ecommunity_str2com (const char *str, int type, int keyword_included)
|
||||||
{
|
{
|
||||||
struct ecommunity *ecom = NULL;
|
struct ecommunity *ecom = NULL;
|
||||||
enum ecommunity_token token;
|
enum ecommunity_token token;
|
||||||
|
@ -537,7 +538,7 @@ ecommunity_ecom2str (struct ecommunity *ecom, int format)
|
||||||
int str_size;
|
int str_size;
|
||||||
int str_pnt;
|
int str_pnt;
|
||||||
char *str_buf;
|
char *str_buf;
|
||||||
char *prefix;
|
const char *prefix;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int first = 1;
|
int first = 1;
|
||||||
|
|
||||||
|
@ -650,7 +651,8 @@ ecommunity_ecom2str (struct ecommunity *ecom, int format)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ecommunity_match (struct ecommunity *ecom1, struct ecommunity *ecom2)
|
ecommunity_match (const struct ecommunity *ecom1,
|
||||||
|
const struct ecommunity *ecom2)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
|
@ -68,10 +68,10 @@ struct ecommunity *ecommunity_parse (u_int8_t *, u_short);
|
||||||
struct ecommunity *ecommunity_dup (struct ecommunity *);
|
struct ecommunity *ecommunity_dup (struct ecommunity *);
|
||||||
struct ecommunity *ecommunity_merge (struct ecommunity *, struct ecommunity *);
|
struct ecommunity *ecommunity_merge (struct ecommunity *, struct ecommunity *);
|
||||||
struct ecommunity *ecommunity_intern (struct ecommunity *);
|
struct ecommunity *ecommunity_intern (struct ecommunity *);
|
||||||
int ecommunity_cmp (struct ecommunity *, struct ecommunity *);
|
int ecommunity_cmp (const struct ecommunity *, const struct ecommunity *);
|
||||||
void ecommunity_unintern (struct ecommunity *);
|
void ecommunity_unintern (struct ecommunity *);
|
||||||
unsigned int ecommunity_hash_make (struct ecommunity *);
|
unsigned int ecommunity_hash_make (struct ecommunity *);
|
||||||
struct ecommunity *ecommunity_str2com (char *, int, int);
|
struct ecommunity *ecommunity_str2com (const char *, int, int);
|
||||||
char *ecommunity_ecom2str (struct ecommunity *, int);
|
char *ecommunity_ecom2str (struct ecommunity *, int);
|
||||||
int ecommunity_match (struct ecommunity *, struct ecommunity *);
|
int ecommunity_match (const struct ecommunity *, const struct ecommunity *);
|
||||||
char *ecommunity_str (struct ecommunity *);
|
char *ecommunity_str (struct ecommunity *);
|
||||||
|
|
|
@ -119,7 +119,7 @@ as_filter_free (struct as_filter *asfilter)
|
||||||
|
|
||||||
/* Make new AS filter. */
|
/* Make new AS filter. */
|
||||||
struct as_filter *
|
struct as_filter *
|
||||||
as_filter_make (regex_t *reg, char *reg_str, enum as_filter_type type)
|
as_filter_make (regex_t *reg, const char *reg_str, enum as_filter_type type)
|
||||||
{
|
{
|
||||||
struct as_filter *asfilter;
|
struct as_filter *asfilter;
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ as_filter_make (regex_t *reg, char *reg_str, enum as_filter_type type)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct as_filter *
|
struct as_filter *
|
||||||
as_filter_lookup (struct as_list *aslist, char *reg_str,
|
as_filter_lookup (struct as_list *aslist, const char *reg_str,
|
||||||
enum as_filter_type type)
|
enum as_filter_type type)
|
||||||
{
|
{
|
||||||
struct as_filter *asfilter;
|
struct as_filter *asfilter;
|
||||||
|
@ -158,7 +158,7 @@ as_list_filter_add (struct as_list *aslist, struct as_filter *asfilter)
|
||||||
|
|
||||||
/* Lookup as_list from list of as_list by name. */
|
/* Lookup as_list from list of as_list by name. */
|
||||||
struct as_list *
|
struct as_list *
|
||||||
as_list_lookup (char *name)
|
as_list_lookup (const char *name)
|
||||||
{
|
{
|
||||||
struct as_list *aslist;
|
struct as_list *aslist;
|
||||||
|
|
||||||
|
@ -195,9 +195,9 @@ as_list_free (struct as_list *aslist)
|
||||||
/* Insert new AS list to list of as_list. Each as_list is sorted by
|
/* Insert new AS list to list of as_list. Each as_list is sorted by
|
||||||
the name. */
|
the name. */
|
||||||
struct as_list *
|
struct as_list *
|
||||||
as_list_insert (char *name)
|
as_list_insert (const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
long number;
|
long number;
|
||||||
struct as_list *aslist;
|
struct as_list *aslist;
|
||||||
struct as_list *point;
|
struct as_list *point;
|
||||||
|
@ -279,7 +279,7 @@ as_list_insert (char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct as_list *
|
struct as_list *
|
||||||
as_list_get (char *name)
|
as_list_get (const char *name)
|
||||||
{
|
{
|
||||||
struct as_list *aslist;
|
struct as_list *aslist;
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ as_list_get (char *name)
|
||||||
return aslist;
|
return aslist;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
filter_type_str (enum as_filter_type type)
|
filter_type_str (enum as_filter_type type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
|
|
@ -26,6 +26,6 @@ enum as_filter_type
|
||||||
|
|
||||||
enum as_filter_type as_list_apply (struct as_list *, void *);
|
enum as_filter_type as_list_apply (struct as_list *, void *);
|
||||||
|
|
||||||
struct as_list *as_list_lookup (char *);
|
struct as_list *as_list_lookup (const char *);
|
||||||
void as_list_add_hook (void (*func) ());
|
void as_list_add_hook (void (*func) ());
|
||||||
void as_list_delete_hook (void (*func) ());
|
void as_list_delete_hook (void (*func) ());
|
||||||
|
|
|
@ -308,7 +308,7 @@ bgp_uptime_reset (struct peer *peer)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BGP Peer Down Cause */
|
/* BGP Peer Down Cause */
|
||||||
char *peer_down_str[] =
|
const char *peer_down_str[] =
|
||||||
{
|
{
|
||||||
"",
|
"",
|
||||||
"Router ID changed",
|
"Router ID changed",
|
||||||
|
@ -828,7 +828,7 @@ struct {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *bgp_event_str[] =
|
static const char *bgp_event_str[] =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
"BGP_Start",
|
"BGP_Start",
|
||||||
|
|
|
@ -40,4 +40,4 @@ int bgp_event (struct thread *);
|
||||||
int bgp_stop (struct peer *peer);
|
int bgp_stop (struct peer *peer);
|
||||||
void bgp_timer_set (struct peer *);
|
void bgp_timer_set (struct peer *);
|
||||||
void bgp_fsm_change_status (struct peer *peer, int status);
|
void bgp_fsm_change_status (struct peer *peer, int status);
|
||||||
extern char *peer_down_str[];
|
extern const char *peer_down_str[];
|
||||||
|
|
|
@ -91,7 +91,7 @@ struct thread_master *master;
|
||||||
char *config_file = NULL;
|
char *config_file = NULL;
|
||||||
|
|
||||||
/* Process ID saved for use by init system */
|
/* Process ID saved for use by init system */
|
||||||
char *pid_file = PATH_BGPD_PID;
|
const char *pid_file = PATH_BGPD_PID;
|
||||||
|
|
||||||
/* VTY port number and address. */
|
/* VTY port number and address. */
|
||||||
int vty_port = BGP_VTY_PORT;
|
int vty_port = BGP_VTY_PORT;
|
||||||
|
|
|
@ -180,7 +180,7 @@ bgp_nlri_parse_vpnv4 (struct peer *peer, struct attr *attr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
str2prefix_rd (char *str, struct prefix_rd *prd)
|
str2prefix_rd (const char *str, struct prefix_rd *prd)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char *p;
|
char *p;
|
||||||
|
@ -236,15 +236,22 @@ str2prefix_rd (char *str, struct prefix_rd *prd)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
str2tag (char *str, u_char *tag)
|
str2tag (const char *str, u_char *tag)
|
||||||
{
|
{
|
||||||
u_int32_t l;
|
unsigned long l;
|
||||||
|
char *endptr;
|
||||||
|
u_int32_t t;
|
||||||
|
|
||||||
l = atol (str);
|
l = strtoul (str, &endptr, 10);
|
||||||
|
|
||||||
|
if (*endptr == '\0' || l == ULONG_MAX || l > UINT32_MAX)
|
||||||
|
return 0;
|
||||||
|
|
||||||
tag[0] = (u_char)(l >> 12);
|
t = (u_int32_t) l;
|
||||||
tag[1] = (u_char)(l >> 4);
|
|
||||||
tag[2] = (u_char)(l << 4);
|
tag[0] = (u_char)(t >> 12);
|
||||||
|
tag[1] = (u_char)(t >> 4);
|
||||||
|
tag[2] = (u_char)(t << 4);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,6 @@ struct rd_ip
|
||||||
void bgp_mplsvpn_init ();
|
void bgp_mplsvpn_init ();
|
||||||
int bgp_nlri_parse_vpnv4 (struct peer *, struct attr *, struct bgp_nlri *);
|
int bgp_nlri_parse_vpnv4 (struct peer *, struct attr *, struct bgp_nlri *);
|
||||||
u_int32_t decode_label (u_char *);
|
u_int32_t decode_label (u_char *);
|
||||||
int str2prefix_rd (char *, struct prefix_rd *);
|
int str2prefix_rd (const char *, struct prefix_rd *);
|
||||||
int str2tag (char *, u_char *);
|
int str2tag (const char *, u_char *);
|
||||||
char *prefix_rd2str (struct prefix_rd *, char *, size_t);
|
char *prefix_rd2str (struct prefix_rd *, char *, size_t);
|
||||||
|
|
|
@ -548,7 +548,7 @@ bgp_write (struct thread *thread)
|
||||||
u_char type;
|
u_char type;
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
int num;
|
int num;
|
||||||
int count = 0;
|
unsigned int count = 0;
|
||||||
int write_errno;
|
int write_errno;
|
||||||
|
|
||||||
/* Yes first of all get peer pointer. */
|
/* Yes first of all get peer pointer. */
|
||||||
|
@ -873,7 +873,7 @@ bgp_notify_send (struct peer *peer, u_char code, u_char sub_code)
|
||||||
bgp_notify_send_with_data (peer, code, sub_code, NULL, 0);
|
bgp_notify_send_with_data (peer, code, sub_code, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
afi2str (afi_t afi)
|
afi2str (afi_t afi)
|
||||||
{
|
{
|
||||||
if (afi == AFI_IP)
|
if (afi == AFI_IP)
|
||||||
|
@ -884,7 +884,7 @@ afi2str (afi_t afi)
|
||||||
return "Unknown AFI";
|
return "Unknown AFI";
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
safi2str (safi_t safi)
|
safi2str (safi_t safi)
|
||||||
{
|
{
|
||||||
if (safi == SAFI_UNICAST)
|
if (safi == SAFI_UNICAST)
|
||||||
|
|
|
@ -18,10 +18,10 @@ along with GNU Zebra; see the file COPYING. If not, write to the Free
|
||||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
02111-1307, USA. */
|
02111-1307, USA. */
|
||||||
|
|
||||||
#define BGP_NLRI_LENGTH 1
|
#define BGP_NLRI_LENGTH 1U
|
||||||
#define BGP_TOTAL_ATTR_LEN 2
|
#define BGP_TOTAL_ATTR_LEN 2U
|
||||||
#define BGP_UNFEASIBLE_LEN 2
|
#define BGP_UNFEASIBLE_LEN 2U
|
||||||
#define BGP_WRITE_PACKET_MAX 10
|
#define BGP_WRITE_PACKET_MAX 10U
|
||||||
|
|
||||||
/* When to refresh */
|
/* When to refresh */
|
||||||
#define REFRESH_IMMEDIATE 1
|
#define REFRESH_IMMEDIATE 1
|
||||||
|
|
|
@ -34,7 +34,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
(^|[,{}() ]|$) */
|
(^|[,{}() ]|$) */
|
||||||
|
|
||||||
regex_t *
|
regex_t *
|
||||||
bgp_regcomp (char *regstr)
|
bgp_regcomp (const char *regstr)
|
||||||
{
|
{
|
||||||
/* Convert _ character to generic regular expression. */
|
/* Convert _ character to generic regular expression. */
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
|
@ -27,5 +27,5 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
#endif /* HAVE_GNU_REGEX */
|
#endif /* HAVE_GNU_REGEX */
|
||||||
|
|
||||||
void bgp_regex_free (regex_t *regex);
|
void bgp_regex_free (regex_t *regex);
|
||||||
regex_t *bgp_regcomp (char *str);
|
regex_t *bgp_regcomp (const char *str);
|
||||||
int bgp_regexec (regex_t *regex, struct aspath *aspath);
|
int bgp_regexec (regex_t *regex, struct aspath *aspath);
|
||||||
|
|
|
@ -1399,7 +1399,7 @@ bgp_update_rsclient (struct peer *rsclient, afi_t afi, safi_t safi,
|
||||||
struct attr *attr_new2;
|
struct attr *attr_new2;
|
||||||
struct bgp_info *ri;
|
struct bgp_info *ri;
|
||||||
struct bgp_info *new;
|
struct bgp_info *new;
|
||||||
char *reason;
|
const char *reason;
|
||||||
char buf[SU_ADDRSTRLEN];
|
char buf[SU_ADDRSTRLEN];
|
||||||
|
|
||||||
/* Do not insert announces from a rsclient into its own 'bgp_table'. */
|
/* Do not insert announces from a rsclient into its own 'bgp_table'. */
|
||||||
|
@ -1612,7 +1612,7 @@ bgp_update_main (struct peer *peer, struct prefix *p, struct attr *attr,
|
||||||
struct attr *attr_new;
|
struct attr *attr_new;
|
||||||
struct bgp_info *ri;
|
struct bgp_info *ri;
|
||||||
struct bgp_info *new;
|
struct bgp_info *new;
|
||||||
char *reason;
|
const char *reason;
|
||||||
char buf[SU_ADDRSTRLEN];
|
char buf[SU_ADDRSTRLEN];
|
||||||
|
|
||||||
bgp = peer->bgp;
|
bgp = peer->bgp;
|
||||||
|
@ -2920,8 +2920,8 @@ bgp_static_withdraw_vpnv4 (struct bgp *bgp, struct prefix *p, u_int16_t afi,
|
||||||
/* Configure static BGP network. When user don't run zebra, static
|
/* Configure static BGP network. When user don't run zebra, static
|
||||||
route should be installed as valid. */
|
route should be installed as valid. */
|
||||||
int
|
int
|
||||||
bgp_static_set (struct vty *vty, struct bgp *bgp, char *ip_str, u_int16_t afi,
|
bgp_static_set (struct vty *vty, struct bgp *bgp, const char *ip_str,
|
||||||
u_char safi, char *rmap, int backdoor)
|
u_int16_t afi, u_char safi, const char *rmap, int backdoor)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct prefix p;
|
struct prefix p;
|
||||||
|
@ -3012,7 +3012,7 @@ bgp_static_set (struct vty *vty, struct bgp *bgp, char *ip_str, u_int16_t afi,
|
||||||
|
|
||||||
/* Configure static BGP network. */
|
/* Configure static BGP network. */
|
||||||
int
|
int
|
||||||
bgp_static_unset (struct vty *vty, struct bgp *bgp, char *ip_str,
|
bgp_static_unset (struct vty *vty, struct bgp *bgp, const char *ip_str,
|
||||||
u_int16_t afi, u_char safi)
|
u_int16_t afi, u_char safi)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -3106,8 +3106,8 @@ bgp_static_delete (struct bgp *bgp)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_static_set_vpnv4 (struct vty *vty, char *ip_str, char *rd_str,
|
bgp_static_set_vpnv4 (struct vty *vty, const char *ip_str, const char *rd_str,
|
||||||
char *tag_str)
|
const char *tag_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct prefix p;
|
struct prefix p;
|
||||||
|
@ -3174,8 +3174,8 @@ bgp_static_set_vpnv4 (struct vty *vty, char *ip_str, char *rd_str,
|
||||||
|
|
||||||
/* Configure static BGP network. */
|
/* Configure static BGP network. */
|
||||||
int
|
int
|
||||||
bgp_static_unset_vpnv4 (struct vty *vty, char *ip_str, char *rd_str,
|
bgp_static_unset_vpnv4 (struct vty *vty, const char *ip_str,
|
||||||
char *tag_str)
|
const char *rd_str, const char *tag_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
@ -4034,7 +4034,8 @@ bgp_aggregate_delete (struct bgp *bgp, struct prefix *p, afi_t afi,
|
||||||
#define AGGREGATE_AS_SET 1
|
#define AGGREGATE_AS_SET 1
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_aggregate_set (struct vty *vty, char *prefix_str, afi_t afi, safi_t safi,
|
bgp_aggregate_set (struct vty *vty, const char *prefix_str,
|
||||||
|
afi_t afi, safi_t safi,
|
||||||
u_char summary_only, u_char as_set)
|
u_char summary_only, u_char as_set)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -4082,7 +4083,8 @@ bgp_aggregate_set (struct vty *vty, char *prefix_str, afi_t afi, safi_t safi,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_aggregate_unset (struct vty *vty, char *prefix_str, afi_t afi, safi_t safi)
|
bgp_aggregate_unset (struct vty *vty, const char *prefix_str,
|
||||||
|
afi_t afi, safi_t safi)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct prefix p;
|
struct prefix p;
|
||||||
|
@ -5864,9 +5866,9 @@ route_vty_out_detail_header (struct vty *vty, struct bgp *bgp,
|
||||||
/* Display specified route of BGP table. */
|
/* Display specified route of BGP table. */
|
||||||
int
|
int
|
||||||
bgp_show_route_in_table (struct vty *vty, struct bgp *bgp,
|
bgp_show_route_in_table (struct vty *vty, struct bgp *bgp,
|
||||||
struct bgp_table *rib, char *ip_str,
|
struct bgp_table *rib, const char *ip_str,
|
||||||
afi_t afi, safi_t safi, struct prefix_rd *prd,
|
afi_t afi, safi_t safi, struct prefix_rd *prd,
|
||||||
int prefix_check)
|
int prefix_check)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int header;
|
int header;
|
||||||
|
@ -5952,7 +5954,7 @@ bgp_show_route_in_table (struct vty *vty, struct bgp *bgp,
|
||||||
|
|
||||||
/* Display specified route of Main RIB */
|
/* Display specified route of Main RIB */
|
||||||
int
|
int
|
||||||
bgp_show_route (struct vty *vty, char *view_name, char *ip_str,
|
bgp_show_route (struct vty *vty, const char *view_name, const char *ip_str,
|
||||||
afi_t afi, safi_t safi, struct prefix_rd *prd,
|
afi_t afi, safi_t safi, struct prefix_rd *prd,
|
||||||
int prefix_check)
|
int prefix_check)
|
||||||
{
|
{
|
||||||
|
@ -6390,7 +6392,7 @@ bgp_show_regexp_clean (struct vty *vty)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_show_regexp (struct vty *vty, int argc, char **argv, afi_t afi,
|
bgp_show_regexp (struct vty *vty, int argc, const char **argv, afi_t afi,
|
||||||
safi_t safi, enum bgp_show_type type)
|
safi_t safi, enum bgp_show_type type)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -6532,7 +6534,7 @@ DEFUN (show_ipv6_mbgp_regexp,
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_show_prefix_list (struct vty *vty, char *prefix_list_str, afi_t afi,
|
bgp_show_prefix_list (struct vty *vty, const char *prefix_list_str, afi_t afi,
|
||||||
safi_t safi, enum bgp_show_type type)
|
safi_t safi, enum bgp_show_type type)
|
||||||
{
|
{
|
||||||
struct prefix_list *plist;
|
struct prefix_list *plist;
|
||||||
|
@ -6649,7 +6651,7 @@ DEFUN (show_ipv6_mbgp_prefix_list,
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_show_filter_list (struct vty *vty, char *filter, afi_t afi,
|
bgp_show_filter_list (struct vty *vty, const char *filter, afi_t afi,
|
||||||
safi_t safi, enum bgp_show_type type)
|
safi_t safi, enum bgp_show_type type)
|
||||||
{
|
{
|
||||||
struct as_list *as_list;
|
struct as_list *as_list;
|
||||||
|
@ -6765,7 +6767,7 @@ DEFUN (show_ipv6_mbgp_filter_list,
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_show_route_map (struct vty *vty, char *rmap_str, afi_t afi,
|
bgp_show_route_map (struct vty *vty, const char *rmap_str, afi_t afi,
|
||||||
safi_t safi, enum bgp_show_type type)
|
safi_t safi, enum bgp_show_type type)
|
||||||
{
|
{
|
||||||
struct route_map *rmap;
|
struct route_map *rmap;
|
||||||
|
@ -6974,8 +6976,8 @@ DEFUN (show_ipv6_mbgp_community_all,
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_show_community (struct vty *vty, int argc, char **argv, int exact,
|
bgp_show_community (struct vty *vty, int argc, const char **argv, int exact,
|
||||||
u_int16_t afi, u_char safi)
|
u_int16_t afi, u_char safi)
|
||||||
{
|
{
|
||||||
struct community *com;
|
struct community *com;
|
||||||
struct buffer *b;
|
struct buffer *b;
|
||||||
|
@ -7977,7 +7979,7 @@ ALIAS (show_ipv6_mbgp_community_exact,
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_show_community_list (struct vty *vty, char *com, int exact,
|
bgp_show_community_list (struct vty *vty, const char *com, int exact,
|
||||||
u_int16_t afi, u_char safi)
|
u_int16_t afi, u_char safi)
|
||||||
{
|
{
|
||||||
struct community_list *list;
|
struct community_list *list;
|
||||||
|
@ -8168,7 +8170,7 @@ bgp_show_prefix_longer_clean (struct vty *vty)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_show_prefix_longer (struct vty *vty, char *prefix, afi_t afi,
|
bgp_show_prefix_longer (struct vty *vty, const char *prefix, afi_t afi,
|
||||||
safi_t safi, enum bgp_show_type type)
|
safi_t safi, enum bgp_show_type type)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -8313,7 +8315,8 @@ DEFUN (show_ipv6_mbgp_prefix_longer,
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
struct peer *
|
struct peer *
|
||||||
peer_lookup_in_view (struct vty *vty, char *view_name, char *ip_str)
|
peer_lookup_in_view (struct vty *vty, const char *view_name,
|
||||||
|
const char *ip_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
@ -9695,8 +9698,8 @@ bgp_distance_free (struct bgp_distance *bdistance)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_distance_set (struct vty *vty, char *distance_str, char *ip_str,
|
bgp_distance_set (struct vty *vty, const char *distance_str,
|
||||||
char *access_list_str)
|
const char *ip_str, const char *access_list_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct prefix_ipv4 p;
|
struct prefix_ipv4 p;
|
||||||
|
@ -9742,8 +9745,8 @@ bgp_distance_set (struct vty *vty, char *distance_str, char *ip_str,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_distance_unset (struct vty *vty, char *distance_str, char *ip_str,
|
bgp_distance_unset (struct vty *vty, const char *distance_str,
|
||||||
char *access_list_str)
|
const char *ip_str, const char *access_list_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct prefix_ipv4 p;
|
struct prefix_ipv4 p;
|
||||||
|
@ -10060,9 +10063,9 @@ DEFUN (show_ip_bgp_flap_statistics,
|
||||||
|
|
||||||
/* Display specified route of BGP table. */
|
/* Display specified route of BGP table. */
|
||||||
int
|
int
|
||||||
bgp_clear_damp_route (struct vty *vty, char *view_name, char *ip_str,
|
bgp_clear_damp_route (struct vty *vty, const char *view_name,
|
||||||
afi_t afi, safi_t safi, struct prefix_rd *prd,
|
const char *ip_str, afi_t afi, safi_t safi,
|
||||||
int prefix_check)
|
struct prefix_rd *prd, int prefix_check)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct prefix match;
|
struct prefix match;
|
||||||
|
|
|
@ -149,9 +149,11 @@ void bgp_static_update (struct bgp *, struct prefix *, struct bgp_static *,
|
||||||
afi_t, safi_t);
|
afi_t, safi_t);
|
||||||
void bgp_static_withdraw (struct bgp *, struct prefix *, afi_t, safi_t);
|
void bgp_static_withdraw (struct bgp *, struct prefix *, afi_t, safi_t);
|
||||||
|
|
||||||
int bgp_static_set_vpnv4 (struct vty *vty, char *, char *, char *);
|
int bgp_static_set_vpnv4 (struct vty *vty, const char *,
|
||||||
|
const char *, const char *);
|
||||||
|
|
||||||
int bgp_static_unset_vpnv4 (struct vty *, char *, char *, char *);
|
int bgp_static_unset_vpnv4 (struct vty *, const char *,
|
||||||
|
const char *, const char *);
|
||||||
|
|
||||||
int bgp_config_write_network (struct vty *, struct bgp *, afi_t, safi_t, int *);
|
int bgp_config_write_network (struct vty *, struct bgp *, afi_t, safi_t, int *);
|
||||||
int bgp_config_write_distance (struct vty *, struct bgp *);
|
int bgp_config_write_distance (struct vty *, struct bgp *);
|
||||||
|
|
|
@ -160,7 +160,7 @@ route_match_peer (void *rule, struct prefix *prefix, route_map_object_t type,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
route_match_peer_compile (char *arg)
|
route_match_peer_compile (const char *arg)
|
||||||
{
|
{
|
||||||
union sockunion *su;
|
union sockunion *su;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -218,7 +218,7 @@ route_match_ip_address (void *rule, struct prefix *prefix,
|
||||||
/* Route map `ip address' match statement. `arg' should be
|
/* Route map `ip address' match statement. `arg' should be
|
||||||
access-list name. */
|
access-list name. */
|
||||||
void *
|
void *
|
||||||
route_match_ip_address_compile (char *arg)
|
route_match_ip_address_compile (const char *arg)
|
||||||
{
|
{
|
||||||
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ route_match_ip_next_hop (void *rule, struct prefix *prefix,
|
||||||
/* Route map `ip next-hop' match statement. `arg' is
|
/* Route map `ip next-hop' match statement. `arg' is
|
||||||
access-list name. */
|
access-list name. */
|
||||||
void *
|
void *
|
||||||
route_match_ip_next_hop_compile (char *arg)
|
route_match_ip_next_hop_compile (const char *arg)
|
||||||
{
|
{
|
||||||
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ route_match_ip_address_prefix_list (void *rule, struct prefix *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
route_match_ip_address_prefix_list_compile (char *arg)
|
route_match_ip_address_prefix_list_compile (const char *arg)
|
||||||
{
|
{
|
||||||
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ route_match_ip_next_hop_prefix_list (void *rule, struct prefix *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
route_match_ip_next_hop_prefix_list_compile (char *arg)
|
route_match_ip_next_hop_prefix_list_compile (const char *arg)
|
||||||
{
|
{
|
||||||
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
||||||
}
|
}
|
||||||
|
@ -403,16 +403,21 @@ route_match_metric (void *rule, struct prefix *prefix,
|
||||||
|
|
||||||
/* Route map `match metric' match statement. `arg' is MED value */
|
/* Route map `match metric' match statement. `arg' is MED value */
|
||||||
void *
|
void *
|
||||||
route_match_metric_compile (char *arg)
|
route_match_metric_compile (const char *arg)
|
||||||
{
|
{
|
||||||
u_int32_t *med;
|
u_int32_t *med;
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
unsigned long tmpval;
|
unsigned long tmpval;
|
||||||
|
|
||||||
tmpval = strtoul (arg, &endptr, 10);
|
tmpval = strtoul (arg, &endptr, 10);
|
||||||
if (*endptr != '\0' || tmpval == ULONG_MAX)
|
if (*endptr != '\0' || tmpval == ULONG_MAX || tmpval > UINT32_MAX)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
med = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
|
med = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
|
||||||
|
|
||||||
|
if (!med)
|
||||||
|
return med;
|
||||||
|
|
||||||
*med = tmpval;
|
*med = tmpval;
|
||||||
return med;
|
return med;
|
||||||
}
|
}
|
||||||
|
@ -460,7 +465,7 @@ route_match_aspath (void *rule, struct prefix *prefix,
|
||||||
|
|
||||||
/* Compile function for as-path match. */
|
/* Compile function for as-path match. */
|
||||||
void *
|
void *
|
||||||
route_match_aspath_compile (char *arg)
|
route_match_aspath_compile (const char *arg)
|
||||||
{
|
{
|
||||||
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
||||||
}
|
}
|
||||||
|
@ -500,7 +505,7 @@ route_match_aspath (void *rule, struct prefix *prefix, void *object)
|
||||||
|
|
||||||
/* Compile function for as-path match. */
|
/* Compile function for as-path match. */
|
||||||
void *
|
void *
|
||||||
route_match_aspath_compile (char *arg)
|
route_match_aspath_compile (const char *arg)
|
||||||
{
|
{
|
||||||
regex_t *regex;
|
regex_t *regex;
|
||||||
|
|
||||||
|
@ -571,7 +576,7 @@ route_match_community (void *rule, struct prefix *prefix,
|
||||||
|
|
||||||
/* Compile function for community match. */
|
/* Compile function for community match. */
|
||||||
void *
|
void *
|
||||||
route_match_community_compile (char *arg)
|
route_match_community_compile (const char *arg)
|
||||||
{
|
{
|
||||||
struct rmap_community *rcom;
|
struct rmap_community *rcom;
|
||||||
int len;
|
int len;
|
||||||
|
@ -639,7 +644,7 @@ route_match_ecommunity (void *rule, struct prefix *prefix,
|
||||||
|
|
||||||
/* Compile function for extcommunity match. */
|
/* Compile function for extcommunity match. */
|
||||||
void *
|
void *
|
||||||
route_match_ecommunity_compile (char *arg)
|
route_match_ecommunity_compile (const char *arg)
|
||||||
{
|
{
|
||||||
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
||||||
}
|
}
|
||||||
|
@ -684,7 +689,7 @@ route_match_origin (void *rule, struct prefix *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
route_match_origin_compile (char *arg)
|
route_match_origin_compile (const char *arg)
|
||||||
{
|
{
|
||||||
u_char *origin;
|
u_char *origin;
|
||||||
|
|
||||||
|
@ -772,7 +777,7 @@ route_set_ip_nexthop (void *rule, struct prefix *prefix,
|
||||||
/* Route map `ip nexthop' compile function. Given string is converted
|
/* Route map `ip nexthop' compile function. Given string is converted
|
||||||
to struct in_addr structure. */
|
to struct in_addr structure. */
|
||||||
void *
|
void *
|
||||||
route_set_ip_nexthop_compile (char *arg)
|
route_set_ip_nexthop_compile (const char *arg)
|
||||||
{
|
{
|
||||||
struct rmap_ip_nexthop_set *rins;
|
struct rmap_ip_nexthop_set *rins;
|
||||||
struct in_addr *address = NULL;
|
struct in_addr *address = NULL;
|
||||||
|
@ -849,22 +854,27 @@ route_set_local_pref (void *rule, struct prefix *prefix,
|
||||||
|
|
||||||
/* set local preference compilation. */
|
/* set local preference compilation. */
|
||||||
void *
|
void *
|
||||||
route_set_local_pref_compile (char *arg)
|
route_set_local_pref_compile (const char *arg)
|
||||||
{
|
{
|
||||||
|
unsigned long tmp;
|
||||||
u_int32_t *local_pref;
|
u_int32_t *local_pref;
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
|
|
||||||
/* Local preference value shoud be integer. */
|
/* Local preference value shoud be integer. */
|
||||||
if (! all_digit (arg))
|
if (! all_digit (arg))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
local_pref = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
|
tmp = strtoul (arg, &endptr, 10);
|
||||||
*local_pref = strtoul (arg, &endptr, 10);
|
if (*endptr != '\0' || tmp == ULONG_MAX || tmp > UINT32_MAX)
|
||||||
if (*endptr != '\0' || *local_pref == ULONG_MAX)
|
return NULL;
|
||||||
{
|
|
||||||
XFREE (MTYPE_ROUTE_MAP_COMPILED, local_pref);
|
local_pref = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
|
||||||
return NULL;
|
|
||||||
}
|
if (!local_pref)
|
||||||
|
return local_pref;
|
||||||
|
|
||||||
|
*local_pref = tmp;
|
||||||
|
|
||||||
return local_pref;
|
return local_pref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -909,8 +919,9 @@ route_set_weight (void *rule, struct prefix *prefix, route_map_object_t type,
|
||||||
|
|
||||||
/* set local preference compilation. */
|
/* set local preference compilation. */
|
||||||
void *
|
void *
|
||||||
route_set_weight_compile (char *arg)
|
route_set_weight_compile (const char *arg)
|
||||||
{
|
{
|
||||||
|
unsigned long tmp;
|
||||||
u_int32_t *weight;
|
u_int32_t *weight;
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
|
|
||||||
|
@ -918,13 +929,18 @@ route_set_weight_compile (char *arg)
|
||||||
if (! all_digit (arg))
|
if (! all_digit (arg))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
tmp = strtoul (arg, &endptr, 10);
|
||||||
|
if (*endptr != '\0' || tmp == ULONG_MAX || tmp > UINT32_MAX)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
weight = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
|
weight = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
|
||||||
*weight = strtoul (arg, &endptr, 10);
|
|
||||||
if (*endptr != '\0' || *weight == ULONG_MAX)
|
if (weight == NULL)
|
||||||
{
|
return weight;
|
||||||
XFREE (MTYPE_ROUTE_MAP_COMPILED, weight);
|
|
||||||
return NULL;
|
*weight = tmp;
|
||||||
}
|
|
||||||
return weight;
|
return weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -995,7 +1011,7 @@ route_set_metric (void *rule, struct prefix *prefix,
|
||||||
|
|
||||||
/* set metric compilation. */
|
/* set metric compilation. */
|
||||||
void *
|
void *
|
||||||
route_set_metric_compile (char *arg)
|
route_set_metric_compile (const char *arg)
|
||||||
{
|
{
|
||||||
u_int32_t metric;
|
u_int32_t metric;
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
|
@ -1068,7 +1084,7 @@ route_set_aspath_prepend (void *rule, struct prefix *prefix, route_map_object_t
|
||||||
|
|
||||||
/* Compile function for as-path prepend. */
|
/* Compile function for as-path prepend. */
|
||||||
void *
|
void *
|
||||||
route_set_aspath_prepend_compile (char *arg)
|
route_set_aspath_prepend_compile (const char *arg)
|
||||||
{
|
{
|
||||||
struct aspath *aspath;
|
struct aspath *aspath;
|
||||||
|
|
||||||
|
@ -1149,7 +1165,7 @@ route_set_community (void *rule, struct prefix *prefix,
|
||||||
|
|
||||||
/* Compile function for set community. */
|
/* Compile function for set community. */
|
||||||
void *
|
void *
|
||||||
route_set_community_compile (char *arg)
|
route_set_community_compile (const char *arg)
|
||||||
{
|
{
|
||||||
struct rmap_com_set *rcs;
|
struct rmap_com_set *rcs;
|
||||||
struct community *com = NULL;
|
struct community *com = NULL;
|
||||||
|
@ -1256,7 +1272,7 @@ route_set_community_delete (void *rule, struct prefix *prefix,
|
||||||
|
|
||||||
/* Compile function for set community. */
|
/* Compile function for set community. */
|
||||||
void *
|
void *
|
||||||
route_set_community_delete_compile (char *arg)
|
route_set_community_delete_compile (const char *arg)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
char *str;
|
char *str;
|
||||||
|
@ -1328,7 +1344,7 @@ route_set_ecommunity_rt (void *rule, struct prefix *prefix,
|
||||||
|
|
||||||
/* Compile function for set community. */
|
/* Compile function for set community. */
|
||||||
void *
|
void *
|
||||||
route_set_ecommunity_rt_compile (char *arg)
|
route_set_ecommunity_rt_compile (const char *arg)
|
||||||
{
|
{
|
||||||
struct ecommunity *ecom;
|
struct ecommunity *ecom;
|
||||||
|
|
||||||
|
@ -1381,7 +1397,7 @@ route_set_ecommunity_soo (void *rule, struct prefix *prefix,
|
||||||
|
|
||||||
/* Compile function for set community. */
|
/* Compile function for set community. */
|
||||||
void *
|
void *
|
||||||
route_set_ecommunity_soo_compile (char *arg)
|
route_set_ecommunity_soo_compile (const char *arg)
|
||||||
{
|
{
|
||||||
struct ecommunity *ecom;
|
struct ecommunity *ecom;
|
||||||
|
|
||||||
|
@ -1431,7 +1447,7 @@ route_set_origin (void *rule, struct prefix *prefix, route_map_object_t type, vo
|
||||||
|
|
||||||
/* Compile function for origin set. */
|
/* Compile function for origin set. */
|
||||||
void *
|
void *
|
||||||
route_set_origin_compile (char *arg)
|
route_set_origin_compile (const char *arg)
|
||||||
{
|
{
|
||||||
u_char *origin;
|
u_char *origin;
|
||||||
|
|
||||||
|
@ -1483,7 +1499,7 @@ route_set_atomic_aggregate (void *rule, struct prefix *prefix,
|
||||||
|
|
||||||
/* Compile function for atomic aggregate. */
|
/* Compile function for atomic aggregate. */
|
||||||
void *
|
void *
|
||||||
route_set_atomic_aggregate_compile (char *arg)
|
route_set_atomic_aggregate_compile (const char *arg)
|
||||||
{
|
{
|
||||||
return (void *)1;
|
return (void *)1;
|
||||||
}
|
}
|
||||||
|
@ -1532,7 +1548,7 @@ route_set_aggregator_as (void *rule, struct prefix *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
route_set_aggregator_as_compile (char *arg)
|
route_set_aggregator_as_compile (const char *arg)
|
||||||
{
|
{
|
||||||
struct aggregator *aggregator;
|
struct aggregator *aggregator;
|
||||||
char as[10];
|
char as[10];
|
||||||
|
@ -1585,7 +1601,7 @@ route_match_ipv6_address (void *rule, struct prefix *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
route_match_ipv6_address_compile (char *arg)
|
route_match_ipv6_address_compile (const char *arg)
|
||||||
{
|
{
|
||||||
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
||||||
}
|
}
|
||||||
|
@ -1633,7 +1649,7 @@ route_match_ipv6_next_hop (void *rule, struct prefix *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
route_match_ipv6_next_hop_compile (char *arg)
|
route_match_ipv6_next_hop_compile (const char *arg)
|
||||||
{
|
{
|
||||||
struct in6_addr *address;
|
struct in6_addr *address;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1685,7 +1701,7 @@ route_match_ipv6_address_prefix_list (void *rule, struct prefix *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
route_match_ipv6_address_prefix_list_compile (char *arg)
|
route_match_ipv6_address_prefix_list_compile (const char *arg)
|
||||||
{
|
{
|
||||||
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
|
||||||
}
|
}
|
||||||
|
@ -1734,7 +1750,7 @@ route_set_ipv6_nexthop_global (void *rule, struct prefix *prefix,
|
||||||
/* Route map `ip next-hop' compile function. Given string is converted
|
/* Route map `ip next-hop' compile function. Given string is converted
|
||||||
to struct in_addr structure. */
|
to struct in_addr structure. */
|
||||||
void *
|
void *
|
||||||
route_set_ipv6_nexthop_global_compile (char *arg)
|
route_set_ipv6_nexthop_global_compile (const char *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct in6_addr *address;
|
struct in6_addr *address;
|
||||||
|
@ -1798,7 +1814,7 @@ route_set_ipv6_nexthop_local (void *rule, struct prefix *prefix,
|
||||||
/* Route map `ip nexthop' compile function. Given string is converted
|
/* Route map `ip nexthop' compile function. Given string is converted
|
||||||
to struct in_addr structure. */
|
to struct in_addr structure. */
|
||||||
void *
|
void *
|
||||||
route_set_ipv6_nexthop_local_compile (char *arg)
|
route_set_ipv6_nexthop_local_compile (const char *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct in6_addr *address;
|
struct in6_addr *address;
|
||||||
|
@ -1856,7 +1872,7 @@ route_set_vpnv4_nexthop (void *rule, struct prefix *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
route_set_vpnv4_nexthop_compile (char *arg)
|
route_set_vpnv4_nexthop_compile (const char *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct in_addr *address;
|
struct in_addr *address;
|
||||||
|
@ -1912,7 +1928,7 @@ route_set_originator_id (void *rule, struct prefix *prefix, route_map_object_t t
|
||||||
|
|
||||||
/* Compile function for originator-id set. */
|
/* Compile function for originator-id set. */
|
||||||
void *
|
void *
|
||||||
route_set_originator_id_compile (char *arg)
|
route_set_originator_id_compile (const char *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct in_addr *address;
|
struct in_addr *address;
|
||||||
|
@ -1949,7 +1965,7 @@ struct route_map_rule_cmd route_set_originator_id_cmd =
|
||||||
/* Add bgp route map rule. */
|
/* Add bgp route map rule. */
|
||||||
int
|
int
|
||||||
bgp_route_match_add (struct vty *vty, struct route_map_index *index,
|
bgp_route_match_add (struct vty *vty, struct route_map_index *index,
|
||||||
char *command, char *arg)
|
const char *command, const char *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -1974,7 +1990,7 @@ bgp_route_match_add (struct vty *vty, struct route_map_index *index,
|
||||||
/* Delete bgp route map rule. */
|
/* Delete bgp route map rule. */
|
||||||
int
|
int
|
||||||
bgp_route_match_delete (struct vty *vty, struct route_map_index *index,
|
bgp_route_match_delete (struct vty *vty, struct route_map_index *index,
|
||||||
char *command, char *arg)
|
const char *command, const char *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -1999,7 +2015,7 @@ bgp_route_match_delete (struct vty *vty, struct route_map_index *index,
|
||||||
/* Add bgp route map rule. */
|
/* Add bgp route map rule. */
|
||||||
int
|
int
|
||||||
bgp_route_set_add (struct vty *vty, struct route_map_index *index,
|
bgp_route_set_add (struct vty *vty, struct route_map_index *index,
|
||||||
char *command, char *arg)
|
const char *command, const char *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -2024,7 +2040,7 @@ bgp_route_set_add (struct vty *vty, struct route_map_index *index,
|
||||||
/* Delete bgp route map rule. */
|
/* Delete bgp route map rule. */
|
||||||
int
|
int
|
||||||
bgp_route_set_delete (struct vty *vty, struct route_map_index *index,
|
bgp_route_set_delete (struct vty *vty, struct route_map_index *index,
|
||||||
char *command, char *arg)
|
const char *command, const char *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -2048,7 +2064,7 @@ bgp_route_set_delete (struct vty *vty, struct route_map_index *index,
|
||||||
|
|
||||||
/* Hook function for updating route_map assignment. */
|
/* Hook function for updating route_map assignment. */
|
||||||
void
|
void
|
||||||
bgp_route_map_update (char *unused)
|
bgp_route_map_update (const char *unused)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
afi_t afi;
|
afi_t afi;
|
||||||
|
@ -3083,16 +3099,10 @@ DEFUN (set_aggregator_as,
|
||||||
int ret;
|
int ret;
|
||||||
as_t as;
|
as_t as;
|
||||||
struct in_addr address;
|
struct in_addr address;
|
||||||
char *endptr = NULL;
|
|
||||||
char *argstr;
|
char *argstr;
|
||||||
|
|
||||||
as = strtoul (argv[0], &endptr, 10);
|
VTY_GET_INTEGER_RANGE ("AS Path", as, argv[0], 1, BGP_AS_MAX)
|
||||||
if (as == 0 || as == ULONG_MAX || *endptr != '\0')
|
|
||||||
{
|
|
||||||
vty_out (vty, "AS path value malformed%s", VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = inet_aton (argv[1], &address);
|
ret = inet_aton (argv[1], &address);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
|
@ -3123,18 +3133,12 @@ DEFUN (no_set_aggregator_as,
|
||||||
int ret;
|
int ret;
|
||||||
as_t as;
|
as_t as;
|
||||||
struct in_addr address;
|
struct in_addr address;
|
||||||
char *endptr = NULL;
|
|
||||||
char *argstr;
|
char *argstr;
|
||||||
|
|
||||||
if (argv == 0)
|
if (argv == 0)
|
||||||
return bgp_route_set_delete (vty, vty->index, "aggregator as", NULL);
|
return bgp_route_set_delete (vty, vty->index, "aggregator as", NULL);
|
||||||
|
|
||||||
as = strtoul (argv[0], &endptr, 10);
|
VTY_GET_INTEGER_RANGE ("AS Path", as, argv[0], 1, BGP_AS_MAX)
|
||||||
if (as == 0 || as == ULONG_MAX || *endptr != '\0')
|
|
||||||
{
|
|
||||||
vty_out (vty, "AS path value malformed%s", VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = inet_aton (argv[1], &address);
|
ret = inet_aton (argv[1], &address);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
|
|
|
@ -627,7 +627,7 @@ bgp4PathAttrLookup (struct variable *v, oid name[], size_t *length,
|
||||||
struct bgp_info *min;
|
struct bgp_info *min;
|
||||||
struct bgp_node *rn;
|
struct bgp_node *rn;
|
||||||
union sockunion su;
|
union sockunion su;
|
||||||
int len;
|
unsigned int len;
|
||||||
struct in_addr paddr;
|
struct in_addr paddr;
|
||||||
|
|
||||||
#define BGP_PATHATTR_ENTRY_OFFSET \
|
#define BGP_PATHATTR_ENTRY_OFFSET \
|
||||||
|
|
180
bgpd/bgp_vty.c
180
bgpd/bgp_vty.c
|
@ -84,7 +84,7 @@ peer_address_self_check (union sockunion *su)
|
||||||
|
|
||||||
/* Utility function for looking up peer from VTY. */
|
/* Utility function for looking up peer from VTY. */
|
||||||
struct peer *
|
struct peer *
|
||||||
peer_lookup_vty (struct vty *vty, char *ip_str)
|
peer_lookup_vty (struct vty *vty, const char *ip_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
@ -111,7 +111,7 @@ peer_lookup_vty (struct vty *vty, char *ip_str)
|
||||||
|
|
||||||
/* Utility function for looking up peer or peer group. */
|
/* Utility function for looking up peer or peer group. */
|
||||||
struct peer *
|
struct peer *
|
||||||
peer_and_group_lookup_vty (struct vty *vty, char *peer_str)
|
peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
@ -144,7 +144,7 @@ peer_and_group_lookup_vty (struct vty *vty, char *peer_str)
|
||||||
int
|
int
|
||||||
bgp_vty_return (struct vty *vty, int ret)
|
bgp_vty_return (struct vty *vty, int ret)
|
||||||
{
|
{
|
||||||
char *str = NULL;
|
const char *str = NULL;
|
||||||
|
|
||||||
switch (ret)
|
switch (ret)
|
||||||
{
|
{
|
||||||
|
@ -297,7 +297,7 @@ DEFUN (router_bgp,
|
||||||
int ret;
|
int ret;
|
||||||
as_t as;
|
as_t as;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
char *name = NULL;
|
const char *name = NULL;
|
||||||
|
|
||||||
VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535);
|
VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535);
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ DEFUN (no_router_bgp,
|
||||||
{
|
{
|
||||||
as_t as;
|
as_t as;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
char *name = NULL;
|
const char *name = NULL;
|
||||||
|
|
||||||
VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535);
|
VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, 65535);
|
||||||
|
|
||||||
|
@ -1143,8 +1143,8 @@ ALIAS (no_bgp_default_local_preference,
|
||||||
"Configure default local preference value\n")
|
"Configure default local preference value\n")
|
||||||
|
|
||||||
static int
|
static int
|
||||||
peer_remote_as_vty (struct vty *vty, char *peer_str, char *as_str, afi_t afi,
|
peer_remote_as_vty (struct vty *vty, const char *peer_str,
|
||||||
safi_t safi)
|
const char *as_str, afi_t afi, safi_t safi)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
@ -1508,7 +1508,8 @@ DEFUN (no_neighbor_set_peer_group,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_flag_modify_vty (struct vty *vty, char *ip_str, u_int16_t flag, int set)
|
peer_flag_modify_vty (struct vty *vty, const char *ip_str,
|
||||||
|
u_int16_t flag, int set)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -1526,13 +1527,13 @@ peer_flag_modify_vty (struct vty *vty, char *ip_str, u_int16_t flag, int set)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_flag_set_vty (struct vty *vty, char *ip_str, u_int16_t flag)
|
peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
|
||||||
{
|
{
|
||||||
return peer_flag_modify_vty (vty, ip_str, flag, 1);
|
return peer_flag_modify_vty (vty, ip_str, flag, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_flag_unset_vty (struct vty *vty, char *ip_str, u_int16_t flag)
|
peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
|
||||||
{
|
{
|
||||||
return peer_flag_modify_vty (vty, ip_str, flag, 0);
|
return peer_flag_modify_vty (vty, ip_str, flag, 0);
|
||||||
}
|
}
|
||||||
|
@ -1652,7 +1653,7 @@ DEFUN (no_neighbor_dont_capability_negotiate,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_af_flag_modify_vty (struct vty *vty, char *peer_str, afi_t afi,
|
peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
|
||||||
safi_t safi, u_int32_t flag, int set)
|
safi_t safi, u_int32_t flag, int set)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1671,14 +1672,14 @@ peer_af_flag_modify_vty (struct vty *vty, char *peer_str, afi_t afi,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_af_flag_set_vty (struct vty *vty, char *peer_str, afi_t afi,
|
peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
|
||||||
safi_t safi, u_int32_t flag)
|
safi_t safi, u_int32_t flag)
|
||||||
{
|
{
|
||||||
return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
|
return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_af_flag_unset_vty (struct vty *vty, char *peer_str, afi_t afi,
|
peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
|
||||||
safi_t safi, u_int32_t flag)
|
safi_t safi, u_int32_t flag)
|
||||||
{
|
{
|
||||||
return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
|
return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
|
||||||
|
@ -1929,7 +1930,8 @@ DEFUN (no_neighbor_route_reflector_client,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_rsclient_set_vty (struct vty *vty, char *peer_str, int afi, int safi)
|
peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
|
||||||
|
int afi, int safi)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
@ -2010,7 +2012,8 @@ peer_rsclient_set_vty (struct vty *vty, char *peer_str, int afi, int safi)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_rsclient_unset_vty (struct vty *vty, char *peer_str, int afi, int safi)
|
peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
|
||||||
|
int afi, int safi)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
@ -2466,10 +2469,11 @@ DEFUN (neighbor_transparent_nexthop,
|
||||||
|
|
||||||
/* EBGP multihop configuration. */
|
/* EBGP multihop configuration. */
|
||||||
int
|
int
|
||||||
peer_ebgp_multihop_set_vty (struct vty *vty, char *ip_str, char *ttl_str)
|
peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
|
||||||
|
const char *ttl_str)
|
||||||
{
|
{
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
int ttl;
|
unsigned int ttl;
|
||||||
|
|
||||||
peer = peer_and_group_lookup_vty (vty, ip_str);
|
peer = peer_and_group_lookup_vty (vty, ip_str);
|
||||||
if (! peer)
|
if (! peer)
|
||||||
|
@ -2486,7 +2490,7 @@ peer_ebgp_multihop_set_vty (struct vty *vty, char *ip_str, char *ttl_str)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_ebgp_multihop_unset_vty (struct vty *vty, char *ip_str)
|
peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
|
||||||
{
|
{
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
|
||||||
|
@ -2632,7 +2636,8 @@ ALIAS (no_neighbor_description,
|
||||||
|
|
||||||
/* Neighbor update-source. */
|
/* Neighbor update-source. */
|
||||||
int
|
int
|
||||||
peer_update_source_vty (struct vty *vty, char *peer_str, char *source_str)
|
peer_update_source_vty (struct vty *vty, const char *peer_str,
|
||||||
|
const char *source_str)
|
||||||
{
|
{
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
union sockunion *su;
|
union sockunion *su;
|
||||||
|
@ -2682,8 +2687,9 @@ DEFUN (no_neighbor_update_source,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_default_originate_set_vty (struct vty *vty, char *peer_str, afi_t afi,
|
peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
|
||||||
safi_t safi, char *rmap, int set)
|
afi_t afi, safi_t safi,
|
||||||
|
const char *rmap, int set)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -2749,7 +2755,8 @@ ALIAS (no_neighbor_default_originate,
|
||||||
|
|
||||||
/* Set neighbor's BGP port. */
|
/* Set neighbor's BGP port. */
|
||||||
int
|
int
|
||||||
peer_port_vty (struct vty *vty, char *ip_str, int afi, char *port_str)
|
peer_port_vty (struct vty *vty, const char *ip_str, int afi,
|
||||||
|
const char *port_str)
|
||||||
{
|
{
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
u_int16_t port;
|
u_int16_t port;
|
||||||
|
@ -2808,7 +2815,8 @@ ALIAS (no_neighbor_port,
|
||||||
|
|
||||||
/* neighbor weight. */
|
/* neighbor weight. */
|
||||||
int
|
int
|
||||||
peer_weight_set_vty (struct vty *vty, char *ip_str, char *weight_str)
|
peer_weight_set_vty (struct vty *vty, const char *ip_str,
|
||||||
|
const char *weight_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -2826,7 +2834,7 @@ peer_weight_set_vty (struct vty *vty, char *ip_str, char *weight_str)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_weight_unset_vty (struct vty *vty, char *ip_str)
|
peer_weight_unset_vty (struct vty *vty, const char *ip_str)
|
||||||
{
|
{
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
|
||||||
|
@ -2914,8 +2922,8 @@ DEFUN (no_neighbor_strict_capability,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_timers_set_vty (struct vty *vty, char *ip_str, char *keep_str,
|
peer_timers_set_vty (struct vty *vty, const char *ip_str,
|
||||||
char *hold_str)
|
const char *keep_str, const char *hold_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -2935,7 +2943,7 @@ peer_timers_set_vty (struct vty *vty, char *ip_str, char *keep_str,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_timers_unset_vty (struct vty *vty, char *ip_str)
|
peer_timers_unset_vty (struct vty *vty, const char *ip_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -2973,7 +2981,8 @@ DEFUN (no_neighbor_timers,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_timers_connect_set_vty (struct vty *vty, char *ip_str, char *time_str)
|
peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
|
||||||
|
const char *time_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -2991,7 +3000,7 @@ peer_timers_connect_set_vty (struct vty *vty, char *ip_str, char *time_str)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_timers_connect_unset_vty (struct vty *vty, char *ip_str)
|
peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3040,8 +3049,8 @@ ALIAS (no_neighbor_timers_connect,
|
||||||
"Connect timer\n")
|
"Connect timer\n")
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_advertise_interval_vty (struct vty *vty, char *ip_str, char *time_str,
|
peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
|
||||||
int set)
|
const char *time_str, int set)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3094,7 +3103,7 @@ ALIAS (no_neighbor_advertise_interval,
|
||||||
"time in seconds\n")
|
"time in seconds\n")
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_version_vty (struct vty *vty, char *ip_str, char *str)
|
peer_version_vty (struct vty *vty, const char *ip_str, const char *str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3145,7 +3154,7 @@ DEFUN (no_neighbor_version,
|
||||||
|
|
||||||
/* neighbor interface */
|
/* neighbor interface */
|
||||||
int
|
int
|
||||||
peer_interface_vty (struct vty *vty, char *ip_str, char *str)
|
peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3187,8 +3196,9 @@ DEFUN (no_neighbor_interface,
|
||||||
|
|
||||||
/* Set distribute list to the peer. */
|
/* Set distribute list to the peer. */
|
||||||
int
|
int
|
||||||
peer_distribute_set_vty (struct vty *vty, char *ip_str, afi_t afi, safi_t safi,
|
peer_distribute_set_vty (struct vty *vty, const char *ip_str,
|
||||||
char *name_str, char *direct_str)
|
afi_t afi, safi_t safi,
|
||||||
|
const char *name_str, const char *direct_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3210,8 +3220,8 @@ peer_distribute_set_vty (struct vty *vty, char *ip_str, afi_t afi, safi_t safi,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_distribute_unset_vty (struct vty *vty, char *ip_str, afi_t afi,
|
peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
|
||||||
safi_t safi, char *direct_str)
|
safi_t safi, const char *direct_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3267,8 +3277,9 @@ DEFUN (no_neighbor_distribute_list,
|
||||||
|
|
||||||
/* Set prefix list to the peer. */
|
/* Set prefix list to the peer. */
|
||||||
int
|
int
|
||||||
peer_prefix_list_set_vty (struct vty *vty, char *ip_str, afi_t afi,
|
peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
|
||||||
safi_t safi, char *name_str, char *direct_str)
|
safi_t safi, const char *name_str,
|
||||||
|
const char *direct_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3290,8 +3301,8 @@ peer_prefix_list_set_vty (struct vty *vty, char *ip_str, afi_t afi,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_prefix_list_unset_vty (struct vty *vty, char *ip_str, afi_t afi,
|
peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
|
||||||
safi_t safi, char *direct_str)
|
safi_t safi, const char *direct_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3342,8 +3353,9 @@ DEFUN (no_neighbor_prefix_list,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_aslist_set_vty (struct vty *vty, char *ip_str, afi_t afi, safi_t safi,
|
peer_aslist_set_vty (struct vty *vty, const char *ip_str,
|
||||||
char *name_str, char *direct_str)
|
afi_t afi, safi_t safi,
|
||||||
|
const char *name_str, const char *direct_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3365,8 +3377,9 @@ peer_aslist_set_vty (struct vty *vty, char *ip_str, afi_t afi, safi_t safi,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_aslist_unset_vty (struct vty *vty, char *ip_str, afi_t afi, safi_t safi,
|
peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
|
||||||
char *direct_str)
|
afi_t afi, safi_t safi,
|
||||||
|
const char *direct_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3418,8 +3431,9 @@ DEFUN (no_neighbor_filter_list,
|
||||||
|
|
||||||
/* Set route-map to the peer. */
|
/* Set route-map to the peer. */
|
||||||
int
|
int
|
||||||
peer_route_map_set_vty (struct vty *vty, char *ip_str, afi_t afi, safi_t safi,
|
peer_route_map_set_vty (struct vty *vty, const char *ip_str,
|
||||||
char *name_str, char *direct_str)
|
afi_t afi, safi_t safi,
|
||||||
|
const char *name_str, const char *direct_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3445,8 +3459,8 @@ peer_route_map_set_vty (struct vty *vty, char *ip_str, afi_t afi, safi_t safi,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_route_map_unset_vty (struct vty *vty, char *ip_str, afi_t afi,
|
peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
|
||||||
safi_t safi, char *direct_str)
|
safi_t safi, const char *direct_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3506,8 +3520,8 @@ DEFUN (no_neighbor_route_map,
|
||||||
|
|
||||||
/* Set unsuppress-map to the peer. */
|
/* Set unsuppress-map to the peer. */
|
||||||
int
|
int
|
||||||
peer_unsuppress_map_set_vty (struct vty *vty, char *ip_str, afi_t afi,
|
peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
|
||||||
safi_t safi, char *name_str)
|
safi_t safi, const char *name_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3523,7 +3537,7 @@ peer_unsuppress_map_set_vty (struct vty *vty, char *ip_str, afi_t afi,
|
||||||
|
|
||||||
/* Unset route-map from the peer. */
|
/* Unset route-map from the peer. */
|
||||||
int
|
int
|
||||||
peer_unsuppress_map_unset_vty (struct vty *vty, char *ip_str, afi_t afi,
|
peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
|
||||||
safi_t safi)
|
safi_t safi)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -3564,9 +3578,9 @@ DEFUN (no_neighbor_unsuppress_map,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_maximum_prefix_set_vty (struct vty *vty, char *ip_str, afi_t afi,
|
peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
|
||||||
safi_t safi, char *num_str, char *threshold_str,
|
safi_t safi, const char *num_str,
|
||||||
int warning)
|
const char *threshold_str, int warning)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -3589,7 +3603,7 @@ peer_maximum_prefix_set_vty (struct vty *vty, char *ip_str, afi_t afi,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_maximum_prefix_unset_vty (struct vty *vty, char *ip_str, afi_t afi,
|
peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
|
||||||
safi_t safi)
|
safi_t safi)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -3711,7 +3725,7 @@ DEFUN (neighbor_allowas_in,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
int allow_num;
|
unsigned int allow_num;
|
||||||
|
|
||||||
peer = peer_and_group_lookup_vty (vty, argv[0]);
|
peer = peer_and_group_lookup_vty (vty, argv[0]);
|
||||||
if (! peer)
|
if (! peer)
|
||||||
|
@ -3863,7 +3877,7 @@ bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
|
||||||
/* `clear ip bgp' functions. */
|
/* `clear ip bgp' functions. */
|
||||||
int
|
int
|
||||||
bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
|
bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
|
||||||
enum clear_sort sort,enum bgp_clear_type stype, char *arg)
|
enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -4005,8 +4019,9 @@ bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_clear_vty (struct vty *vty, char *name, afi_t afi, safi_t safi,
|
bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
|
||||||
enum clear_sort sort, enum bgp_clear_type stype, char *arg)
|
enum clear_sort sort, enum bgp_clear_type stype,
|
||||||
|
const char *arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
@ -6412,7 +6427,8 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_show_summary_vty (struct vty *vty, char *name, afi_t afi, safi_t safi)
|
bgp_show_summary_vty (struct vty *vty, const char *name,
|
||||||
|
afi_t afi, safi_t safi)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
|
||||||
|
@ -6602,7 +6618,7 @@ DEFUN (show_ipv6_mbgp_summary,
|
||||||
}
|
}
|
||||||
#endif /* HAVE_IPV6 */
|
#endif /* HAVE_IPV6 */
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
afi_safi_print (afi_t afi, safi_t safi)
|
afi_safi_print (afi_t afi, safi_t safi)
|
||||||
{
|
{
|
||||||
if (afi == AFI_IP && safi == SAFI_UNICAST)
|
if (afi == AFI_IP && safi == SAFI_UNICAST)
|
||||||
|
@ -7187,8 +7203,8 @@ bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_show_neighbor_vty (struct vty *vty, char *name, enum show_type type,
|
bgp_show_neighbor_vty (struct vty *vty, const char *name,
|
||||||
char *ip_str)
|
enum show_type type, const char *ip_str)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
@ -7505,7 +7521,7 @@ bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
|
||||||
{
|
{
|
||||||
char timebuf[BGP_UPTIME_LEN];
|
char timebuf[BGP_UPTIME_LEN];
|
||||||
char rmbuf[14];
|
char rmbuf[14];
|
||||||
char *rmname;
|
const char *rmname;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
struct listnode *nn;
|
struct listnode *nn;
|
||||||
int len;
|
int len;
|
||||||
|
@ -7576,7 +7592,8 @@ bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi)
|
bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
|
||||||
|
afi_t afi, safi_t safi)
|
||||||
{
|
{
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
struct listnode *nn;
|
struct listnode *nn;
|
||||||
|
@ -7618,7 +7635,8 @@ bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t s
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
bgp_show_rsclient_summary_vty (struct vty *vty, char *name, afi_t afi, safi_t safi)
|
bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
|
||||||
|
afi_t afi, safi_t safi)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
|
||||||
|
@ -7760,7 +7778,7 @@ ALIAS (show_bgp_instance_rsclient_summary,
|
||||||
/* Utility function to convert user input route type string to route
|
/* Utility function to convert user input route type string to route
|
||||||
type. */
|
type. */
|
||||||
static int
|
static int
|
||||||
bgp_str2route_type (int afi, char *str)
|
bgp_str2route_type (int afi, const char *str)
|
||||||
{
|
{
|
||||||
if (! str)
|
if (! str)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -8306,7 +8324,7 @@ bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
|
||||||
safi_t safi, int *write)
|
safi_t safi, int *write)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *str[] = { "system", "kernel", "connected", "static", "rip",
|
const char *str[] = { "system", "kernel", "connected", "static", "rip",
|
||||||
"ripng", "ospf", "ospf6", "isis", "bgp"};
|
"ripng", "ospf", "ospf6", "isis", "bgp"};
|
||||||
|
|
||||||
/* Unicast redistribution only. */
|
/* Unicast redistribution only. */
|
||||||
|
@ -9325,7 +9343,7 @@ bgp_vty_init ()
|
||||||
/* VTY functions. */
|
/* VTY functions. */
|
||||||
|
|
||||||
/* Direction value to string conversion. */
|
/* Direction value to string conversion. */
|
||||||
char *
|
const char *
|
||||||
community_direct_str (int direct)
|
community_direct_str (int direct)
|
||||||
{
|
{
|
||||||
switch (direct)
|
switch (direct)
|
||||||
|
@ -9365,8 +9383,8 @@ community_list_perror (struct vty *vty, int ret)
|
||||||
|
|
||||||
/* VTY interface for community_set() function. */
|
/* VTY interface for community_set() function. */
|
||||||
int
|
int
|
||||||
community_list_set_vty (struct vty *vty, int argc, char **argv, int style,
|
community_list_set_vty (struct vty *vty, int argc, const char **argv,
|
||||||
int reject_all_digit_name)
|
int style, int reject_all_digit_name)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int direct;
|
int direct;
|
||||||
|
@ -9418,7 +9436,7 @@ community_list_set_vty (struct vty *vty, int argc, char **argv, int style,
|
||||||
|
|
||||||
/* Community-list delete with name. */
|
/* Community-list delete with name. */
|
||||||
int
|
int
|
||||||
community_list_unset_all_vty (struct vty *vty, char *name)
|
community_list_unset_all_vty (struct vty *vty, const char *name)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -9434,7 +9452,8 @@ community_list_unset_all_vty (struct vty *vty, char *name)
|
||||||
|
|
||||||
/* Communiyt-list entry delete. */
|
/* Communiyt-list entry delete. */
|
||||||
int
|
int
|
||||||
community_list_unset_vty (struct vty *vty, int argc, char **argv, int style)
|
community_list_unset_vty (struct vty *vty, int argc, const char **argv,
|
||||||
|
int style)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int direct;
|
int direct;
|
||||||
|
@ -9738,8 +9757,8 @@ DEFUN (show_ip_community_list_arg,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
extcommunity_list_set_vty (struct vty *vty, int argc, char **argv, int style,
|
extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
|
||||||
int reject_all_digit_name)
|
int style, int reject_all_digit_name)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int direct;
|
int direct;
|
||||||
|
@ -9786,7 +9805,7 @@ extcommunity_list_set_vty (struct vty *vty, int argc, char **argv, int style,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
extcommunity_list_unset_all_vty (struct vty *vty, char *name)
|
extcommunity_list_unset_all_vty (struct vty *vty, const char *name)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -9801,7 +9820,8 @@ extcommunity_list_unset_all_vty (struct vty *vty, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
extcommunity_list_unset_vty (struct vty *vty, int argc, char **argv, int style)
|
extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
|
||||||
|
int style)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int direct;
|
int direct;
|
||||||
|
@ -10077,10 +10097,10 @@ DEFUN (show_ip_extcommunity_list_arg,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return configuration string of community-list entry. */
|
/* Return configuration string of community-list entry. */
|
||||||
static char *
|
static const char *
|
||||||
community_list_config_str (struct community_entry *entry)
|
community_list_config_str (struct community_entry *entry)
|
||||||
{
|
{
|
||||||
char *str;
|
const char *str;
|
||||||
|
|
||||||
if (entry->any)
|
if (entry->any)
|
||||||
str = "";
|
str = "";
|
||||||
|
|
|
@ -842,7 +842,8 @@ bgp_redistribute_set (struct bgp *bgp, afi_t afi, int type)
|
||||||
|
|
||||||
/* Redistribute with route-map specification. */
|
/* Redistribute with route-map specification. */
|
||||||
int
|
int
|
||||||
bgp_redistribute_rmap_set (struct bgp *bgp, afi_t afi, int type, char *name)
|
bgp_redistribute_rmap_set (struct bgp *bgp, afi_t afi, int type,
|
||||||
|
const char *name)
|
||||||
{
|
{
|
||||||
if (bgp->rmap[afi][type].name
|
if (bgp->rmap[afi][type].name
|
||||||
&& (strcmp (bgp->rmap[afi][type].name, name) == 0))
|
&& (strcmp (bgp->rmap[afi][type].name, name) == 0))
|
||||||
|
|
|
@ -25,7 +25,7 @@ void bgp_zebra_announce (struct prefix *, struct bgp_info *, struct bgp *);
|
||||||
void bgp_zebra_withdraw (struct prefix *, struct bgp_info *);
|
void bgp_zebra_withdraw (struct prefix *, struct bgp_info *);
|
||||||
|
|
||||||
int bgp_redistribute_set (struct bgp *, afi_t, int);
|
int bgp_redistribute_set (struct bgp *, afi_t, int);
|
||||||
int bgp_redistribute_rmap_set (struct bgp *, afi_t, int, char *);
|
int bgp_redistribute_rmap_set (struct bgp *, afi_t, int, const char *);
|
||||||
int bgp_redistribute_metric_set (struct bgp *, afi_t, int, u_int32_t);
|
int bgp_redistribute_metric_set (struct bgp *, afi_t, int, u_int32_t);
|
||||||
int bgp_redistribute_unset (struct bgp *, afi_t, int);
|
int bgp_redistribute_unset (struct bgp *, afi_t, int);
|
||||||
int bgp_redistribute_routemap_unset (struct bgp *, afi_t, int);
|
int bgp_redistribute_routemap_unset (struct bgp *, afi_t, int);
|
||||||
|
|
40
bgpd/bgpd.c
40
bgpd/bgpd.c
|
@ -1197,7 +1197,7 @@ peer_group_free (struct peer_group *group)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct peer_group *
|
struct peer_group *
|
||||||
peer_group_lookup (struct bgp *bgp, char *name)
|
peer_group_lookup (struct bgp *bgp, const char *name)
|
||||||
{
|
{
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
struct listnode *nn;
|
struct listnode *nn;
|
||||||
|
@ -1211,7 +1211,7 @@ peer_group_lookup (struct bgp *bgp, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct peer_group *
|
struct peer_group *
|
||||||
peer_group_get (struct bgp *bgp, char *name)
|
peer_group_get (struct bgp *bgp, const char *name)
|
||||||
{
|
{
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
|
|
||||||
|
@ -1490,7 +1490,7 @@ peer_group2peer_config_copy (struct peer_group *group, struct peer *peer,
|
||||||
|
|
||||||
/* Peer group's remote AS configuration. */
|
/* Peer group's remote AS configuration. */
|
||||||
int
|
int
|
||||||
peer_group_remote_as (struct bgp *bgp, char *group_name, as_t *as)
|
peer_group_remote_as (struct bgp *bgp, const char *group_name, as_t *as)
|
||||||
{
|
{
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
|
@ -1738,7 +1738,7 @@ peer_group_unbind (struct bgp *bgp, struct peer *peer,
|
||||||
|
|
||||||
/* BGP instance creation by `router bgp' commands. */
|
/* BGP instance creation by `router bgp' commands. */
|
||||||
struct bgp *
|
struct bgp *
|
||||||
bgp_create (as_t *as, char *name)
|
bgp_create (as_t *as, const char *name)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
afi_t afi;
|
afi_t afi;
|
||||||
|
@ -1747,7 +1747,7 @@ bgp_create (as_t *as, char *name)
|
||||||
bgp = XCALLOC (MTYPE_BGP, sizeof (struct bgp));
|
bgp = XCALLOC (MTYPE_BGP, sizeof (struct bgp));
|
||||||
|
|
||||||
bgp->peer_self = peer_new ();
|
bgp->peer_self = peer_new ();
|
||||||
bgp->peer_self->host = "Static announcement";
|
bgp->peer_self->host = strdup ("Static announcement");
|
||||||
|
|
||||||
bgp->peer = list_new ();
|
bgp->peer = list_new ();
|
||||||
bgp->peer->cmp = (int (*)(void *, void *)) peer_cmp;
|
bgp->peer->cmp = (int (*)(void *, void *)) peer_cmp;
|
||||||
|
@ -1800,7 +1800,7 @@ bgp_get_default ()
|
||||||
|
|
||||||
/* Lookup BGP entry. */
|
/* Lookup BGP entry. */
|
||||||
struct bgp *
|
struct bgp *
|
||||||
bgp_lookup (as_t as, char *name)
|
bgp_lookup (as_t as, const char *name)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
struct listnode *nn;
|
struct listnode *nn;
|
||||||
|
@ -1815,7 +1815,7 @@ bgp_lookup (as_t as, char *name)
|
||||||
|
|
||||||
/* Lookup BGP structure by view name. */
|
/* Lookup BGP structure by view name. */
|
||||||
struct bgp *
|
struct bgp *
|
||||||
bgp_lookup_by_name (char *name)
|
bgp_lookup_by_name (const char *name)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
struct listnode *nn;
|
struct listnode *nn;
|
||||||
|
@ -1829,7 +1829,7 @@ bgp_lookup_by_name (char *name)
|
||||||
|
|
||||||
/* Called from VTY commands. */
|
/* Called from VTY commands. */
|
||||||
int
|
int
|
||||||
bgp_get (struct bgp **bgp_val, as_t *as, char *name)
|
bgp_get (struct bgp **bgp_val, as_t *as, const char *name)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
|
|
||||||
|
@ -2536,7 +2536,7 @@ peer_description_unset (struct peer *peer)
|
||||||
|
|
||||||
/* Neighbor update-source. */
|
/* Neighbor update-source. */
|
||||||
int
|
int
|
||||||
peer_update_source_if_set (struct peer *peer, char *ifname)
|
peer_update_source_if_set (struct peer *peer, const char *ifname)
|
||||||
{
|
{
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
struct listnode *nn;
|
struct listnode *nn;
|
||||||
|
@ -2756,7 +2756,7 @@ peer_update_source_unset (struct peer *peer)
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_default_originate_set (struct peer *peer, afi_t afi, safi_t safi,
|
peer_default_originate_set (struct peer *peer, afi_t afi, safi_t safi,
|
||||||
char *rmap)
|
const char *rmap)
|
||||||
{
|
{
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
struct listnode *nn;
|
struct listnode *nn;
|
||||||
|
@ -3079,7 +3079,7 @@ peer_version_unset (struct peer *peer)
|
||||||
|
|
||||||
/* neighbor interface */
|
/* neighbor interface */
|
||||||
int
|
int
|
||||||
peer_interface_set (struct peer *peer, char *str)
|
peer_interface_set (struct peer *peer, const char *str)
|
||||||
{
|
{
|
||||||
if (peer->ifname)
|
if (peer->ifname)
|
||||||
free (peer->ifname);
|
free (peer->ifname);
|
||||||
|
@ -3273,7 +3273,7 @@ peer_local_as_unset (struct peer *peer)
|
||||||
/* Set distribute list to the peer. */
|
/* Set distribute list to the peer. */
|
||||||
int
|
int
|
||||||
peer_distribute_set (struct peer *peer, afi_t afi, safi_t safi, int direct,
|
peer_distribute_set (struct peer *peer, afi_t afi, safi_t safi, int direct,
|
||||||
char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
struct bgp_filter *filter;
|
struct bgp_filter *filter;
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
|
@ -3432,7 +3432,7 @@ peer_distribute_update (struct access_list *access)
|
||||||
/* Set prefix list to the peer. */
|
/* Set prefix list to the peer. */
|
||||||
int
|
int
|
||||||
peer_prefix_list_set (struct peer *peer, afi_t afi, safi_t safi, int direct,
|
peer_prefix_list_set (struct peer *peer, afi_t afi, safi_t safi, int direct,
|
||||||
char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
struct bgp_filter *filter;
|
struct bgp_filter *filter;
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
|
@ -3589,7 +3589,7 @@ peer_prefix_list_update (struct prefix_list *plist)
|
||||||
|
|
||||||
int
|
int
|
||||||
peer_aslist_set (struct peer *peer, afi_t afi, safi_t safi, int direct,
|
peer_aslist_set (struct peer *peer, afi_t afi, safi_t safi, int direct,
|
||||||
char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
struct bgp_filter *filter;
|
struct bgp_filter *filter;
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
|
@ -3745,7 +3745,7 @@ peer_aslist_update ()
|
||||||
/* Set route-map to the peer. */
|
/* Set route-map to the peer. */
|
||||||
int
|
int
|
||||||
peer_route_map_set (struct peer *peer, afi_t afi, safi_t safi, int direct,
|
peer_route_map_set (struct peer *peer, afi_t afi, safi_t safi, int direct,
|
||||||
char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
struct bgp_filter *filter;
|
struct bgp_filter *filter;
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
|
@ -3850,7 +3850,8 @@ peer_route_map_unset (struct peer *peer, afi_t afi, safi_t safi, int direct)
|
||||||
|
|
||||||
/* Set unsuppress-map to the peer. */
|
/* Set unsuppress-map to the peer. */
|
||||||
int
|
int
|
||||||
peer_unsuppress_map_set (struct peer *peer, afi_t afi, safi_t safi, char *name)
|
peer_unsuppress_map_set (struct peer *peer, afi_t afi, safi_t safi,
|
||||||
|
const char *name)
|
||||||
{
|
{
|
||||||
struct bgp_filter *filter;
|
struct bgp_filter *filter;
|
||||||
struct peer_group *group;
|
struct peer_group *group;
|
||||||
|
@ -4110,7 +4111,8 @@ peer_clear_soft (struct peer *peer, afi_t afi, safi_t safi,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display peer uptime. */
|
/* Display peer uptime.*/
|
||||||
|
/* XXX: why does this function return char * when it takes buffer? */
|
||||||
char *
|
char *
|
||||||
peer_uptime (time_t uptime2, char *buf, size_t len)
|
peer_uptime (time_t uptime2, char *buf, size_t len)
|
||||||
{
|
{
|
||||||
|
@ -4121,7 +4123,9 @@ peer_uptime (time_t uptime2, char *buf, size_t len)
|
||||||
if (len < BGP_UPTIME_LEN)
|
if (len < BGP_UPTIME_LEN)
|
||||||
{
|
{
|
||||||
zlog_warn ("peer_uptime (): buffer shortage %d", len);
|
zlog_warn ("peer_uptime (): buffer shortage %d", len);
|
||||||
return "";
|
/* XXX: should return status instead of buf... */
|
||||||
|
snprintf (buf, len, "<error> ");
|
||||||
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there is no connection has been done before print `never'. */
|
/* If there is no connection has been done before print `never'. */
|
||||||
|
|
28
bgpd/bgpd.h
28
bgpd/bgpd.h
|
@ -766,11 +766,11 @@ int bgp_nexthop_set (union sockunion *, union sockunion *,
|
||||||
struct bgp_nexthop *, struct peer *);
|
struct bgp_nexthop *, struct peer *);
|
||||||
struct bgp_master *bgp_get_master ();
|
struct bgp_master *bgp_get_master ();
|
||||||
struct bgp *bgp_get_default ();
|
struct bgp *bgp_get_default ();
|
||||||
struct bgp *bgp_lookup (as_t, char *);
|
struct bgp *bgp_lookup (as_t, const char *);
|
||||||
struct bgp *bgp_lookup_by_name (char *);
|
struct bgp *bgp_lookup_by_name (const char *);
|
||||||
struct peer *peer_lookup (struct bgp *, union sockunion *);
|
struct peer *peer_lookup (struct bgp *, union sockunion *);
|
||||||
struct peer_group *peer_group_lookup (struct bgp *, char *);
|
struct peer_group *peer_group_lookup (struct bgp *, const char *);
|
||||||
struct peer_group *peer_group_get (struct bgp *, char *);
|
struct peer_group *peer_group_get (struct bgp *, const char *);
|
||||||
struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_addr *,
|
struct peer *peer_lookup_with_open (union sockunion *, as_t, struct in_addr *,
|
||||||
int *);
|
int *);
|
||||||
int peer_sort (struct peer *peer);
|
int peer_sort (struct peer *peer);
|
||||||
|
@ -788,7 +788,7 @@ int bgp_option_set (int);
|
||||||
int bgp_option_unset (int);
|
int bgp_option_unset (int);
|
||||||
int bgp_option_check (int);
|
int bgp_option_check (int);
|
||||||
|
|
||||||
int bgp_get (struct bgp **, as_t *, char *);
|
int bgp_get (struct bgp **, as_t *, const char *);
|
||||||
int bgp_delete (struct bgp *);
|
int bgp_delete (struct bgp *);
|
||||||
|
|
||||||
int bgp_flag_set (struct bgp *, int);
|
int bgp_flag_set (struct bgp *, int);
|
||||||
|
@ -817,7 +817,7 @@ int bgp_default_local_preference_unset (struct bgp *);
|
||||||
int peer_rsclient_active (struct peer *);
|
int peer_rsclient_active (struct peer *);
|
||||||
|
|
||||||
int peer_remote_as (struct bgp *, union sockunion *, as_t *, afi_t, safi_t);
|
int peer_remote_as (struct bgp *, union sockunion *, as_t *, afi_t, safi_t);
|
||||||
int peer_group_remote_as (struct bgp *, char *, as_t *);
|
int peer_group_remote_as (struct bgp *, const char *, as_t *);
|
||||||
int peer_delete (struct peer *peer);
|
int peer_delete (struct peer *peer);
|
||||||
int peer_group_delete (struct peer_group *);
|
int peer_group_delete (struct peer_group *);
|
||||||
int peer_group_remote_as_delete (struct peer_group *);
|
int peer_group_remote_as_delete (struct peer_group *);
|
||||||
|
@ -843,11 +843,11 @@ int peer_ebgp_multihop_unset (struct peer *);
|
||||||
int peer_description_set (struct peer *, char *);
|
int peer_description_set (struct peer *, char *);
|
||||||
int peer_description_unset (struct peer *);
|
int peer_description_unset (struct peer *);
|
||||||
|
|
||||||
int peer_update_source_if_set (struct peer *, char *);
|
int peer_update_source_if_set (struct peer *, const char *);
|
||||||
int peer_update_source_addr_set (struct peer *, union sockunion *);
|
int peer_update_source_addr_set (struct peer *, union sockunion *);
|
||||||
int peer_update_source_unset (struct peer *);
|
int peer_update_source_unset (struct peer *);
|
||||||
|
|
||||||
int peer_default_originate_set (struct peer *, afi_t, safi_t, char *);
|
int peer_default_originate_set (struct peer *, afi_t, safi_t, const char *);
|
||||||
int peer_default_originate_unset (struct peer *, afi_t, safi_t);
|
int peer_default_originate_unset (struct peer *, afi_t, safi_t);
|
||||||
|
|
||||||
int peer_port_set (struct peer *, u_int16_t);
|
int peer_port_set (struct peer *, u_int16_t);
|
||||||
|
@ -868,10 +868,10 @@ int peer_advertise_interval_unset (struct peer *);
|
||||||
int peer_version_set (struct peer *, int);
|
int peer_version_set (struct peer *, int);
|
||||||
int peer_version_unset (struct peer *);
|
int peer_version_unset (struct peer *);
|
||||||
|
|
||||||
int peer_interface_set (struct peer *, char *);
|
int peer_interface_set (struct peer *, const char *);
|
||||||
int peer_interface_unset (struct peer *);
|
int peer_interface_unset (struct peer *);
|
||||||
|
|
||||||
int peer_distribute_set (struct peer *, afi_t, safi_t, int, char *);
|
int peer_distribute_set (struct peer *, afi_t, safi_t, int, const char *);
|
||||||
int peer_distribute_unset (struct peer *, afi_t, safi_t, int);
|
int peer_distribute_unset (struct peer *, afi_t, safi_t, int);
|
||||||
|
|
||||||
int peer_allowas_in_set (struct peer *, afi_t, safi_t, int);
|
int peer_allowas_in_set (struct peer *, afi_t, safi_t, int);
|
||||||
|
@ -880,16 +880,16 @@ int peer_allowas_in_unset (struct peer *, afi_t, safi_t);
|
||||||
int peer_local_as_set (struct peer *, as_t, int);
|
int peer_local_as_set (struct peer *, as_t, int);
|
||||||
int peer_local_as_unset (struct peer *);
|
int peer_local_as_unset (struct peer *);
|
||||||
|
|
||||||
int peer_prefix_list_set (struct peer *, afi_t, safi_t, int, char *);
|
int peer_prefix_list_set (struct peer *, afi_t, safi_t, int, const char *);
|
||||||
int peer_prefix_list_unset (struct peer *, afi_t, safi_t, int);
|
int peer_prefix_list_unset (struct peer *, afi_t, safi_t, int);
|
||||||
|
|
||||||
int peer_aslist_set (struct peer *, afi_t, safi_t, int, char *);
|
int peer_aslist_set (struct peer *, afi_t, safi_t, int, const char *);
|
||||||
int peer_aslist_unset (struct peer *,afi_t, safi_t, int);
|
int peer_aslist_unset (struct peer *,afi_t, safi_t, int);
|
||||||
|
|
||||||
int peer_route_map_set (struct peer *, afi_t, safi_t, int, char *);
|
int peer_route_map_set (struct peer *, afi_t, safi_t, int, const char *);
|
||||||
int peer_route_map_unset (struct peer *, afi_t, safi_t, int);
|
int peer_route_map_unset (struct peer *, afi_t, safi_t, int);
|
||||||
|
|
||||||
int peer_unsuppress_map_set (struct peer *, afi_t, safi_t, char *);
|
int peer_unsuppress_map_set (struct peer *, afi_t, safi_t, const char *);
|
||||||
int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t);
|
int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t);
|
||||||
|
|
||||||
int peer_maximum_prefix_set (struct peer *, afi_t, safi_t, u_int32_t, u_char, int);
|
int peer_maximum_prefix_set (struct peer *, afi_t, safi_t, u_int32_t, u_char, int);
|
||||||
|
|
Loading…
Reference in a new issue