mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 10:46:33 +08:00
RPC updates
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4446 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
+1
-1
@@ -71,7 +71,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int krpc_call(struct sockaddr_in *, unsigned int, unsigned int, unsigned int,
|
int krpc_call(struct sockaddr_in *, unsigned int, unsigned int, unsigned int,
|
||||||
struct mbuf **, struct mbuf **, int);
|
int);
|
||||||
int krpc_portmap(struct sockaddr_in *, unsigned int, unsigned int, uint16_t *);
|
int krpc_portmap(struct sockaddr_in *, unsigned int, unsigned int, uint16_t *);
|
||||||
|
|
||||||
struct mbuf *xdr_string_encode(char *, int);
|
struct mbuf *xdr_string_encode(char *, int);
|
||||||
|
|||||||
+5
-72
@@ -55,7 +55,7 @@
|
|||||||
* at least MINCLSIZE of data must be stored.
|
* at least MINCLSIZE of data must be stored.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MSIZE 256
|
#define MSIZE 128
|
||||||
#define MCLSHIFT 11 /* Convert bytes to m_buf clusters */
|
#define MCLSHIFT 11 /* Convert bytes to m_buf clusters */
|
||||||
/* 2K cluster can hold Ether frame */
|
/* 2K cluster can hold Ether frame */
|
||||||
#define MCLBYTES (1 << MCLSHIFT) /* Size of a m_buf cluster */
|
#define MCLBYTES (1 << MCLSHIFT) /* Size of a m_buf cluster */
|
||||||
@@ -73,15 +73,6 @@
|
|||||||
|
|
||||||
#define mtod(m,t) ((t)((m)->m_data))
|
#define mtod(m,t) ((t)((m)->m_data))
|
||||||
|
|
||||||
/* pkthdr_pf.flags */
|
|
||||||
|
|
||||||
#define PF_TAG_GENERATED 0x01
|
|
||||||
#define PF_TAG_TRANSLATE_LOCALHOST 0x04
|
|
||||||
#define PF_TAG_DIVERTED 0x08
|
|
||||||
#define PF_TAG_DIVERTED_PACKET 0x10
|
|
||||||
#define PF_TAG_REROUTE 0x20
|
|
||||||
#define PF_TAG_REFRAGMENTED 0x40 /* refragmented ipv6 packet */
|
|
||||||
|
|
||||||
/* mbuf flags */
|
/* mbuf flags */
|
||||||
|
|
||||||
#define M_EXT 0x0001 /* has associated external storage */
|
#define M_EXT 0x0001 /* has associated external storage */
|
||||||
@@ -296,39 +287,12 @@
|
|||||||
|
|
||||||
#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT)
|
#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT)
|
||||||
|
|
||||||
/* Packet tag types */
|
|
||||||
|
|
||||||
#define PACKET_TAG_IPSEC_IN_DONE 0x0001 /* IPsec applied, in */
|
|
||||||
#define PACKET_TAG_IPSEC_OUT_DONE 0x0002 /* IPsec applied, out */
|
|
||||||
#define PACKET_TAG_IPSEC_IN_CRYPTO_DONE 0x0004
|
|
||||||
/* NIC IPsec crypto done */
|
|
||||||
#define PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED 0x0008 /* NIC IPsec crypto
|
|
||||||
* req'ed */
|
|
||||||
#define PACKET_TAG_IPSEC_PENDING_TDB 0x0010 /* Reminder to do IPsec */
|
|
||||||
#define PACKET_TAG_BRIDGE 0x0020 /* Bridge processing done */
|
|
||||||
#define PACKET_TAG_GIF 0x0040
|
|
||||||
/* GIF processing done */
|
|
||||||
#define PACKET_TAG_GRE 0x0080
|
|
||||||
/* GRE processing done */
|
|
||||||
#define PACKET_TAG_DLT 0x0100
|
|
||||||
/* data link layer type */
|
|
||||||
#define PACKET_TAG_PF_DIVERT 0x0200 /* pf(4) diverted packet */
|
|
||||||
#define PACKET_TAG_PIPEX 0x0400 /* pipex context XXX */
|
|
||||||
#define PACKET_TAG_PF_REASSEMBLED 0x0800 /* pf reassembled ipv6 packet */
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Packet tags structure */
|
|
||||||
|
|
||||||
struct m_tag
|
|
||||||
{
|
|
||||||
SLIST_ENTRY(m_tag) m_tag_link; /* List of packet tags */
|
|
||||||
uint16_t m_tag_id; /* Tag ID */
|
|
||||||
uint16_t m_tag_len; /* Length of data */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Header at beginning of each mbuf: */
|
/* Header at beginning of each mbuf: */
|
||||||
|
|
||||||
struct m_hdr
|
struct m_hdr
|
||||||
@@ -341,56 +305,25 @@ struct m_hdr
|
|||||||
unsigned short mh_flags; /* Flags; see below */
|
unsigned short mh_flags; /* Flags; see below */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* pf stuff */
|
|
||||||
|
|
||||||
struct pkthdr_pf
|
|
||||||
{
|
|
||||||
void *hdr; /* saved hdr pos in mbuf, for ECN */
|
|
||||||
void *statekey; /* PF stackside statekey */
|
|
||||||
uint32_t qid; /* Queue id */
|
|
||||||
uint16_t tag; /* Tag id */
|
|
||||||
uint8_t flags;
|
|
||||||
uint8_t routed;
|
|
||||||
uint8_t prio;
|
|
||||||
uint8_t pad[3];
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Record/packet header in first mbuf of chain; valid if M_PKTHDR set */
|
/* Record/packet header in first mbuf of chain; valid if M_PKTHDR set */
|
||||||
|
|
||||||
struct pkthdr
|
struct pkthdr
|
||||||
{
|
{
|
||||||
struct ifnet *rcvif; /* rcv interface */
|
struct ifnet *rcvif; /* rcv interface */
|
||||||
SLIST_HEAD(packet_tags, m_tag) tags; /* List of packet tags */
|
|
||||||
int len; /* Total packet length */
|
int len; /* Total packet length */
|
||||||
uint16_t tagsset; /* mtags attached */
|
|
||||||
uint16_t pad;
|
|
||||||
uint16_t csum_flags; /* Checksum flags */
|
|
||||||
uint16_t ether_vtag; /* Ethernet 802.1p+Q vlan tag */
|
|
||||||
unsigned int rdomain; /* Routing domain id */
|
|
||||||
struct pkthdr_pf pf;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Description of external storage mapped into mbuf, valid if M_EXT set */
|
/* Description of external storage mapped into mbuf, valid if M_EXT set */
|
||||||
|
|
||||||
struct mbuf_ext
|
struct mbuf_ext
|
||||||
{
|
{
|
||||||
char *ext_buf; /* start of buffer */
|
caddr_t ext_buf; /* start of buffer */
|
||||||
/* free routine if not the usual */
|
/* free routine if not the usual */
|
||||||
// void (*ext_free)(char*, unsigned int, void *);
|
// void (*ext_free)();
|
||||||
// void *ext_arg; /* argument for ext_free */
|
// void *ext_arg; /* argument for ext_free */
|
||||||
// unsigned int ext_size; /* size of buffer, for ext_free */
|
// unsigned int ext_size; /* size of buffer, for ext_free */
|
||||||
int ext_type;
|
unsigned int ext_size; /* size of buffer, for ext_free */
|
||||||
struct ifnet *ext_ifp;
|
};
|
||||||
int ext_backend; /* backend pool the storage came from */
|
|
||||||
struct mbuf *ext_nextref;
|
|
||||||
struct mbuf *ext_prevref;
|
|
||||||
#ifdef CONFIG_DEBUG
|
|
||||||
const char *ext_ofile;
|
|
||||||
const char *ext_nfile;
|
|
||||||
int ext_oline;
|
|
||||||
int ext_nline;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
struct mbuf
|
struct mbuf
|
||||||
{
|
{
|
||||||
|
|||||||
+19
-146
@@ -65,7 +65,6 @@
|
|||||||
#include "rpc_v2.h"
|
#include "rpc_v2.h"
|
||||||
#include "rpc.h"
|
#include "rpc.h"
|
||||||
#include "xdr_subs.h"
|
#include "xdr_subs.h"
|
||||||
|
|
||||||
#include "rpc_idgen.h"
|
#include "rpc_idgen.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -80,7 +79,8 @@
|
|||||||
* first complaint will happen after (1+2+3+4+5)=15 seconds.
|
* first complaint will happen after (1+2+3+4+5)=15 seconds.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MAX_RESEND_DELAY 5 /* seconds */
|
#define MAX_RESEND_DELAY 5 /* seconds */
|
||||||
|
#define IP_PORTRANGE 19 /* int; range to choose for unspec port */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
@@ -191,7 +191,6 @@ int krpc_portmap(struct sockaddr_in *sin, unsigned int prog, unsigned int vers,
|
|||||||
uint16_t pad;
|
uint16_t pad;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
} *rdata;
|
} *rdata;
|
||||||
struct mbuf *m;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* The portmapper port is fixed. */
|
/* The portmapper port is fixed. */
|
||||||
@@ -202,17 +201,6 @@ int krpc_portmap(struct sockaddr_in *sin, unsigned int prog, unsigned int vers,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// m = m_get(M_WAIT, MT_DATA);
|
|
||||||
m = kmalloc(sizeof(*sdata));
|
|
||||||
m->m_type = MT_DATA;
|
|
||||||
m->m_next = (struct mbuf *)NULL;
|
|
||||||
m->m_nextpkt = (struct mbuf *)NULL;
|
|
||||||
m->m_data = m->m_dat;
|
|
||||||
m->m_flags = 0;
|
|
||||||
|
|
||||||
sdata = mtod(m, struct sdata *);
|
|
||||||
m->m_len = sizeof(*sdata);
|
|
||||||
|
|
||||||
/* Do the RPC to get it. */
|
/* Do the RPC to get it. */
|
||||||
|
|
||||||
sdata->prog = txdr_unsigned(prog);
|
sdata->prog = txdr_unsigned(prog);
|
||||||
@@ -221,23 +209,14 @@ int krpc_portmap(struct sockaddr_in *sin, unsigned int prog, unsigned int vers,
|
|||||||
sdata->port = 0;
|
sdata->port = 0;
|
||||||
|
|
||||||
sin->sin_port = htons(PMAPPORT);
|
sin->sin_port = htons(PMAPPORT);
|
||||||
error = krpc_call(sin, PMAPPROG, PMAPVERS, PMAPPROC_GETPORT, &m, NULL, -1);
|
error = krpc_call(sin, PMAPPROG, PMAPVERS, PMAPPROC_GETPORT, -1);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->m_len < sizeof(*rdata))
|
|
||||||
{
|
|
||||||
m = m_pullup(m, sizeof(*rdata));
|
|
||||||
if (m == NULL)
|
|
||||||
return ENOBUFS;
|
|
||||||
}
|
|
||||||
|
|
||||||
rdata = mtod(m, struct rdata *);
|
|
||||||
*portp = rdata->port;
|
*portp = rdata->port;
|
||||||
|
|
||||||
kfree(m);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,12 +228,11 @@ int krpc_portmap(struct sockaddr_in *sin, unsigned int prog, unsigned int vers,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int krpc_call(struct sockaddr_in *sa, unsigned int prog, unsigned int vers,
|
int krpc_call(struct sockaddr_in *sa, unsigned int prog, unsigned int vers,
|
||||||
unsigned int func, struct mbuf **data, struct mbuf **from_p,
|
unsigned int func, int retries)
|
||||||
int retries)
|
|
||||||
{
|
{
|
||||||
struct socket *so;
|
struct socket *so;
|
||||||
struct sockaddr_in *sin;
|
struct sockaddr_in *sin;
|
||||||
struct mbuf *m, *nam, *mhead, *from, *mopt;
|
struct mbuf *m, *nam, *mhead, *from;
|
||||||
struct rpc_call *call;
|
struct rpc_call *call;
|
||||||
struct rpc_reply *reply;
|
struct rpc_reply *reply;
|
||||||
struct uio auio;
|
struct uio auio;
|
||||||
@@ -272,32 +250,17 @@ int krpc_call(struct sockaddr_in *sa, unsigned int prog, unsigned int vers,
|
|||||||
return (EAFNOSUPPORT);
|
return (EAFNOSUPPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free at end if not null. */
|
|
||||||
|
|
||||||
nam = mhead = NULL;
|
|
||||||
from = NULL;
|
|
||||||
|
|
||||||
/* Create socket and set its receive timeout. */
|
/* Create socket and set its receive timeout. */
|
||||||
|
|
||||||
if ((error = socket(AF_INET, SOCK_DGRAM, 0)))
|
if ((error = psock_socket(AF_INET, SOCK_DGRAM, 0, so)))
|
||||||
{
|
{
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
// m = m_get(M_WAIT, MT_SOOPTS);
|
tv->tv_sec = 1;
|
||||||
m = kmalloc(sizeof(*tv));
|
|
||||||
m->m_type = MT_SOOPTS;
|
|
||||||
m->m_next = (struct mbuf *)NULL;
|
|
||||||
m->m_nextpkt = (struct mbuf *)NULL;
|
|
||||||
m->m_data = m->m_dat;
|
|
||||||
m->m_flags = 0;
|
|
||||||
|
|
||||||
tv = mtod(m, struct timeval *);
|
|
||||||
m->m_len = sizeof(*tv);
|
|
||||||
tv->tv_sec = 1;
|
|
||||||
tv->tv_usec = 0;
|
tv->tv_usec = 0;
|
||||||
|
|
||||||
if ((error = sosetopt(so, SOL_SOCKET, SO_RCVTIMEO, m)))
|
if ((error = psock_setsockopt(so, SOL_SOCKET, SO_RCVTIMEO,(const void *) tv, sizeof (*tv))))
|
||||||
{
|
{
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -307,19 +270,9 @@ int krpc_call(struct sockaddr_in *sa, unsigned int prog, unsigned int vers,
|
|||||||
if (from_p)
|
if (from_p)
|
||||||
{
|
{
|
||||||
int32_t *on;
|
int32_t *on;
|
||||||
// m = m_get(M_WAIT, MT_SOOPTS);
|
|
||||||
m = kmalloc(sizeof(*on));
|
|
||||||
m->m_type = MT_SOOPTS;
|
|
||||||
m->m_next = (struct mbuf *)NULL;
|
|
||||||
m->m_nextpkt = (struct mbuf *)NULL;
|
|
||||||
m->m_data = m->m_dat;
|
|
||||||
m->m_flags = 0;
|
|
||||||
|
|
||||||
on = mtod(m, int32_t *);
|
|
||||||
m->m_len = sizeof(*on);
|
|
||||||
*on = 1;
|
*on = 1;
|
||||||
|
|
||||||
if ((error = sosetopt(error, SOL_SOCKET, SO_BROADCAST, m)))
|
if ((error = psock_setsockopt(so, SOL_SOCKET, SO_BROADCAST, (const void *) on, sizeof (*on))))
|
||||||
{
|
{
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -330,57 +283,27 @@ int krpc_call(struct sockaddr_in *sa, unsigned int prog, unsigned int vers,
|
|||||||
* non-reserved (non-privileged) ports.
|
* non-reserved (non-privileged) ports.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// MGET(mopt, M_WAIT, MT_SOOPTS);
|
|
||||||
mopt = kmalloc(sizeof(int));
|
|
||||||
mopt->m_type = MT_SOOPTS;
|
|
||||||
mopt->m_next = (struct mbuf *)NULL;
|
|
||||||
mopt->m_nextpkt = (struct mbuf *)NULL;
|
|
||||||
mopt->m_data = mopt->m_dat;
|
|
||||||
mopt->m_flags = 0;
|
|
||||||
|
|
||||||
mopt->m_len = sizeof(int);
|
|
||||||
ip = mtod(mopt, int *);
|
|
||||||
*ip = 2;
|
*ip = 2;
|
||||||
error = sosetopt(so, IPPROTO_IP, 19, mopt);
|
error = psock_setsockopt(so, IPPROTO_IP, IP_PORTRANGE, (const void *) ip, sizeof (*ip));
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MGET(m, M_WAIT, MT_SONAME);
|
sin->sin_len = sizeof(struct sockaddr_in);
|
||||||
m = kmalloc(sizeof(struct sockaddr_in));
|
|
||||||
m->m_type = MT_SONAME;
|
|
||||||
m->m_next = (struct mbuf *)NULL;
|
|
||||||
m->m_nextpkt = (struct mbuf *)NULL;
|
|
||||||
m->m_data = m->m_dat;
|
|
||||||
m->m_flags = 0;
|
|
||||||
|
|
||||||
sin = mtod(m, struct sockaddr_in *);
|
|
||||||
sin->sin_len = m->m_len = sizeof(struct sockaddr_in);
|
|
||||||
sin->sin_family = AF_INET;
|
sin->sin_family = AF_INET;
|
||||||
sin->sin_addr.s_addr = INADDR_ANY;
|
sin->sin_addr.s_addr = INADDR_ANY;
|
||||||
sin->sin_port = htons(0);
|
sin->sin_port = htons(0);
|
||||||
error = sobind(so, m, &proc0);
|
error = psock_bind(so, m, &proc0);
|
||||||
kfree(m);
|
|
||||||
// m_freem(m);
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
printf("bind failed\n");
|
printf("bind failed\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MGET(mopt, M_WAIT, MT_SOOPTS);
|
|
||||||
mopt = kmalloc(sizeof(int));
|
|
||||||
mopt->m_type = MT_SOOPTS;
|
|
||||||
mopt->m_next = (struct mbuf *)NULL;
|
|
||||||
mopt->m_nextpkt = (struct mbuf *)NULL;
|
|
||||||
mopt->m_data = mopt->m_dat;
|
|
||||||
mopt->m_flags = 0;
|
|
||||||
|
|
||||||
mopt->m_len = sizeof(int);
|
|
||||||
ip = mtod(mopt, int *);
|
|
||||||
*ip = 0;
|
*ip = 0;
|
||||||
error = sosetopt(so, IPPROTO_IP, 19, mopt);
|
error = psock_setsockopt(so, IPPROTO_IP, IP_PORTRANGE, (const void *) ip, sizeof (*ip));
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
goto out;
|
goto out;
|
||||||
@@ -388,24 +311,11 @@ int krpc_call(struct sockaddr_in *sa, unsigned int prog, unsigned int vers,
|
|||||||
|
|
||||||
/* Setup socket address for the server. */
|
/* Setup socket address for the server. */
|
||||||
|
|
||||||
// nam = m_get(M_WAIT, MT_SONAME);
|
bcopy((caddr_t *) sa, (caddr_t *) sin, sa->sin_len);
|
||||||
nam = kmalloc(sizeof(struct sockaddr_in));
|
|
||||||
nam->m_type = MT_SONAME;
|
|
||||||
nam->m_next = (struct mbuf *)NULL;
|
|
||||||
nam->m_nextpkt = (struct mbuf *)NULL;
|
|
||||||
nam->m_data = nam->m_dat;
|
|
||||||
nam->m_flags = 0;
|
|
||||||
|
|
||||||
sin = mtod(nam, struct sockaddr_in *);
|
|
||||||
bcopy((caddr_t) sa, (caddr_t) sin, (nam->m_len = sa->sin_len));
|
|
||||||
|
|
||||||
/* Prepend RPC message header. */
|
/* Prepend RPC message header. */
|
||||||
|
|
||||||
mhead = m_gethdr(M_WAIT, MT_DATA);
|
bzero((caddr_t *) call, sizeof(*call));
|
||||||
mhead->m_next = *data;
|
|
||||||
call = mtod(mhead, struct rpc_call *);
|
|
||||||
mhead->m_len = sizeof(*call);
|
|
||||||
bzero((caddr_t) call, sizeof(*call));
|
|
||||||
|
|
||||||
/* rpc_call part */
|
/* rpc_call part */
|
||||||
|
|
||||||
@@ -429,18 +339,6 @@ int krpc_call(struct sockaddr_in *sa, unsigned int prog, unsigned int vers,
|
|||||||
call->rpc_verf.authtype = 0;
|
call->rpc_verf.authtype = 0;
|
||||||
call->rpc_verf.authlen = 0;
|
call->rpc_verf.authlen = 0;
|
||||||
|
|
||||||
/* Setup packet header */
|
|
||||||
|
|
||||||
len = 0;
|
|
||||||
m = mhead;
|
|
||||||
while (m)
|
|
||||||
{
|
|
||||||
len += m->m_len;
|
|
||||||
m = m->m_next;
|
|
||||||
}
|
|
||||||
|
|
||||||
mhead->m_pkthdr.len = len;
|
|
||||||
mhead->m_pkthdr.rcvif = NULL;
|
|
||||||
|
|
||||||
/* Send it, repeatedly, until a reply is received,
|
/* Send it, repeatedly, until a reply is received,
|
||||||
* but delay each re-send by an increasing amount.
|
* but delay each re-send by an increasing amount.
|
||||||
@@ -451,13 +349,6 @@ int krpc_call(struct sockaddr_in *sa, unsigned int prog, unsigned int vers,
|
|||||||
{
|
{
|
||||||
/* Send RPC request (or re-send). */
|
/* Send RPC request (or re-send). */
|
||||||
|
|
||||||
m = m_copym(mhead, 0, M_COPYALL, M_WAIT);
|
|
||||||
if (m == NULL)
|
|
||||||
{
|
|
||||||
error = ENOBUFS;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
error = sosend(so, nam, NULL, m, NULL, 0);
|
error = sosend(so, nam, NULL, m, NULL, 0);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
@@ -584,15 +475,12 @@ gotreply:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reply = mtod(m, struct rpc_reply *);
|
|
||||||
if (reply->rp_auth.authtype != 0)
|
if (reply->rp_auth.authtype != 0)
|
||||||
{
|
{
|
||||||
len += fxdr_unsigned(uint32_t, reply->rp_auth.authlen);
|
len += fxdr_unsigned(uint32_t, reply->rp_auth.authlen);
|
||||||
len = (len + 3) & ~3; /* XXX? */
|
len = (len + 3) & ~3; /* XXX? */
|
||||||
}
|
}
|
||||||
|
|
||||||
m_adj(m, len);
|
|
||||||
|
|
||||||
/* result */
|
/* result */
|
||||||
|
|
||||||
*data = m;
|
*data = m;
|
||||||
@@ -603,22 +491,7 @@ gotreply:
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (nam)
|
(void)psock_close(so);
|
||||||
{
|
|
||||||
m_freem(nam);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mhead)
|
|
||||||
{
|
|
||||||
m_freem(mhead);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (from)
|
|
||||||
{
|
|
||||||
m_freem(from);
|
|
||||||
}
|
|
||||||
|
|
||||||
soclose(so);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-7
@@ -1,8 +1,8 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/string.h
|
* include/string.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -45,8 +45,15 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
/* Compatibility definitions */
|
||||||
|
|
||||||
|
#ifndef CONFIG_ARCH_BZERO
|
||||||
|
# define bzero(s,n) (void)memset(s,0,n)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define bcopy(b1,b2,len) (void)memmove(b2,b1,len)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Global Function Prototypes
|
* Global Function Prototypes
|
||||||
@@ -89,10 +96,6 @@ EXTERN FAR void *memcpy(FAR void *dest, FAR const void *src, size_t n);
|
|||||||
EXTERN int memcmp(FAR const void *s1, FAR const void *s2, size_t n);
|
EXTERN int memcmp(FAR const void *s1, FAR const void *s2, size_t n);
|
||||||
EXTERN FAR void *memmove(FAR void *dest, FAR const void *src, size_t count);
|
EXTERN FAR void *memmove(FAR void *dest, FAR const void *src, size_t count);
|
||||||
|
|
||||||
#ifndef CONFIG_ARCH_BZERO
|
|
||||||
# define bzero(s,n) (void)memset(s,0,n)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user