diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-03-23 17:22:29 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-03-23 17:22:29 +0000 |
commit | 4f03927558ca38bd26ac3cc0008e4c12cc73662e (patch) | |
tree | c351971373cfb91a472c3aef3831ea4568a0b703 /sys/netinet/raw_ip.c | |
parent | b3b9f983f646d05e6483bd8c815c0c9e0f21ccf8 (diff) |
Move global variable ripsrc onto stack, it is only used once within
rip_input().
from dhill@
Diffstat (limited to 'sys/netinet/raw_ip.c')
-rw-r--r-- | sys/netinet/raw_ip.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 8b874267217..bb43a7e992a 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip.c,v 1.126 2022/03/22 18:17:30 bluhm Exp $ */ +/* $OpenBSD: raw_ip.c,v 1.127 2022/03/23 17:22:28 bluhm Exp $ */ /* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */ /* @@ -109,12 +109,9 @@ struct inpcbtable rawcbtable; void rip_init(void) { - in_pcbinit(&rawcbtable, 1); } -struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; - struct mbuf *rip_chkhdr(struct mbuf *, struct mbuf *); int @@ -127,10 +124,15 @@ rip_input(struct mbuf **mp, int *offp, int proto, int af) struct in_addr *key; struct counters_ref ref; uint64_t *counters; + struct sockaddr_in ripsrc; KASSERT(af == AF_INET); + memset(&ripsrc, 0, sizeof(ripsrc)); + ripsrc.sin_family = AF_INET; + ripsrc.sin_len = sizeof(ripsrc); ripsrc.sin_addr = ip->ip_src; + key = &ip->ip_dst; #if NPF > 0 if (m->m_pkthdr.pf.flags & PF_TAG_DIVERTED) { |