mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 16:57:43 +00:00
Merge pull request #582 from qlyoung/ospf6-df-areaid
ospf6d: remember format for ospf6 area id
This commit is contained in:
commit
db64fac494
@ -204,15 +204,32 @@ ospf6_area_no_summary_unset (struct ospf6 *ospf6, struct ospf6_area *area)
|
||||
}
|
||||
}
|
||||
|
||||
/* Make new area structure */
|
||||
/**
|
||||
* Make new area structure.
|
||||
*
|
||||
* @param area_id - ospf6 area ID
|
||||
* @param o - ospf6 instance
|
||||
* @param df - display format for area ID
|
||||
*/
|
||||
struct ospf6_area *
|
||||
ospf6_area_create (u_int32_t area_id, struct ospf6 *o)
|
||||
ospf6_area_create (u_int32_t area_id, struct ospf6 *o, int df)
|
||||
{
|
||||
struct ospf6_area *oa;
|
||||
|
||||
oa = XCALLOC (MTYPE_OSPF6_AREA, sizeof (struct ospf6_area));
|
||||
|
||||
inet_ntop (AF_INET, &area_id, oa->name, sizeof (oa->name));
|
||||
switch (df)
|
||||
{
|
||||
case OSPF6_AREA_FMT_DECIMAL:
|
||||
snprintf (oa->name, sizeof (oa->name), "%u", ntohl (area_id));
|
||||
break;
|
||||
case OSPF6_AREA_FMT_DOTTEDQUAD:
|
||||
inet_ntop (AF_INET, &area_id, oa->name, sizeof (oa->name));
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
oa->area_id = area_id;
|
||||
oa->if_list = list_new ();
|
||||
|
||||
@ -311,16 +328,6 @@ ospf6_area_lookup (u_int32_t area_id, struct ospf6 *ospf6)
|
||||
return (struct ospf6_area *) NULL;
|
||||
}
|
||||
|
||||
static struct ospf6_area *
|
||||
ospf6_area_get (u_int32_t area_id, struct ospf6 *o)
|
||||
{
|
||||
struct ospf6_area *oa;
|
||||
oa = ospf6_area_lookup (area_id, o);
|
||||
if (oa == NULL)
|
||||
oa = ospf6_area_create (area_id, o);
|
||||
return oa;
|
||||
}
|
||||
|
||||
void
|
||||
ospf6_area_enable (struct ospf6_area *oa)
|
||||
{
|
||||
@ -408,13 +415,17 @@ ospf6_area_show (struct vty *vty, struct ospf6_area *oa)
|
||||
#define OSPF6_CMD_AREA_GET(str, oa) \
|
||||
{ \
|
||||
char *ep; \
|
||||
u_int32_t area_id = htonl (strtol(str, &ep, 10)); \
|
||||
u_int32_t area_id = htonl (strtoul (str, &ep, 10)); \
|
||||
if (*ep && inet_pton (AF_INET, str, &area_id) != 1) \
|
||||
{ \
|
||||
vty_out (vty, "Malformed Area-ID: %s%s", str, VNL); \
|
||||
return CMD_SUCCESS; \
|
||||
} \
|
||||
oa = ospf6_area_get (area_id, ospf6); \
|
||||
int format = !*ep ? OSPF6_AREA_FMT_DECIMAL : \
|
||||
OSPF6_AREA_FMT_DOTTEDQUAD; \
|
||||
oa = ospf6_area_lookup (area_id, ospf6); \
|
||||
if (oa == NULL) \
|
||||
oa = ospf6_area_create (area_id, ospf6, format); \
|
||||
}
|
||||
|
||||
DEFUN (area_range,
|
||||
|
@ -31,6 +31,8 @@ struct ospf6_area
|
||||
/* Area-ID */
|
||||
u_int32_t area_id;
|
||||
|
||||
#define OSPF6_AREA_FMT_DOTTEDQUAD 1
|
||||
#define OSPF6_AREA_FMT_DECIMAL 2
|
||||
/* Area-ID string */
|
||||
char name[16];
|
||||
|
||||
@ -115,7 +117,7 @@ struct ospf6_area
|
||||
/* prototypes */
|
||||
extern int ospf6_area_cmp (void *va, void *vb);
|
||||
|
||||
extern struct ospf6_area *ospf6_area_create (u_int32_t, struct ospf6 *);
|
||||
extern struct ospf6_area *ospf6_area_create (u_int32_t, struct ospf6 *, int);
|
||||
extern void ospf6_area_delete (struct ospf6_area *);
|
||||
extern struct ospf6_area *ospf6_area_lookup (u_int32_t, struct ospf6 *);
|
||||
|
||||
|
@ -603,7 +603,7 @@ DEFUN (ospf6_interface_area,
|
||||
/* find/create ospf6 area */
|
||||
oa = ospf6_area_lookup (area_id, o);
|
||||
if (oa == NULL)
|
||||
oa = ospf6_area_create (area_id, o);
|
||||
oa = ospf6_area_create (area_id, o, OSPF6_AREA_FMT_DOTTEDQUAD);
|
||||
|
||||
/* attach interface to area */
|
||||
listnode_add (oa->if_list, oi); /* sort ?? */
|
||||
|
Loading…
Reference in New Issue
Block a user