- Use ELM_MALLOC() for struct rainfo.
- Fix a missing back pointer assignment in struct prefix to struct rainfo when addr="" is specified. This caused SIGSEGV. - Insert a prefix element to a tail queue after setting parameters.
This commit is contained in:
parent
08892bf4bf
commit
07a42575b4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=222820
@ -229,13 +229,7 @@ getconfig(int idx)
|
|||||||
__func__, intface);
|
__func__, intface);
|
||||||
}
|
}
|
||||||
|
|
||||||
rai = malloc(sizeof(*rai));
|
ELM_MALLOC(rai, exit(1));
|
||||||
if (rai == NULL) {
|
|
||||||
syslog(LOG_INFO, "<%s> %s: can't allocate enough memory",
|
|
||||||
__func__, intface);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
memset(rai, 0, sizeof(*rai));
|
|
||||||
TAILQ_INIT(&rai->rai_prefix);
|
TAILQ_INIT(&rai->rai_prefix);
|
||||||
#ifdef ROUTEINFO
|
#ifdef ROUTEINFO
|
||||||
TAILQ_INIT(&rai->rai_route);
|
TAILQ_INIT(&rai->rai_route);
|
||||||
@ -394,10 +388,7 @@ getconfig(int idx)
|
|||||||
|
|
||||||
/* allocate memory to store prefix information */
|
/* allocate memory to store prefix information */
|
||||||
ELM_MALLOC(pfx, exit(1));
|
ELM_MALLOC(pfx, exit(1));
|
||||||
|
pfx->pfx_rainfo = rai;
|
||||||
/* link into chain */
|
|
||||||
TAILQ_INSERT_TAIL(&rai->rai_prefix, pfx, pfx_next);
|
|
||||||
rai->rai_pfxs++;
|
|
||||||
pfx->pfx_origin = PREFIX_FROM_CONFIG;
|
pfx->pfx_origin = PREFIX_FROM_CONFIG;
|
||||||
|
|
||||||
if (inet_pton(AF_INET6, addr, &pfx->pfx_prefix) != 1) {
|
if (inet_pton(AF_INET6, addr, &pfx->pfx_prefix) != 1) {
|
||||||
@ -481,6 +472,9 @@ getconfig(int idx)
|
|||||||
pfx->pfx_pltimeexpire =
|
pfx->pfx_pltimeexpire =
|
||||||
now.tv_sec + pfx->pfx_preflifetime;
|
now.tv_sec + pfx->pfx_preflifetime;
|
||||||
}
|
}
|
||||||
|
/* link into chain */
|
||||||
|
TAILQ_INSERT_TAIL(&rai->rai_prefix, pfx, pfx_next);
|
||||||
|
rai->rai_pfxs++;
|
||||||
}
|
}
|
||||||
if (rai->rai_advifprefix && rai->rai_pfxs == 0)
|
if (rai->rai_advifprefix && rai->rai_pfxs == 0)
|
||||||
get_prefix(rai);
|
get_prefix(rai);
|
||||||
|
Loading…
Reference in New Issue
Block a user