mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 16:57:43 +00:00
2003-10-13 Jay Fenlason <fenlason@redhat.com>
* lib/zebra.h: define UINT32_MAX for those systems which do not provide it. * bgp_attr.h: define BGP_MED_MAX. * bgp_route.c: update defines/constants to BGP_MED_MAX. * bgp_routemap.c: ditto. clean up route_match_metric_compile slightly to avoid unneccesary XMALLOC.
This commit is contained in:
parent
7ddf1d6eaf
commit
3b424979f5
@ -27,6 +27,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|||||||
#define CHECK_BITMAP(MAP, NUM) \
|
#define CHECK_BITMAP(MAP, NUM) \
|
||||||
CHECK_FLAG (MAP[(NUM) / BITMAP_NBBY], 1 << ((NUM) % BITMAP_NBBY))
|
CHECK_FLAG (MAP[(NUM) / BITMAP_NBBY], 1 << ((NUM) % BITMAP_NBBY))
|
||||||
|
|
||||||
|
#define BGP_MED_MAX UINT32_MAX
|
||||||
|
|
||||||
/* BGP Attribute type range. */
|
/* BGP Attribute type range. */
|
||||||
#define BGP_ATTR_TYPE_RANGE 256
|
#define BGP_ATTR_TYPE_RANGE 256
|
||||||
#define BGP_ATTR_BITMAP_SIZE (BGP_ATTR_TYPE_RANGE / BITMAP_NBBY)
|
#define BGP_ATTR_BITMAP_SIZE (BGP_ATTR_TYPE_RANGE / BITMAP_NBBY)
|
||||||
|
@ -146,7 +146,7 @@ bgp_med_value (struct attr *attr, struct bgp *bgp)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (bgp_flag_check (bgp, BGP_FLAG_MED_MISSING_AS_WORST))
|
if (bgp_flag_check (bgp, BGP_FLAG_MED_MISSING_AS_WORST))
|
||||||
return 4294967295ul;
|
return BGP_MED_MAX;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -310,14 +310,13 @@ route_match_metric_compile (char *arg)
|
|||||||
{
|
{
|
||||||
u_int32_t *med;
|
u_int32_t *med;
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
|
unsigned long tmpval;
|
||||||
|
|
||||||
med = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
|
tmpval = strtoul (arg, &endptr, 10);
|
||||||
*med = strtoul (arg, &endptr, 10);
|
if (*endptr != '\0' || tmpval == ULONG_MAX)
|
||||||
if (*endptr != '\0' || *med == ULONG_MAX)
|
|
||||||
{
|
|
||||||
XFREE (MTYPE_ROUTE_MAP_COMPILED, med);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
med = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_int32_t));
|
||||||
|
*med = tmpval;
|
||||||
return med;
|
return med;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -879,8 +878,8 @@ route_set_metric (void *rule, struct prefix *prefix,
|
|||||||
|
|
||||||
if (strncmp (metric, "+", 1) == 0)
|
if (strncmp (metric, "+", 1) == 0)
|
||||||
{
|
{
|
||||||
if (bgp_info->attr->med/2 + metric_val/2 > UINT32_MAX/2)
|
if (bgp_info->attr->med/2 + metric_val/2 > BGP_MED_MAX/2)
|
||||||
bgp_info->attr->med = UINT32_MAX-1;
|
bgp_info->attr->med = BGP_MED_MAX - 1;
|
||||||
else
|
else
|
||||||
bgp_info->attr->med += metric_val;
|
bgp_info->attr->med += metric_val;
|
||||||
}
|
}
|
||||||
|
@ -178,6 +178,11 @@ typedef int socklen_t;
|
|||||||
#include <netinet6/nd6.h>
|
#include <netinet6/nd6.h>
|
||||||
#endif /* HAVE_NETINET6_ND6_H */
|
#endif /* HAVE_NETINET6_ND6_H */
|
||||||
|
|
||||||
|
/* Some systems do not define UINT32_MAX */
|
||||||
|
#ifndef UINT32_MAX
|
||||||
|
#define UINT32_MAX 0xFFFFFFFFU
|
||||||
|
#endif /* UINT32_MAX */
|
||||||
|
|
||||||
#ifdef HAVE_LIBUTIL_H
|
#ifdef HAVE_LIBUTIL_H
|
||||||
#include <libutil.h>
|
#include <libutil.h>
|
||||||
#endif /* HAVE_LIBUTIL_H */
|
#endif /* HAVE_LIBUTIL_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user