summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_icmp.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2018-05-21 15:52:23 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2018-05-21 15:52:23 +0000
commitfd2efbb43bbf7605aaab6ed706f20ee85b72be38 (patch)
tree6265a79e358b97c76678c904ee22605554b642dc /sys/netinet/ip_icmp.c
parent8a6684e984808fcaa2f734eb4f48d9304a3f6094 (diff)
All places that call carp_lsdrop() use the interface pointer already.
It does not make sense to call if_get() again, just pass ifp as parameter. Move the IFT_CARP check into the function instead of doing it everywhere. Replace the inverted match variable logic with simple returns. OK mpi@ friehm@
Diffstat (limited to 'sys/netinet/ip_icmp.c')
-rw-r--r--sys/netinet/ip_icmp.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index b71e8738da2..0527c54b3a7 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.174 2017/12/14 14:26:50 bluhm Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.175 2018/05/21 15:52:22 bluhm Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -497,8 +497,7 @@ icmp_input_if(struct ifnet *ifp, struct mbuf **mp, int *offp, int proto, int af)
sin.sin_len = sizeof(struct sockaddr_in);
sin.sin_addr = icp->icmp_ip.ip_dst;
#if NCARP > 0
- if (ifp->if_type == IFT_CARP &&
- carp_lsdrop(m, AF_INET, &sin.sin_addr.s_addr,
+ if (carp_lsdrop(ifp, m, AF_INET, &sin.sin_addr.s_addr,
&ip->ip_dst.s_addr, 1))
goto freeit;
#endif
@@ -581,8 +580,7 @@ icmp_input_if(struct ifnet *ifp, struct mbuf **mp, int *offp, int proto, int af)
}
reflect:
#if NCARP > 0
- if (ifp->if_type == IFT_CARP &&
- carp_lsdrop(m, AF_INET, &ip->ip_src.s_addr,
+ if (carp_lsdrop(ifp, m, AF_INET, &ip->ip_src.s_addr,
&ip->ip_dst.s_addr, 1))
goto freeit;
#endif
@@ -642,8 +640,7 @@ reflect:
#endif
#if NCARP > 0
- if (ifp->if_type == IFT_CARP &&
- carp_lsdrop(m, AF_INET, &sdst.sin_addr.s_addr,
+ if (carp_lsdrop(ifp, m, AF_INET, &sdst.sin_addr.s_addr,
&ip->ip_dst.s_addr, 1))
goto freeit;
#endif