mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 04:25:43 +00:00
ospf6d: split off ospf6_lsa_alloc()
... so we can make the MTYPEs static to ospf6_lsa.c Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
c7479286ae
commit
771e1fbee0
@ -657,27 +657,27 @@ void ospf6_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
|
||||
vty_out(vty, "\n");
|
||||
}
|
||||
|
||||
struct ospf6_lsa *ospf6_lsa_alloc(size_t lsa_length)
|
||||
{
|
||||
lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
|
||||
lsa->header = XMALLOC(MTYPE_OSPF6_LSA_HEADER, lsa_length);
|
||||
|
||||
return lsa;
|
||||
}
|
||||
|
||||
/* OSPFv3 LSA creation/deletion function */
|
||||
struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header)
|
||||
{
|
||||
struct ospf6_lsa *lsa = NULL;
|
||||
struct ospf6_lsa_header *new_header = NULL;
|
||||
uint16_t lsa_size = 0;
|
||||
|
||||
/* size of the entire LSA */
|
||||
lsa_size = ntohs(header->length); /* XXX vulnerable */
|
||||
|
||||
/* allocate memory for this LSA */
|
||||
new_header = XMALLOC(MTYPE_OSPF6_LSA_HEADER, lsa_size);
|
||||
lsa = ospf6_lsa_alloc(lsa_size);
|
||||
|
||||
/* copy LSA from original header */
|
||||
memcpy(new_header, header, lsa_size);
|
||||
|
||||
/* LSA information structure */
|
||||
/* allocate memory */
|
||||
lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
|
||||
|
||||
lsa->header = new_header;
|
||||
memcpy(lsa->header, header, lsa_size);
|
||||
|
||||
/* dump string */
|
||||
ospf6_lsa_printbuf(lsa, lsa->name, sizeof(lsa->name));
|
||||
@ -691,20 +691,11 @@ struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header)
|
||||
struct ospf6_lsa *ospf6_lsa_create_headeronly(struct ospf6_lsa_header *header)
|
||||
{
|
||||
struct ospf6_lsa *lsa = NULL;
|
||||
struct ospf6_lsa_header *new_header = NULL;
|
||||
|
||||
/* allocate memory for this LSA */
|
||||
new_header = XMALLOC(MTYPE_OSPF6_LSA_HEADER,
|
||||
sizeof(struct ospf6_lsa_header));
|
||||
lsa = ospf6_lsa_alloc(sizeof(struct ospf6_lsa_header));
|
||||
|
||||
/* copy LSA from original header */
|
||||
memcpy(new_header, header, sizeof(struct ospf6_lsa_header));
|
||||
memcpy(lsa->header, header, sizeof(struct ospf6_lsa_header));
|
||||
|
||||
/* LSA information structure */
|
||||
/* allocate memory */
|
||||
lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
|
||||
|
||||
lsa->header = new_header;
|
||||
SET_FLAG(lsa->flag, OSPF6_LSA_HEADERONLY);
|
||||
|
||||
/* dump string */
|
||||
|
@ -217,6 +217,7 @@ extern void ospf6_lsa_show_internal(struct vty *vty, struct ospf6_lsa *lsa,
|
||||
extern void ospf6_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
|
||||
json_object *json, bool use_json);
|
||||
|
||||
extern struct ospf6_lsa *ospf6_lsa_alloc(size_t lsa_length);
|
||||
extern struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header);
|
||||
extern struct ospf6_lsa *
|
||||
ospf6_lsa_create_headeronly(struct ospf6_lsa_header *header);
|
||||
|
@ -1021,13 +1021,8 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Allocate memory for this LSA */
|
||||
new_header = XMALLOC(MTYPE_OSPF6_LSA_HEADER, total_lsa_length);
|
||||
|
||||
/* LSA information structure */
|
||||
lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
|
||||
|
||||
lsa->header = (struct ospf6_lsa_header *)new_header;
|
||||
lsa = ospf6_lsa_alloc(total_lsa_length);
|
||||
new_header = (uint8_t *)lsa->header;
|
||||
|
||||
lsa->lsdb = area->temp_router_lsa_lsdb;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user