summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_mroute.c31
-rw-r--r--sys/netinet/ip_mroute.h6
-rw-r--r--sys/netinet/ip_output.c31
-rw-r--r--sys/netinet/ip_var.h8
-rw-r--r--sys/netinet/raw_ip.c36
-rw-r--r--sys/netinet/tcp_usrreq.c13
-rw-r--r--sys/netinet/tcp_var.h4
7 files changed, 55 insertions, 74 deletions
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index b282ec2eeeb..5a6a9dc5b78 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_mroute.c,v 1.107 2017/01/12 08:22:42 rzalamena Exp $ */
+/* $OpenBSD: ip_mroute.c,v 1.108 2017/02/01 20:59:47 dhill Exp $ */
/* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */
/*
@@ -173,7 +173,7 @@ mfc_find(struct ifnet *ifp, struct in_addr *origin, struct in_addr *group,
* Handle MRT setsockopt commands to modify the multicast routing tables.
*/
int
-ip_mrouter_set(struct socket *so, int optname, struct mbuf **mp)
+ip_mrouter_set(struct socket *so, int optname, struct mbuf *m)
{
struct inpcb *inp = sotoinpcb(so);
int error;
@@ -184,32 +184,32 @@ ip_mrouter_set(struct socket *so, int optname, struct mbuf **mp)
else
switch (optname) {
case MRT_INIT:
- error = ip_mrouter_init(so, *mp);
+ error = ip_mrouter_init(so, m);
break;
case MRT_DONE:
error = ip_mrouter_done(so);
break;
case MRT_ADD_VIF:
- error = add_vif(so, *mp);
+ error = add_vif(so, m);
break;
case MRT_DEL_VIF:
- error = del_vif(so, *mp);
+ error = del_vif(so, m);
break;
case MRT_ADD_MFC:
- error = add_mfc(so, *mp);
+ error = add_mfc(so, m);
break;
case MRT_DEL_MFC:
- error = del_mfc(so, *mp);
+ error = del_mfc(so, m);
break;
case MRT_API_CONFIG:
- error = set_api_config(so, *mp);
+ error = set_api_config(so, m);
break;
default:
error = ENOPROTOOPT;
break;
}
- m_free(*mp);
+ m_free(m);
return (error);
}
@@ -217,7 +217,7 @@ ip_mrouter_set(struct socket *so, int optname, struct mbuf **mp)
* Handle MRT getsockopt commands
*/
int
-ip_mrouter_get(struct socket *so, int optname, struct mbuf **mp)
+ip_mrouter_get(struct socket *so, int optname, struct mbuf *m)
{
struct inpcb *inp = sotoinpcb(so);
int error;
@@ -225,25 +225,20 @@ ip_mrouter_get(struct socket *so, int optname, struct mbuf **mp)
if (so != ip_mrouter[inp->inp_rtableid])
error = ENOPROTOOPT;
else {
- *mp = m_get(M_WAIT, MT_SOOPTS);
-
switch (optname) {
case MRT_VERSION:
- error = get_version(*mp);
+ error = get_version(m);
break;
case MRT_API_SUPPORT:
- error = get_api_support(*mp);
+ error = get_api_support(m);
break;
case MRT_API_CONFIG:
- error = get_api_config(*mp);
+ error = get_api_config(m);
break;
default:
error = ENOPROTOOPT;
break;
}
-
- if (error)
- m_free(*mp);
}
return (error);
diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h
index 24f8f6f8aeb..ce4506b6b26 100644
--- a/sys/netinet/ip_mroute.h
+++ b/sys/netinet/ip_mroute.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_mroute.h,v 1.27 2017/01/12 08:22:42 rzalamena Exp $ */
+/* $OpenBSD: ip_mroute.h,v 1.28 2017/02/01 20:59:47 dhill Exp $ */
/* $NetBSD: ip_mroute.h,v 1.23 2004/04/21 17:49:46 itojun Exp $ */
#ifndef _NETINET_IP_MROUTE_H_
@@ -223,8 +223,8 @@ struct igmpmsg {
struct in_addr im_src, im_dst;
};
-int ip_mrouter_set(struct socket *, int, struct mbuf **);
-int ip_mrouter_get(struct socket *, int, struct mbuf **);
+int ip_mrouter_set(struct socket *, int, struct mbuf *);
+int ip_mrouter_get(struct socket *, int, struct mbuf *);
int mrt_ioctl(struct socket *, u_long, caddr_t);
int mrt_sysctl_vif(void *, size_t *);
int mrt_sysctl_mfc(void *, size_t *);
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index c1cf4f68cfe..7f276bbf470 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.334 2017/01/10 09:01:18 mpi Exp $ */
+/* $OpenBSD: ip_output.c,v 1.335 2017/02/01 20:59:47 dhill Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -845,10 +845,9 @@ ip_optcopy(struct ip *ip, struct ip *jp)
*/
int
ip_ctloutput(int op, struct socket *so, int level, int optname,
- struct mbuf **mp)
+ struct mbuf *m)
{
struct inpcb *inp = sotoinpcb(so);
- struct mbuf *m = *mp;
int optval = 0;
struct proc *p = curproc; /* XXX */
int error = 0;
@@ -857,7 +856,7 @@ ip_ctloutput(int op, struct socket *so, int level, int optname,
if (level != IPPROTO_IP) {
error = EINVAL;
if (op == PRCO_SETOPT)
- (void) m_free(*mp);
+ (void) m_free(m);
} else switch (op) {
case PRCO_SETOPT:
switch (optname) {
@@ -1081,7 +1080,6 @@ ip_ctloutput(int op, struct socket *so, int level, int optname,
switch (optname) {
case IP_OPTIONS:
case IP_RETOPTS:
- *mp = m = m_get(M_WAIT, MT_SOOPTS);
if (inp->inp_options) {
m->m_len = inp->inp_options->m_len;
memcpy(mtod(m, caddr_t),
@@ -1102,7 +1100,6 @@ ip_ctloutput(int op, struct socket *so, int level, int optname,
case IP_RECVRTABLE:
case IP_IPSECFLOWINFO:
case IP_IPDEFTTL:
- *mp = m = m_get(M_WAIT, MT_SOOPTS);
m->m_len = sizeof(int);
switch (optname) {
@@ -1159,11 +1156,10 @@ ip_ctloutput(int op, struct socket *so, int level, int optname,
case IP_MULTICAST_LOOP:
case IP_ADD_MEMBERSHIP:
case IP_DROP_MEMBERSHIP:
- error = ip_getmoptions(optname, inp->inp_moptions, mp);
+ error = ip_getmoptions(optname, inp->inp_moptions, m);
break;
case IP_PORTRANGE:
- *mp = m = m_get(M_WAIT, MT_SOOPTS);
m->m_len = sizeof(int);
if (inp->inp_flags & INP_HIGHPORT)
@@ -1180,7 +1176,6 @@ ip_ctloutput(int op, struct socket *so, int level, int optname,
case IP_ESP_TRANS_LEVEL:
case IP_ESP_NETWORK_LEVEL:
case IP_IPCOMP_LEVEL:
- *mp = m = m_get(M_WAIT, MT_SOOPTS);
#ifndef IPSEC
m->m_len = sizeof(int);
*mtod(m, int *) = IPSEC_LEVEL_NONE;
@@ -1210,12 +1205,10 @@ ip_ctloutput(int op, struct socket *so, int level, int optname,
error = EOPNOTSUPP;
break;
case SO_RTABLE:
- *mp = m = m_get(M_WAIT, MT_SOOPTS);
m->m_len = sizeof(u_int);
*mtod(m, u_int *) = inp->inp_rtableid;
break;
case IP_PIPEX:
- *mp = m = m_get(M_WAIT, MT_SOOPTS);
m->m_len = sizeof(int);
*mtod(m, int *) = inp->inp_pipex;
break;
@@ -1624,7 +1617,7 @@ ip_setmoptions(int optname, struct ip_moptions **imop, struct mbuf *m,
* Return the IP multicast options in response to user getsockopt().
*/
int
-ip_getmoptions(int optname, struct ip_moptions *imo, struct mbuf **mp)
+ip_getmoptions(int optname, struct ip_moptions *imo, struct mbuf *m)
{
u_char *ttl;
u_char *loop;
@@ -1632,13 +1625,11 @@ ip_getmoptions(int optname, struct ip_moptions *imo, struct mbuf **mp)
struct in_ifaddr *ia;
struct ifnet *ifp;
- *mp = m_get(M_WAIT, MT_SOOPTS);
-
switch (optname) {
case IP_MULTICAST_IF:
- addr = mtod(*mp, struct in_addr *);
- (*mp)->m_len = sizeof(struct in_addr);
+ addr = mtod(m, struct in_addr *);
+ m->m_len = sizeof(struct in_addr);
if (imo == NULL || (ifp = if_get(imo->imo_ifidx)) == NULL)
addr->s_addr = INADDR_ANY;
else {
@@ -1650,15 +1641,15 @@ ip_getmoptions(int optname, struct ip_moptions *imo, struct mbuf **mp)
return (0);
case IP_MULTICAST_TTL:
- ttl = mtod(*mp, u_char *);
- (*mp)->m_len = 1;
+ ttl = mtod(m, u_char *);
+ m->m_len = 1;
*ttl = (imo == NULL) ? IP_DEFAULT_MULTICAST_TTL
: imo->imo_ttl;
return (0);
case IP_MULTICAST_LOOP:
- loop = mtod(*mp, u_char *);
- (*mp)->m_len = 1;
+ loop = mtod(m, u_char *);
+ m->m_len = 1;
*loop = (imo == NULL) ? IP_DEFAULT_MULTICAST_LOOP
: imo->imo_loop;
return (0);
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h
index f1fd4e20754..285d64d9402 100644
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_var.h,v 1.67 2017/01/29 19:58:47 bluhm Exp $ */
+/* $OpenBSD: ip_var.h,v 1.68 2017/02/01 20:59:47 dhill Exp $ */
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
/*
@@ -219,13 +219,13 @@ extern struct pool ipqent_pool;
struct route;
struct inpcb;
-int ip_ctloutput(int, struct socket *, int, int, struct mbuf **);
+int ip_ctloutput(int, struct socket *, int, int, struct mbuf *);
void ip_drain(void);
void ip_flush(void);
int ip_fragment(struct mbuf *, struct ifnet *, u_long);
void ip_freef(struct ipq *);
void ip_freemoptions(struct ip_moptions *);
-int ip_getmoptions(int, struct ip_moptions *, struct mbuf **);
+int ip_getmoptions(int, struct ip_moptions *, struct mbuf *);
void ip_init(void);
struct mbuf*
ip_insertoptions(struct mbuf *, struct mbuf *, int *);
@@ -250,7 +250,7 @@ void ip_savecontrol(struct inpcb *, struct mbuf **, struct ip *,
void ipintr(void);
void ipv4_input(struct mbuf *);
void ip_forward(struct mbuf *, struct ifnet *, struct rtentry *, int);
-int rip_ctloutput(int, struct socket *, int, int, struct mbuf **);
+int rip_ctloutput(int, struct socket *, int, int, struct mbuf *);
void rip_init(void);
int rip_input(struct mbuf **, int *, int);
int rip_output(struct mbuf *, ...);
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index a9d55bfc7ea..b3d0d7acd9e 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.94 2017/01/29 19:58:47 bluhm Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.95 2017/02/01 20:59:47 dhill Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -299,7 +299,7 @@ rip_output(struct mbuf *m, ...)
*/
int
rip_ctloutput(int op, struct socket *so, int level, int optname,
- struct mbuf **mp)
+ struct mbuf *m)
{
struct inpcb *inp = sotoinpcb(so);
int error = 0;
@@ -307,7 +307,7 @@ rip_ctloutput(int op, struct socket *so, int level, int optname,
if (level != IPPROTO_IP) {
if (op == PRCO_SETOPT)
- (void) m_free(*mp);
+ (void) m_free(m);
return (EINVAL);
}
@@ -316,28 +316,27 @@ rip_ctloutput(int op, struct socket *so, int level, int optname,
case IP_HDRINCL:
error = 0;
if (op == PRCO_SETOPT) {
- if (*mp == NULL || (*mp)->m_len < sizeof (int))
+ if (m == NULL || m->m_len < sizeof (int))
error = EINVAL;
- else if (*mtod(*mp, int *))
+ else if (*mtod(m, int *))
inp->inp_flags |= INP_HDRINCL;
else
inp->inp_flags &= ~INP_HDRINCL;
- m_free(*mp);
+ m_free(m);
} else {
- *mp = m_get(M_WAIT, M_SOOPTS);
- (*mp)->m_len = sizeof(int);
- *mtod(*mp, int *) = inp->inp_flags & INP_HDRINCL;
+ m->m_len = sizeof(int);
+ *mtod(m, int *) = inp->inp_flags & INP_HDRINCL;
}
return (error);
case IP_DIVERTFL:
switch (op) {
case PRCO_SETOPT:
- if (*mp == NULL || (*mp)->m_len < sizeof (int)) {
+ if (m == NULL || m->m_len < sizeof (int)) {
error = EINVAL;
break;
}
- dir = *mtod(*mp, int *);
+ dir = *mtod(m, int *);
if (inp->inp_divertfl > 0)
error = ENOTSUP;
else if ((dir & IPPROTO_DIVERT_RESP) ||
@@ -349,9 +348,8 @@ rip_ctloutput(int op, struct socket *so, int level, int optname,
break;
case PRCO_GETOPT:
- *mp = m_get(M_WAIT, M_SOOPTS);
- (*mp)->m_len = sizeof(int);
- *mtod(*mp, int *) = inp->inp_divertfl;
+ m->m_len = sizeof(int);
+ *mtod(m, int *) = inp->inp_divertfl;
break;
default:
@@ -360,7 +358,7 @@ rip_ctloutput(int op, struct socket *so, int level, int optname,
}
if (op == PRCO_SETOPT)
- (void)m_free(*mp);
+ (void)m_free(m);
return (error);
case MRT_INIT:
@@ -376,10 +374,10 @@ rip_ctloutput(int op, struct socket *so, int level, int optname,
#ifdef MROUTING
switch (op) {
case PRCO_SETOPT:
- error = ip_mrouter_set(so, optname, mp);
+ error = ip_mrouter_set(so, optname, m);
break;
case PRCO_GETOPT:
- error = ip_mrouter_get(so, optname, mp);
+ error = ip_mrouter_get(so, optname, m);
break;
default:
error = EINVAL;
@@ -388,11 +386,11 @@ rip_ctloutput(int op, struct socket *so, int level, int optname,
return (error);
#else
if (op == PRCO_SETOPT)
- m_free(*mp);
+ m_free(m);
return (EOPNOTSUPP);
#endif
}
- return (ip_ctloutput(op, so, level, optname, mp));
+ return (ip_ctloutput(op, so, level, optname, m));
}
u_long rip_sendspace = RIPSNDQ;
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index fca2b4ad67f..9a6d1376d4c 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.142 2017/01/10 09:01:18 mpi Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.143 2017/02/01 20:59:47 dhill Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -449,29 +449,28 @@ tcp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
int
tcp_ctloutput(int op, struct socket *so, int level, int optname,
- struct mbuf **mp)
+ struct mbuf *m)
{
int error = 0;
struct inpcb *inp;
struct tcpcb *tp;
- struct mbuf *m;
int i;
inp = sotoinpcb(so);
if (inp == NULL) {
if (op == PRCO_SETOPT)
- (void) m_free(*mp);
+ (void) m_free(m);
return (ECONNRESET);
}
if (level != IPPROTO_TCP) {
switch (so->so_proto->pr_domain->dom_family) {
#ifdef INET6
case PF_INET6:
- error = ip6_ctloutput(op, so, level, optname, mp);
+ error = ip6_ctloutput(op, so, level, optname, m);
break;
#endif /* INET6 */
case PF_INET:
- error = ip_ctloutput(op, so, level, optname, mp);
+ error = ip_ctloutput(op, so, level, optname, m);
break;
default:
error = EAFNOSUPPORT; /*?*/
@@ -484,7 +483,6 @@ tcp_ctloutput(int op, struct socket *so, int level, int optname,
switch (op) {
case PRCO_SETOPT:
- m = *mp;
switch (optname) {
case TCP_NODELAY:
@@ -573,7 +571,6 @@ tcp_ctloutput(int op, struct socket *so, int level, int optname,
break;
case PRCO_GETOPT:
- *mp = m = m_get(M_WAIT, MT_SOOPTS);
m->m_len = sizeof(int);
switch (optname) {
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index fdf468af7d5..e04a16f7b31 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.120 2017/01/29 19:58:47 bluhm Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.121 2017/02/01 20:59:47 dhill Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -602,7 +602,7 @@ int tcp_freeq(struct tcpcb *);
void tcp6_ctlinput(int, struct sockaddr *, u_int, void *);
#endif
void tcp_ctlinput(int, struct sockaddr *, u_int, void *);
-int tcp_ctloutput(int, struct socket *, int, int, struct mbuf **);
+int tcp_ctloutput(int, struct socket *, int, int, struct mbuf *);
struct tcpcb *
tcp_disconnect(struct tcpcb *);
struct tcpcb *