diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-03-21 15:01:11 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2018-03-21 15:01:11 +0000 |
commit | 899651b3c56e595ec2bb1adbd5e619d1d97dc076 (patch) | |
tree | d546844f0bec5955aa4893d6dce9857b49ab8326 /sys/netinet | |
parent | 9f3cc8e4c25574baf0c560c134674dcc917bddb5 (diff) |
The function carp_prepare_ad() never fails. The error handling in
the caller would leak a mbuf. Convert carp_prepare_ad() to a void
function and remove the error check.
reported by Maxime Villard; OK mpi@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ip_carp.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 38e0ff74a7a..71661626a72 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.330 2018/02/19 08:59:53 mpi Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.331 2018/03/21 15:01:10 bluhm Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -217,7 +217,7 @@ int carp6_proto_input_if(struct ifnet *, struct mbuf **, int *, int); #endif void carpattach(int); void carpdetach(void *); -int carp_prepare_ad(struct mbuf *, struct carp_vhost_entry *, +void carp_prepare_ad(struct mbuf *, struct carp_vhost_entry *, struct carp_header *); void carp_send_ad_all(void); void carp_vhe_send_ad_all(struct carp_softc *); @@ -972,7 +972,7 @@ carp_destroy_vhosts(struct carp_softc *sc) sc->sc_vhe_count = 0; } -int +void carp_prepare_ad(struct mbuf *m, struct carp_vhost_entry *vhe, struct carp_header *ch) { @@ -989,8 +989,6 @@ carp_prepare_ad(struct mbuf *m, struct carp_vhost_entry *vhe, * in the HMAC. */ carp_hmac_generate(vhe, ch->carp_counter, ch->carp_md, HMAC_NOV6LL); - - return (0); } void @@ -1127,8 +1125,7 @@ carp_send_ad(struct carp_vhost_entry *vhe) ch_ptr = (struct carp_header *)(ip + 1); bcopy(&ch, ch_ptr, sizeof(ch)); - if (carp_prepare_ad(m, vhe, ch_ptr)) - goto retry_later; + carp_prepare_ad(m, vhe, ch_ptr); m->m_data += sizeof(*ip); ch_ptr->carp_cksum = carp_cksum(m, len - sizeof(*ip)); @@ -1217,8 +1214,7 @@ carp_send_ad(struct carp_vhost_entry *vhe) ch_ptr = (struct carp_header *)(ip6 + 1); bcopy(&ch, ch_ptr, sizeof(ch)); - if (carp_prepare_ad(m, vhe, ch_ptr)) - goto retry_later; + carp_prepare_ad(m, vhe, ch_ptr); m->m_data += sizeof(*ip6); ch_ptr->carp_cksum = carp_cksum(m, len - sizeof(*ip6)); |