summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2021-01-19 09:43:40 +0000
committerclaudio <claudio@openbsd.org>2021-01-19 09:43:40 +0000
commitef2d0f969675ef739d96b96ccf1410c0b26a79ea (patch)
treef546630008adf4eba23d55a57c4cf70e7cd1ad5d
parentDo the same control cleanup as in ospfd. Move control_state and ctl_conns (diff)
downloadwireguard-openbsd-ef2d0f969675ef739d96b96ccf1410c0b26a79ea.tar.xz
wireguard-openbsd-ef2d0f969675ef739d96b96ccf1410c0b26a79ea.zip
Like in ospfd use a static pkt_ptr buffer.
-rw-r--r--usr.sbin/ospf6d/ospfe.c6
-rw-r--r--usr.sbin/ospf6d/ospfe.h4
-rw-r--r--usr.sbin/ospf6d/packet.c3
3 files changed, 4 insertions, 9 deletions
diff --git a/usr.sbin/ospf6d/ospfe.c b/usr.sbin/ospf6d/ospfe.c
index 69f91d026fe..7fd8675cb6f 100644
--- a/usr.sbin/ospf6d/ospfe.c
+++ b/usr.sbin/ospf6d/ospfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.c,v 1.64 2021/01/19 09:42:11 claudio Exp $ */
+/* $OpenBSD: ospfe.c,v 1.65 2021/01/19 09:43:40 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -174,9 +174,6 @@ ospfe(struct ospfd_conf *xconf, int pipe_parent2ospfe[2], int pipe_ospfe2rde[2],
/* remove unneeded config stuff */
conf_clear_redist_list(&oeconf->redist_list);
- if ((pkt_ptr = calloc(1, READ_BUF_SIZE)) == NULL)
- fatal("ospfe");
-
/* start interfaces */
LIST_FOREACH(area, &oeconf->area_list, entry) {
ospfe_demote_area(area, 0);
@@ -223,7 +220,6 @@ ospfe_shutdown(void)
free(iev_rde);
free(iev_main);
free(oeconf);
- free(pkt_ptr);
log_info("ospf engine exiting");
_exit(0);
diff --git a/usr.sbin/ospf6d/ospfe.h b/usr.sbin/ospf6d/ospfe.h
index ec46bdc3ffc..7fec5f8df85 100644
--- a/usr.sbin/ospf6d/ospfe.h
+++ b/usr.sbin/ospf6d/ospfe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.h,v 1.24 2021/01/19 09:42:11 claudio Exp $ */
+/* $OpenBSD: ospfe.h,v 1.25 2021/01/19 09:43:40 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -231,6 +231,4 @@ int upd_ospf_hdr(struct ibuf *, struct iface *);
int send_packet(struct iface *, struct ibuf *, struct in6_addr *);
void recv_packet(int, short, void *);
-char *pkt_ptr; /* packet buffer */
-
#endif /* _OSPFE_H_ */
diff --git a/usr.sbin/ospf6d/packet.c b/usr.sbin/ospf6d/packet.c
index 6d36534cc19..efbf891df1d 100644
--- a/usr.sbin/ospf6d/packet.c
+++ b/usr.sbin/ospf6d/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.18 2021/01/12 09:54:44 claudio Exp $ */
+/* $OpenBSD: packet.c,v 1.19 2021/01/19 09:43:40 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -114,6 +114,7 @@ send_packet(struct iface *iface, struct ibuf *buf,
void
recv_packet(int fd, short event, void *bula)
{
+ static char pkt_ptr[READ_BUF_SIZE];
union {
struct cmsghdr hdr;
char buf[CMSG_SPACE(sizeof(struct in6_pktinfo))];