diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2021-05-26 01:49:30 +0300 |
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-06-08 21:38:09 +0300 |
| commit | 42cabc552d50b3dbc658b88a27b75fd6a2f7bec5 (patch) | |
| tree | 80f2fe12c51a8075e481376adc13eb37b90d7c54 /ospf6d/ospf6_area.h | |
| parent | 6869bb921e7b79aeb2b145ce0b98bec8af8cbc84 (diff) | |
ospf6d: fix interface area configuration
Currently the interface area is configured from the router node using
"interface IFNAME area ID" command. There are multiple problems with
this command:
- it is not in line with all other interface-related commands - other
parameters are configured from the interface node using "ipv6 ospf6"
prefix
- it is not in line with OSPFv2 - area is configured from the interface
node using "ip ospf area" command
- most importantly, it doesn't work correctly when the interface is in
a different VRF - instead of configuring the interface, it creates a
new fake interface and configuring it instead
To fix all the problems, this commit adds a new command to the interface
configuration node - "ipv6 ospf6 area ID". The purpose of the command is
completely the same, but it works correctly in a multi-VRF environment.
The old command is preserved for the backward compatibility, but the
warning is added that it is deprecated because it doesn't work correctly
with VRFs.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'ospf6d/ospf6_area.h')
| -rw-r--r-- | ospf6d/ospf6_area.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h index fa761d732d..dd4d019015 100644 --- a/ospf6d/ospf6_area.h +++ b/ospf6d/ospf6_area.h @@ -31,6 +31,7 @@ struct ospf6_area { /* Area-ID */ in_addr_t area_id; +#define OSPF6_AREA_FMT_UNSET 0 #define OSPF6_AREA_FMT_DOTTEDQUAD 1 #define OSPF6_AREA_FMT_DECIMAL 2 /* Area-ID string */ @@ -130,20 +131,22 @@ struct ospf6_area { #define OSPF6_CMD_AREA_GET(str, oa, ospf6) \ { \ - char *ep; \ - uint32_t area_id = htonl(strtoul(str, &ep, 10)); \ - if (*ep && inet_pton(AF_INET, str, &area_id) != 1) { \ + uint32_t area_id; \ + int format, ret; \ + ret = str2area_id(str, &area_id, &format); \ + if (ret) { \ vty_out(vty, "Malformed Area-ID: %s\n", str); \ - return CMD_SUCCESS; \ + return CMD_WARNING; \ } \ - 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); \ } /* prototypes */ +extern int str2area_id(const char *str, uint32_t *area_id, int *area_id_fmt); +extern void area_id2str(char *buf, int len, uint32_t area_id, int area_id_fmt); + extern int ospf6_area_cmp(void *va, void *vb); extern struct ospf6_area *ospf6_area_create(uint32_t, struct ospf6 *, int); @@ -163,6 +166,5 @@ extern void ospf6_area_config_write(struct vty *vty, struct ospf6 *ospf6); extern void ospf6_area_init(void); struct ospf6_interface; extern void ospf6_area_interface_delete(struct ospf6_interface *oi); -int str2area_id(const char *str, struct in_addr *area_id, int *area_id_fmt); #endif /* OSPF_AREA_H */ |
