summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/ospfe.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2011-03-08 10:56:03 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2011-03-08 10:56:03 +0000
commit76139d01bb79d8e9b0e933d2c4ab423536bf13b6 (patch)
treeb542f4165b383b6af04abdd772f01d04d48976fa /usr.sbin/ospfd/ospfe.c
parentdc04aa385c7e2cc16f26fe1495c1a3ea54adf719 (diff)
Instead of using IBUF_READ_SIZE as upper bound when building various
packets use a better upper bound based on IP_MAXPACKET. Also change one IBUF_READ_SIZE to READ_BUF_SIZE since that is what the rest of the code uses. Tested and OK sthen@
Diffstat (limited to 'usr.sbin/ospfd/ospfe.c')
-rw-r--r--usr.sbin/ospfd/ospfe.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/ospfd/ospfe.c b/usr.sbin/ospfd/ospfe.c
index 200d8a65c3b..01917c10ede 100644
--- a/usr.sbin/ospfd/ospfe.c
+++ b/usr.sbin/ospfd/ospfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.c,v 1.77 2010/10/01 13:29:25 claudio Exp $ */
+/* $OpenBSD: ospfe.c,v 1.78 2011/03/08 10:56:02 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -183,7 +183,7 @@ ospfe(struct ospfd_conf *xconf, int pipe_parent2ospfe[2], int pipe_ospfe2rde[2],
TAILQ_INIT(&ctl_conns);
control_listen();
- if ((pkt_ptr = calloc(1, IBUF_READ_SIZE)) == NULL)
+ if ((pkt_ptr = calloc(1, READ_BUF_SIZE)) == NULL)
fatal("ospfe");
/* start interfaces */
@@ -756,8 +756,9 @@ orig_rtr_lsa(struct area *area)
log_debug("orig_rtr_lsa: area %s", inet_ntoa(area->id));
- /* XXX IBUF_READ_SIZE */
- if ((buf = ibuf_dynamic(sizeof(lsa_hdr), READ_BUF_SIZE)) == NULL)
+ if ((buf = ibuf_dynamic(sizeof(lsa_hdr),
+ IP_MAXPACKET - sizeof(struct ip) - sizeof(struct ospf_hdr) -
+ sizeof(u_int32_t) - MD5_DIGEST_LENGTH)) == NULL)
fatal("orig_rtr_lsa");
/* reserve space for LSA header and LSA Router header */
@@ -1024,8 +1025,9 @@ orig_net_lsa(struct iface *iface)
int num_rtr = 0;
u_int16_t chksum;
- /* XXX IBUF_READ_SIZE */
- if ((buf = ibuf_dynamic(sizeof(lsa_hdr), IBUF_READ_SIZE)) == NULL)
+ if ((buf = ibuf_dynamic(sizeof(lsa_hdr),
+ IP_MAXPACKET - sizeof(struct ip) - sizeof(struct ospf_hdr) -
+ sizeof(u_int32_t) - MD5_DIGEST_LENGTH)) == NULL)
fatal("orig_net_lsa");
/* reserve space for LSA header and LSA Router header */