diff options
Diffstat (limited to 'ospf6d/ospf6_area.c')
| -rw-r--r-- | ospf6d/ospf6_area.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c index 92934d3764..355b8441bd 100644 --- a/ospf6d/ospf6_area.c +++ b/ospf6d/ospf6_area.c @@ -50,20 +50,28 @@ DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_AREA, "OSPF6 area"); DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_PLISTNAME, "Prefix list name"); -/* Utility functions. */ -int str2area_id(const char *str, struct in_addr *area_id, int *area_id_fmt) +int str2area_id(const char *str, uint32_t *area_id, int *area_id_fmt) { char *ep; - area_id->s_addr = htonl(strtoul(str, &ep, 10)); - if (*ep && !inet_aton(str, area_id)) + *area_id = htonl(strtoul(str, &ep, 10)); + if (*ep && inet_pton(AF_INET, str, area_id) != 1) return -1; - *area_id_fmt = *ep ? OSPF6_AREA_FMT_DECIMAL : OSPF6_AREA_FMT_DOTTEDQUAD; + *area_id_fmt = + !*ep ? OSPF6_AREA_FMT_DECIMAL : OSPF6_AREA_FMT_DOTTEDQUAD; return 0; } +void area_id2str(char *buf, int len, uint32_t area_id, int area_id_fmt) +{ + if (area_id_fmt == OSPF6_AREA_FMT_DECIMAL) + snprintf(buf, len, "%u", ntohl(area_id)); + else + inet_ntop(AF_INET, &area_id, buf, len); +} + int ospf6_area_cmp(void *va, void *vb) { struct ospf6_area *oa = (struct ospf6_area *)va; @@ -538,7 +546,7 @@ DEFUN (area_range, ospf6_route_add(range, oa->range_table); } - if (ospf6_is_router_abr(ospf6)) { + if (ospf6_check_and_set_router_abr(ospf6)) { /* Redo summaries if required */ ospf6_abr_prefix_resummarize(ospf6); } @@ -584,7 +592,7 @@ DEFUN (no_area_range, return CMD_SUCCESS; } - if (ospf6_is_router_abr(oa->ospf6)) { + if (ospf6_check_and_set_router_abr(oa->ospf6)) { /* Blow away the aggregated LSA and route */ SET_FLAG(range->flag, OSPF6_ROUTE_REMOVE); |
