Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netatalk make at_pcbconnect() take sockaddr_at * instead...
details: https://anonhg.NetBSD.org/src/rev/b9841f4a5ced
branches: trunk
changeset: 337719:b9841f4a5ced
user: rtr <rtr%NetBSD.org@localhost>
date: Fri Apr 24 23:36:48 2015 +0000
description:
make at_pcbconnect() take sockaddr_at * instead of mbuf *.
move m_len check into callers which results in small duplication of
code that will go away when the callers are converted to receive
sockaddr * instead of mbuf *.
diffstat:
sys/netatalk/ddp_usrreq.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diffs (69 lines):
diff -r 45fdad8f9945 -r b9841f4a5ced sys/netatalk/ddp_usrreq.c
--- a/sys/netatalk/ddp_usrreq.c Fri Apr 24 22:32:37 2015 +0000
+++ b/sys/netatalk/ddp_usrreq.c Fri Apr 24 23:36:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ddp_usrreq.c,v 1.65 2015/04/24 22:32:37 rtr Exp $ */
+/* $NetBSD: ddp_usrreq.c,v 1.66 2015/04/24 23:36:48 rtr Exp $ */
/*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.65 2015/04/24 22:32:37 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.66 2015/04/24 23:36:48 rtr Exp $");
#include "opt_mbuftrace.h"
@@ -59,7 +59,7 @@
static void at_pcbdisconnect(struct ddpcb *);
static void at_sockaddr(struct ddpcb *, struct sockaddr_at *);
static int at_pcbsetaddr(struct ddpcb *, struct sockaddr_at *);
-static int at_pcbconnect(struct ddpcb *, struct mbuf *);
+static int at_pcbconnect(struct ddpcb *, struct sockaddr_at *);
static void ddp_detach(struct socket *);
struct ifqueue atintrq1, atintrq2;
@@ -231,18 +231,15 @@
}
static int
-at_pcbconnect(struct ddpcb *ddp, struct mbuf *addr)
+at_pcbconnect(struct ddpcb *ddp, struct sockaddr_at *sat)
{
struct rtentry *rt;
const struct sockaddr_at *cdst;
- struct sockaddr_at *sat = mtod(addr, struct sockaddr_at *);
struct route *ro;
struct at_ifaddr *aa;
struct ifnet *ifp;
u_short hintnet = 0, net;
- if (addr->m_len != sizeof(*sat))
- return EINVAL;
if (sat->sat_family != AF_APPLETALK) {
return EAFNOSUPPORT;
}
@@ -435,7 +432,9 @@
if (ddp->ddp_fsat.sat_port != ATADDR_ANYPORT)
return EISCONN;
- error = at_pcbconnect(ddp, nam);
+ if (nam->m_len != sizeof(struct sockaddr_at))
+ return EINVAL;
+ error = at_pcbconnect(ddp, mtod(nam, struct sockaddr_at *));
if (error == 0)
soisconnected(so);
@@ -550,7 +549,9 @@
if (ddp->ddp_fsat.sat_port != ATADDR_ANYPORT)
return EISCONN;
s = splnet();
- error = at_pcbconnect(ddp, nam);
+ if (nam->m_len != sizeof(struct sockaddr_at))
+ return EINVAL;
+ error = at_pcbconnect(ddp, mtod(nam, struct sockaddr_at *));
if (error) {
splx(s);
return error;
Home |
Main Index |
Thread Index |
Old Index