diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-01-19 09:29:50 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-01-19 09:29:50 +0000 |
commit | 12c91260a633a7bf5bed4ceadb09f2dd6518a4ce (patch) | |
tree | 83bf2430f2637b360369633f3c336a668d14847b /usr.sbin | |
parent | f3b4ef4eb6467ed9096c9201525559fcecf12cc8 (diff) |
Use a static pkt_ptr buffer instead of allocating it dynamically.
Removes another -fno-common issue from the build.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ospfd/ospfe.c | 6 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospfe.h | 4 | ||||
-rw-r--r-- | usr.sbin/ospfd/packet.c | 3 |
3 files changed, 4 insertions, 9 deletions
diff --git a/usr.sbin/ospfd/ospfe.c b/usr.sbin/ospfd/ospfe.c index 9e04400142b..9fca2e0cc66 100644 --- a/usr.sbin/ospfd/ospfe.c +++ b/usr.sbin/ospfd/ospfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.c,v 1.107 2020/11/02 00:29:58 dlg Exp $ */ +/* $OpenBSD: ospfe.c,v 1.108 2021/01/19 09:29:49 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -185,9 +185,6 @@ ospfe(struct ospfd_conf *xconf, int pipe_parent2ospfe[2], int pipe_ospfe2rde[2], } } - 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); @@ -240,7 +237,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/ospfd/ospfe.h b/usr.sbin/ospfd/ospfe.h index 303735a837b..0e003ebb8d0 100644 --- a/usr.sbin/ospfd/ospfe.h +++ b/usr.sbin/ospfd/ospfe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.h,v 1.46 2014/10/25 03:23:49 lteo Exp $ */ +/* $OpenBSD: ospfe.h,v 1.47 2021/01/19 09:29:49 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -238,6 +238,4 @@ int gen_ospf_hdr(struct ibuf *, struct iface *, u_int8_t); int send_packet(struct iface *, struct ibuf *, struct sockaddr_in *); void recv_packet(int, short, void *); -char *pkt_ptr; /* packet buffer */ - #endif /* _OSPFE_H_ */ diff --git a/usr.sbin/ospfd/packet.c b/usr.sbin/ospfd/packet.c index 7f1e2de50bf..04233209da3 100644 --- a/usr.sbin/ospfd/packet.c +++ b/usr.sbin/ospfd/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.33 2019/08/12 20:32:39 remi Exp $ */ +/* $OpenBSD: packet.c,v 1.34 2021/01/19 09:29:49 claudio Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -107,6 +107,7 @@ send_packet(struct iface *iface, struct ibuf *buf, struct sockaddr_in *dst) 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 sockaddr_dl))]; |