mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 13:01:59 +00:00
Handle hostname/domainname properly for FreeBSD
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
This commit is contained in:
parent
1f53ef552d
commit
0802e118dd
10
bgpd/bgpd.c
10
bgpd/bgpd.c
@ -2766,15 +2766,17 @@ static struct bgp *bgp_create(as_t *as, const char *name,
|
||||
XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->hostname);
|
||||
bgp->peer_self->hostname = NULL;
|
||||
}
|
||||
bgp->peer_self->hostname = XSTRDUP(MTYPE_BGP_PEER_HOST,
|
||||
hostname_get());
|
||||
if (hostname_get())
|
||||
bgp->peer_self->hostname = XSTRDUP(MTYPE_BGP_PEER_HOST,
|
||||
hostname_get());
|
||||
|
||||
if (bgp->peer_self->domainname != NULL) {
|
||||
XFREE(MTYPE_BGP_PEER_HOST, bgp->peer_self->domainname);
|
||||
bgp->peer_self->domainname = NULL;
|
||||
}
|
||||
bgp->peer_self->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST,
|
||||
domainname_get());
|
||||
if (domainname_get())
|
||||
bgp->peer_self->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST,
|
||||
domainname_get());
|
||||
bgp->peer = list_new();
|
||||
bgp->peer->cmp = (int (*)(void *, void *))peer_cmp;
|
||||
bgp->peerhash = hash_create(peer_hash_key_make, peer_hash_same, NULL);
|
||||
|
@ -130,12 +130,6 @@ struct host host;
|
||||
*/
|
||||
const char *hostname_get(void)
|
||||
{
|
||||
struct utsname names;
|
||||
|
||||
if (!host.name) {
|
||||
uname(&names);
|
||||
host.name = XSTRDUP(MTYPE_HOST, names.nodename);
|
||||
}
|
||||
return host.name;
|
||||
}
|
||||
|
||||
@ -144,14 +138,6 @@ const char *hostname_get(void)
|
||||
*/
|
||||
const char *domainname_get(void)
|
||||
{
|
||||
struct utsname names;
|
||||
|
||||
if (!host.name || !host.domainname) {
|
||||
#ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
|
||||
uname(&names);
|
||||
host.domainname = XSTRDUP(MTYPE_HOST, names.domainname);
|
||||
#endif
|
||||
}
|
||||
return host.domainname;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user