some more clean up and renaming
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1794 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -136,7 +136,7 @@ struct socket {
|
|||||||
* Returns error without lock if sleep is interrupted.
|
* Returns error without lock if sleep is interrupted.
|
||||||
*/
|
*/
|
||||||
#define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \
|
#define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \
|
||||||
(((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \
|
(((wf) == M_WAITOK) ? sockbuf_lock(sb) : EWOULDBLOCK) : \
|
||||||
((sb)->sb_flags |= SB_LOCK), 0)
|
((sb)->sb_flags |= SB_LOCK), 0)
|
||||||
|
|
||||||
/* release lock on sockbuf sb */
|
/* release lock on sockbuf sb */
|
||||||
|
|||||||
@@ -67,22 +67,23 @@
|
|||||||
# define ifaof_ifpforaddr core->ifaof_ifpforaddr
|
# define ifaof_ifpforaddr core->ifaof_ifpforaddr
|
||||||
# define ifafree core->ifafree
|
# define ifafree core->ifafree
|
||||||
|
|
||||||
# define sbappend core->sbappend
|
# define sockbuf_append core->sockbuf_append
|
||||||
# define sbappendaddr core->sbappendaddr
|
# define sockbuf_appendaddr core->sockbuf_appendaddr
|
||||||
# define sbdrop core->sbdrop
|
# define sockbuf_drop core->sockbuf_drop
|
||||||
# define sbflush core->sbflush
|
# define sockbuf_flush core->sockbuf_flush
|
||||||
# define sbreserve core->sbreserve
|
# define sockbuf_reserve core->sockbuf_reserve
|
||||||
|
|
||||||
# define soreserve core->soreserve
|
# define soreserve core->soreserve
|
||||||
# define sowakeup core->sowakeup
|
# define sowakeup core->sowakeup
|
||||||
# define sonewconn core->sonewconn
|
# define sonewconn core->sonewconn
|
||||||
# define soisconnected core->soisconnected
|
|
||||||
# define soisconnecting core->soisconnecting
|
# define socket_set_connected core->socket_set_connected
|
||||||
# define soisdisconnected core->soisdisconnected
|
# define socket_set_connecting core->socket_set_connecting
|
||||||
# define soisdisconnecting core->soisdisconnecting
|
# define socket_set_disconnected core->socket_set_disconnected
|
||||||
# define sohasoutofband core->sohasoutofband
|
# define socket_set_disconnecting core->socket_set_disconnecting
|
||||||
# define socantsendmore core->socantsendmore
|
# define socket_set_hasoutofband core->socket_set_hasoutofband
|
||||||
# define socantrcvmore core->socantrcvmore
|
# define socket_set_cantsendmore core->socket_set_cantsendmore
|
||||||
|
# define socket_set_cantrcvmore core->socket_set_cantrcvmore
|
||||||
|
|
||||||
# define rtfree core->rtfree
|
# define rtfree core->rtfree
|
||||||
# define rtalloc core->rtalloc
|
# define rtalloc core->rtalloc
|
||||||
|
|||||||
@@ -44,20 +44,20 @@ struct core_module_info {
|
|||||||
/* socket functions - called "internally" */
|
/* socket functions - called "internally" */
|
||||||
struct socket *(*sonewconn)(struct socket *, int);
|
struct socket *(*sonewconn)(struct socket *, int);
|
||||||
int (*soreserve)(struct socket *, uint32, uint32);
|
int (*soreserve)(struct socket *, uint32, uint32);
|
||||||
int (*sbreserve)(struct sockbuf *, uint32);
|
int (*sockbuf_reserve)(struct sockbuf *, uint32);
|
||||||
void (*sbappend)(struct sockbuf *, struct mbuf *);
|
void (*sockbuf_append)(struct sockbuf *, struct mbuf *);
|
||||||
int (*sbappendaddr)(struct sockbuf *, struct sockaddr *,
|
int (*sockbuf_appendaddr)(struct sockbuf *, struct sockaddr *,
|
||||||
struct mbuf *, struct mbuf *);
|
struct mbuf *, struct mbuf *);
|
||||||
void (*sbdrop)(struct sockbuf *, int);
|
void (*sockbuf_drop)(struct sockbuf *, int);
|
||||||
void (*sbflush)(struct sockbuf *sb);
|
void (*sockbuf_flush)(struct sockbuf *sb);
|
||||||
void (*sowakeup)(struct socket *, struct sockbuf *);
|
void (*sowakeup)(struct socket *, struct sockbuf *);
|
||||||
void (*soisconnected)(struct socket *);
|
void (*socket_set_connected)(struct socket *so);
|
||||||
void (*soisconnecting)(struct socket*);
|
void (*socket_set_connecting)(struct socket *so);
|
||||||
void (*soisdisconnected)(struct socket *);
|
void (*socket_set_disconnected)(struct socket *so);
|
||||||
void (*soisdisconnecting)(struct socket *);
|
void (*socket_set_disconnecting)(struct socket *so);
|
||||||
void (*sohasoutofband)(struct socket *so);
|
void (*socket_set_hasoutofband)(struct socket *so);
|
||||||
void (*socantrcvmore)(struct socket*);
|
void (*socket_set_cantrcvmore)(struct socket *so);
|
||||||
void (*socantsendmore)(struct socket *);
|
void (*socket_set_cantsendmore)(struct socket *so);
|
||||||
|
|
||||||
/* pcb options */
|
/* pcb options */
|
||||||
int (*in_pcballoc)(struct socket *, struct inpcb *);
|
int (*in_pcballoc)(struct socket *, struct inpcb *);
|
||||||
|
|||||||
@@ -37,48 +37,40 @@ int socket_set_event_callback(struct socket *so, socket_event_callback, void *,
|
|||||||
* other network modules.
|
* other network modules.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int sosend(struct socket *so, struct mbuf *addr, struct uio *uio,
|
|
||||||
struct mbuf *top, struct mbuf *control, int flags);
|
|
||||||
|
|
||||||
struct socket *sonewconn(struct socket *head, int connstatus);
|
struct socket *sonewconn(struct socket *head, int connstatus);
|
||||||
int soreserve (struct socket *so, uint32 sndcc, uint32 rcvcc);
|
int soreserve (struct socket *so, uint32 sndcc, uint32 rcvcc);
|
||||||
|
|
||||||
void sbrelease (struct sockbuf *sb);
|
void sockbuf_release(struct sockbuf *sb);
|
||||||
int sbreserve (struct sockbuf *sb, uint32 cc);
|
int sockbuf_reserve(struct sockbuf *sb, uint32 cc);
|
||||||
void sbdrop (struct sockbuf *sb, int len);
|
void sockbuf_drop(struct sockbuf *sb, int len);
|
||||||
void sbdroprecord (struct sockbuf *sb);
|
void sockbuf_droprecord(struct sockbuf *sb);
|
||||||
void sbflush (struct sockbuf *sb);
|
void sockbuf_flush(struct sockbuf *sb);
|
||||||
int sbwait (struct sockbuf *sb);
|
int sockbuf_wait(struct sockbuf *sb);
|
||||||
void sbappend (struct sockbuf *sb, struct mbuf *m);
|
void sockbuf_append(struct sockbuf *sb, struct mbuf *m);
|
||||||
int sbappendaddr (struct sockbuf *sb, struct sockaddr *asa,
|
int sockbuf_appendaddr(struct sockbuf *sb, struct sockaddr *asa,
|
||||||
struct mbuf *m0, struct mbuf *control);
|
struct mbuf *m0, struct mbuf *control);
|
||||||
int sbappendcontrol (struct sockbuf *sb, struct mbuf *m0,
|
int sockbuf_appendcontrol(struct sockbuf *sb, struct mbuf *m0,
|
||||||
struct mbuf *control);
|
struct mbuf *control);
|
||||||
void sbappendrecord (struct sockbuf *sb, struct mbuf *m0);
|
void sockbuf_appendrecord(struct sockbuf *sb, struct mbuf *m0);
|
||||||
void sbcheck (struct sockbuf *sb);
|
void sockbuf_compress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n);
|
||||||
void sbcompress (struct sockbuf *sb, struct mbuf *m, struct mbuf *n);
|
void sockbuf_insertoob(struct sockbuf *, struct mbuf *);
|
||||||
void sbinsertoob(struct sockbuf *, struct mbuf *);
|
|
||||||
|
|
||||||
int soreceive (struct socket *so, struct mbuf **paddr, struct uio *uio,
|
|
||||||
struct mbuf **mp0, struct mbuf **controlp, int *flagsp);
|
|
||||||
void sowakeup(struct socket *so, struct sockbuf *sb);
|
void sowakeup(struct socket *so, struct sockbuf *sb);
|
||||||
int sbwait(struct sockbuf *sb);
|
|
||||||
|
|
||||||
int sodisconnect(struct socket *);
|
int sodisconnect(struct socket *);
|
||||||
void sofree(struct socket *);
|
|
||||||
|
|
||||||
void sohasoutofband(struct socket *so);
|
void socket_set_hasoutofband(struct socket *so);
|
||||||
void socantsendmore(struct socket *so);
|
void socket_set_cantsendmore(struct socket *so);
|
||||||
void socantrcvmore(struct socket *so);
|
void socket_set_cantrcvmore(struct socket *so);
|
||||||
void soisconnected (struct socket *so);
|
void socket_set_connected(struct socket *so);
|
||||||
void soisconnecting (struct socket *so);
|
void socket_set_connecting(struct socket *so);
|
||||||
void soisdisconnected (struct socket *so);
|
void socket_set_disconnected(struct socket *so);
|
||||||
void soisdisconnecting (struct socket *so);
|
void socket_set_disconnecting(struct socket *so);
|
||||||
void soqinsque (struct socket *head, struct socket *so, int q);
|
|
||||||
int soqremque (struct socket *so, int q);
|
|
||||||
int sorflush(struct socket *so);
|
int sorflush(struct socket *so);
|
||||||
|
|
||||||
int sb_lock(struct sockbuf *sb);
|
int sockbuf_lock(struct sockbuf *sb);
|
||||||
int nsleep(sem_id chan, char *msg, int timeo);
|
int nsleep(sem_id chan, char *msg, int timeo);
|
||||||
void wakeup(sem_id chan);
|
void wakeup(sem_id chan);
|
||||||
|
|
||||||
|
|||||||
@@ -103,19 +103,19 @@ _EXPORT struct core_module_info core_info = {
|
|||||||
|
|
||||||
sonewconn,
|
sonewconn,
|
||||||
soreserve,
|
soreserve,
|
||||||
sbreserve,
|
sockbuf_reserve,
|
||||||
sbappend,
|
sockbuf_append,
|
||||||
sbappendaddr,
|
sockbuf_appendaddr,
|
||||||
sbdrop,
|
sockbuf_drop,
|
||||||
sbflush,
|
sockbuf_flush,
|
||||||
sowakeup,
|
sowakeup,
|
||||||
soisconnected,
|
socket_set_connected,
|
||||||
soisconnecting,
|
socket_set_connecting,
|
||||||
soisdisconnected,
|
socket_set_disconnected,
|
||||||
soisdisconnecting,
|
socket_set_disconnecting,
|
||||||
sohasoutofband,
|
socket_set_hasoutofband,
|
||||||
socantrcvmore,
|
socket_set_cantrcvmore,
|
||||||
socantsendmore,
|
socket_set_cantsendmore,
|
||||||
|
|
||||||
in_pcballoc,
|
in_pcballoc,
|
||||||
in_pcbdetach,
|
in_pcbdetach,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ uint32 sb_max = SB_MAX; /* hard value, recompile needed to alter :( */
|
|||||||
* Attempt to scale mbmax so that mbcnt doesn't become limiting
|
* Attempt to scale mbmax so that mbcnt doesn't become limiting
|
||||||
* if buffering efficiency is near the normal case.
|
* if buffering efficiency is near the normal case.
|
||||||
*/
|
*/
|
||||||
int sbreserve(struct sockbuf *sb, uint32 cc)
|
int sockbuf_reserve(struct sockbuf *sb, uint32 cc)
|
||||||
{
|
{
|
||||||
uint64 dd = (uint64)cc;
|
uint64 dd = (uint64)cc;
|
||||||
uint64 ee = (sb_max * MCLBYTES) / ((MSIZE) + (MCLBYTES));
|
uint64 ee = (sb_max * MCLBYTES) / ((MSIZE) + (MCLBYTES));
|
||||||
@@ -38,7 +38,7 @@ int sbreserve(struct sockbuf *sb, uint32 cc)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sbdrop(struct sockbuf *sb, int len)
|
void sockbuf_drop(struct sockbuf *sb, int len)
|
||||||
{
|
{
|
||||||
struct mbuf *m, *mn;
|
struct mbuf *m, *mn;
|
||||||
struct mbuf *next;
|
struct mbuf *next;
|
||||||
@@ -80,13 +80,13 @@ void sbdrop(struct sockbuf *sb, int len)
|
|||||||
* Free all mbufs in a sockbuf.
|
* Free all mbufs in a sockbuf.
|
||||||
* Check that all resources are reclaimed.
|
* Check that all resources are reclaimed.
|
||||||
*/
|
*/
|
||||||
void sbflush(struct sockbuf *sb)
|
void sockbuf_flush(struct sockbuf *sb)
|
||||||
{
|
{
|
||||||
if (sb->sb_flags & SB_LOCK) {
|
if (sb->sb_flags & SB_LOCK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (sb->sb_mbcnt)
|
while (sb->sb_mbcnt)
|
||||||
sbdrop(sb, (int)sb->sb_cc);
|
sockbuf_drop(sb, (int)sb->sb_cc);
|
||||||
if (sb->sb_cc || sb->sb_mb)
|
if (sb->sb_cc || sb->sb_mb)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -94,13 +94,13 @@ void sbflush(struct sockbuf *sb)
|
|||||||
/*
|
/*
|
||||||
* Free mbufs held by a socket, and reserved mbuf space.
|
* Free mbufs held by a socket, and reserved mbuf space.
|
||||||
*/
|
*/
|
||||||
void sbrelease(struct sockbuf *sb)
|
void sockbuf_release(struct sockbuf *sb)
|
||||||
{
|
{
|
||||||
sbflush(sb);
|
sockbuf_flush(sb);
|
||||||
sb->sb_hiwat = sb->sb_mbmax = 0;
|
sb->sb_hiwat = sb->sb_mbmax = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sbappend(struct sockbuf *sb, struct mbuf *m)
|
void sockbuf_append(struct sockbuf *sb, struct mbuf *m)
|
||||||
{
|
{
|
||||||
struct mbuf *n;
|
struct mbuf *n;
|
||||||
|
|
||||||
@@ -111,15 +111,15 @@ void sbappend(struct sockbuf *sb, struct mbuf *m)
|
|||||||
n = n->m_nextpkt;
|
n = n->m_nextpkt;
|
||||||
do {
|
do {
|
||||||
if (n->m_flags & M_EOR) {
|
if (n->m_flags & M_EOR) {
|
||||||
sbappendrecord(sb, m); /* XXXXXX!!!! */
|
sockbuf_appendrecord(sb, m); /* XXXXXX!!!! */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} while (n->m_next && (n = n->m_next));
|
} while (n->m_next && (n = n->m_next));
|
||||||
}
|
}
|
||||||
sbcompress(sb, m, n);
|
sockbuf_compress(sb, m, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sbappendrecord(struct sockbuf *sb, struct mbuf *m0)
|
void sockbuf_appendrecord(struct sockbuf *sb, struct mbuf *m0)
|
||||||
{
|
{
|
||||||
struct mbuf *m;
|
struct mbuf *m;
|
||||||
|
|
||||||
@@ -143,10 +143,10 @@ void sbappendrecord(struct sockbuf *sb, struct mbuf *m0)
|
|||||||
m0->m_flags &= ~M_EOR;
|
m0->m_flags &= ~M_EOR;
|
||||||
m->m_flags |= M_EOR;
|
m->m_flags |= M_EOR;
|
||||||
}
|
}
|
||||||
sbcompress(sb, m, m0);
|
sockbuf_compress(sb, m, m0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sbappendaddr(struct sockbuf *sb, struct sockaddr *asa,
|
int sockbuf_appendaddr(struct sockbuf *sb, struct sockaddr *asa,
|
||||||
struct mbuf *m0, struct mbuf *control)
|
struct mbuf *m0, struct mbuf *control)
|
||||||
{
|
{
|
||||||
struct mbuf *m, *n;
|
struct mbuf *m, *n;
|
||||||
@@ -188,7 +188,7 @@ int sbappendaddr(struct sockbuf *sb, struct sockaddr *asa,
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n)
|
void sockbuf_compress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n)
|
||||||
{
|
{
|
||||||
int eor = 0;
|
int eor = 0;
|
||||||
struct mbuf *o;
|
struct mbuf *o;
|
||||||
@@ -226,11 +226,11 @@ void sbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n)
|
|||||||
if (n)
|
if (n)
|
||||||
n->m_flags |= eor;
|
n->m_flags |= eor;
|
||||||
else
|
else
|
||||||
printf("semi-panic: sbcompress\n");
|
printf("semi-panic: sockbuf_compress\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sbdroprecord(struct sockbuf *sb)
|
void sockbuf_droprecord(struct sockbuf *sb)
|
||||||
{
|
{
|
||||||
struct mbuf *m, *mn;
|
struct mbuf *m, *mn;
|
||||||
|
|
||||||
@@ -244,15 +244,15 @@ void sbdroprecord(struct sockbuf *sb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int sbwait(struct sockbuf *sb)
|
int sockbuf_wait(struct sockbuf *sb)
|
||||||
{
|
{
|
||||||
if (sb->sb_cc > 0)
|
if (sb->sb_cc > 0)
|
||||||
return 0;
|
return 0;
|
||||||
sb->sb_flags |= SB_WAIT;
|
sb->sb_flags |= SB_WAIT;
|
||||||
return nsleep(sb->sb_pop, "sbwait", sb->sb_timeo);
|
return nsleep(sb->sb_pop, "sockbuf_wait", sb->sb_timeo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sbinsertoob(struct sockbuf *sb, struct mbuf *m0)
|
void sockbuf_insertoob(struct sockbuf *sb, struct mbuf *m0)
|
||||||
{
|
{
|
||||||
struct mbuf *m;
|
struct mbuf *m;
|
||||||
struct mbuf **mp;
|
struct mbuf **mp;
|
||||||
@@ -284,20 +284,20 @@ again:
|
|||||||
m0->m_flags &= ~M_EOR;
|
m0->m_flags &= ~M_EOR;
|
||||||
m->m_flags |= M_EOR;
|
m->m_flags |= M_EOR;
|
||||||
}
|
}
|
||||||
sbcompress(sb, m, m0);
|
sockbuf_compress(sb, m, m0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock a sockbuf already known to be locked;
|
* Lock a sockbuf already known to be locked;
|
||||||
* return any error returned from sleep (EINTR).
|
* return any error returned from sleep (EINTR).
|
||||||
*/
|
*/
|
||||||
int sb_lock(struct sockbuf *sb)
|
int sockbuf_lock(struct sockbuf *sb) // XXX never called at all
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
while (sb->sb_flags & SB_LOCK) {
|
while (sb->sb_flags & SB_LOCK) {
|
||||||
sb->sb_flags |= SB_WANT;
|
sb->sb_flags |= SB_WANT;
|
||||||
error = nsleep(sb->sb_sleep, "sb_lock", 0);
|
error = nsleep(sb->sb_sleep, "sockbuf_lock", 0);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,15 @@
|
|||||||
#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? M_NOWAIT : M_WAITOK)
|
#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? M_NOWAIT : M_WAITOK)
|
||||||
|
|
||||||
/* Private prototypes */
|
/* Private prototypes */
|
||||||
static int checkevent(struct socket *so);
|
static int checkevent(struct socket *so);
|
||||||
|
static void sofree(struct socket *);
|
||||||
|
static void soqinsque (struct socket *head, struct socket *so, int q);
|
||||||
|
static int soqremque (struct socket *so, int q);
|
||||||
|
static int sosend(struct socket *so, struct mbuf *addr, struct uio *uio,
|
||||||
|
struct mbuf *top, struct mbuf *control, int flags);
|
||||||
|
static int soreceive (struct socket *so, struct mbuf **paddr, struct uio *uio,
|
||||||
|
struct mbuf **mp0, struct mbuf **controlp, int *flagsp);
|
||||||
|
|
||||||
|
|
||||||
/* Static global objects... */
|
/* Static global objects... */
|
||||||
static pool_ctl *spool;
|
static pool_ctl *spool;
|
||||||
@@ -162,8 +170,15 @@ int socket_create(struct socket *so, int dom, int type, int proto)
|
|||||||
so->so_rcv.sb_sleep < 0 ||
|
so->so_rcv.sb_sleep < 0 ||
|
||||||
so->so_snd.sb_pop < 0 ||
|
so->so_snd.sb_pop < 0 ||
|
||||||
so->so_snd.sb_sleep < 0 ||
|
so->so_snd.sb_sleep < 0 ||
|
||||||
so->so_timeo < 0)
|
so->so_timeo < 0) {
|
||||||
|
printf("socket_create: ENOMEM\n");
|
||||||
|
delete_sem(so->so_rcv.sb_pop);
|
||||||
|
delete_sem(so->so_rcv.sb_sleep);
|
||||||
|
delete_sem(so->so_snd.sb_pop);
|
||||||
|
delete_sem(so->so_snd.sb_sleep);
|
||||||
|
delete_sem(so->so_timeo);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _KERNEL_MODE
|
#ifdef _KERNEL_MODE
|
||||||
set_sem_owner(so->so_rcv.sb_pop, B_SYSTEM_TEAM);
|
set_sem_owner(so->so_rcv.sb_pop, B_SYSTEM_TEAM);
|
||||||
@@ -186,9 +201,9 @@ int socket_create(struct socket *so, int dom, int type, int proto)
|
|||||||
|
|
||||||
int soreserve(struct socket *so, uint32 sndcc, uint32 rcvcc)
|
int soreserve(struct socket *so, uint32 sndcc, uint32 rcvcc)
|
||||||
{
|
{
|
||||||
if (sbreserve(&so->so_snd, sndcc) == 0)
|
if (sockbuf_reserve(&so->so_snd, sndcc) == 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
if (sbreserve(&so->so_rcv, rcvcc) == 0)
|
if (sockbuf_reserve(&so->so_rcv, rcvcc) == 0)
|
||||||
goto bad2;
|
goto bad2;
|
||||||
|
|
||||||
if (so->so_rcv.sb_lowat == 0)
|
if (so->so_rcv.sb_lowat == 0)
|
||||||
@@ -201,7 +216,7 @@ int soreserve(struct socket *so, uint32 sndcc, uint32 rcvcc)
|
|||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
bad2:
|
bad2:
|
||||||
sbrelease(&so->so_snd);
|
sockbuf_release(&so->so_snd);
|
||||||
bad:
|
bad:
|
||||||
printf("soreserve: ENOBUFS\n");
|
printf("soreserve: ENOBUFS\n");
|
||||||
return (ENOBUFS);
|
return (ENOBUFS);
|
||||||
@@ -432,7 +447,7 @@ int socket_writev(struct socket *so, struct iovec *iov, int flags)
|
|||||||
return (len - auio.uio_resid);
|
return (len - auio.uio_resid);
|
||||||
}
|
}
|
||||||
|
|
||||||
int sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top,
|
static int sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top,
|
||||||
struct mbuf *control, int flags)
|
struct mbuf *control, int flags)
|
||||||
{
|
{
|
||||||
struct mbuf **mp;
|
struct mbuf **mp;
|
||||||
@@ -508,7 +523,7 @@ restart:
|
|||||||
}
|
}
|
||||||
/* free lock - we're waiting on send buffer space */
|
/* free lock - we're waiting on send buffer space */
|
||||||
sbunlock(&so->so_snd);
|
sbunlock(&so->so_snd);
|
||||||
error = sbwait(&so->so_snd);
|
error = sockbuf_wait(&so->so_snd);
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
goto restart;
|
goto restart;
|
||||||
@@ -680,7 +695,7 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio, struct mbuf**mp0,
|
static int soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio, struct mbuf**mp0,
|
||||||
struct mbuf **controlp, int *flagsp)
|
struct mbuf **controlp, int *flagsp)
|
||||||
{
|
{
|
||||||
struct mbuf *m, **mp;
|
struct mbuf *m, **mp;
|
||||||
@@ -772,7 +787,7 @@ restart:
|
|||||||
goto release;
|
goto release;
|
||||||
}
|
}
|
||||||
sbunlock(&so->so_rcv);
|
sbunlock(&so->so_rcv);
|
||||||
error = sbwait(&so->so_rcv);
|
error = sockbuf_wait(&so->so_rcv);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
goto restart;
|
goto restart;
|
||||||
@@ -901,7 +916,7 @@ dontblock:
|
|||||||
!sosendallatonce(so) && !nextrecord) {
|
!sosendallatonce(so) && !nextrecord) {
|
||||||
if (so->so_error || so->so_state & SS_CANTRCVMORE)
|
if (so->so_error || so->so_state & SS_CANTRCVMORE)
|
||||||
break;
|
break;
|
||||||
error = sbwait(&so->so_rcv);
|
error = sockbuf_wait(&so->so_rcv);
|
||||||
if (error) {
|
if (error) {
|
||||||
sbunlock(&so->so_rcv);
|
sbunlock(&so->so_rcv);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -914,7 +929,7 @@ dontblock:
|
|||||||
if (m && pr->pr_flags & PR_ATOMIC) {
|
if (m && pr->pr_flags & PR_ATOMIC) {
|
||||||
flags |= MSG_TRUNC;
|
flags |= MSG_TRUNC;
|
||||||
if ((flags & MSG_PEEK) == 0)
|
if ((flags & MSG_PEEK) == 0)
|
||||||
sbdroprecord(&so->so_rcv);
|
sockbuf_droprecord(&so->so_rcv);
|
||||||
}
|
}
|
||||||
if ((flags & MSG_PEEK) == 0) {
|
if ((flags & MSG_PEEK) == 0) {
|
||||||
if (!m)
|
if (!m)
|
||||||
@@ -1020,12 +1035,12 @@ int sorflush(struct socket *so)
|
|||||||
|
|
||||||
sb->sb_flags |= SB_NOINTR;
|
sb->sb_flags |= SB_NOINTR;
|
||||||
sblock(sb, M_WAITOK);
|
sblock(sb, M_WAITOK);
|
||||||
socantrcvmore(so);
|
socket_set_cantrcvmore(so);
|
||||||
sbunlock(sb);
|
sbunlock(sb);
|
||||||
asb = *sb;
|
asb = *sb;
|
||||||
memset(sb, 0, sizeof(*sb));
|
memset(sb, 0, sizeof(*sb));
|
||||||
|
|
||||||
sbrelease(&asb);
|
sockbuf_release(&asb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1048,7 +1063,7 @@ bad:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sofree(struct socket *so)
|
static void sofree(struct socket *so)
|
||||||
{
|
{
|
||||||
if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0)
|
if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0)
|
||||||
return;
|
return;
|
||||||
@@ -1060,7 +1075,7 @@ void sofree(struct socket *so)
|
|||||||
}
|
}
|
||||||
so->so_head = NULL;
|
so->so_head = NULL;
|
||||||
}
|
}
|
||||||
sbrelease(&so->so_snd);
|
sockbuf_release(&so->so_snd);
|
||||||
sorflush(so);
|
sorflush(so);
|
||||||
|
|
||||||
delete_sem(so->so_rcv.sb_pop);
|
delete_sem(so->so_rcv.sb_pop);
|
||||||
@@ -1128,7 +1143,7 @@ int socket_setsockopt(struct socket *so, int level, int optnum, const void *data
|
|||||||
switch (optnum) {
|
switch (optnum) {
|
||||||
case SO_SNDBUF:
|
case SO_SNDBUF:
|
||||||
case SO_RCVBUF:
|
case SO_RCVBUF:
|
||||||
if (sbreserve(optnum == SO_SNDBUF ? &so->so_snd : &so->so_rcv,
|
if (sockbuf_reserve(optnum == SO_SNDBUF ? &so->so_snd : &so->so_rcv,
|
||||||
(uint32)*mtod(m, int32*)) == 0) {
|
(uint32)*mtod(m, int32*)) == 0) {
|
||||||
error = ENOBUFS;
|
error = ENOBUFS;
|
||||||
goto bad;
|
goto bad;
|
||||||
@@ -1320,9 +1335,9 @@ void sowakeup(struct socket *so, struct sockbuf *sb)
|
|||||||
release_sem_etc(sb->sb_pop, 1, B_CAN_INTERRUPT);
|
release_sem_etc(sb->sb_pop, 1, B_CAN_INTERRUPT);
|
||||||
}
|
}
|
||||||
checkevent(so);
|
checkevent(so);
|
||||||
}
|
}
|
||||||
|
|
||||||
void soqinsque(struct socket *head, struct socket *so, int q)
|
static void soqinsque(struct socket *head, struct socket *so, int q)
|
||||||
{
|
{
|
||||||
struct socket **prev;
|
struct socket **prev;
|
||||||
so->so_head = head;
|
so->so_head = head;
|
||||||
@@ -1340,7 +1355,7 @@ void soqinsque(struct socket *head, struct socket *so, int q)
|
|||||||
*prev = so;
|
*prev = so;
|
||||||
}
|
}
|
||||||
|
|
||||||
int soqremque(struct socket *so, int q)
|
static int soqremque(struct socket *so, int q)
|
||||||
{
|
{
|
||||||
struct socket *head, *prev, *next;
|
struct socket *head, *prev, *next;
|
||||||
|
|
||||||
@@ -1366,31 +1381,31 @@ int soqremque(struct socket *so, int q)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sohasoutofband(struct socket *so)
|
void socket_set_hasoutofband(struct socket *so)
|
||||||
{
|
{
|
||||||
/* Should we signal the process with SIGURG??? */
|
/* Should we signal the process with SIGURG??? */
|
||||||
checkevent(so);
|
checkevent(so);
|
||||||
}
|
}
|
||||||
|
|
||||||
void socantsendmore(struct socket *so)
|
void socket_set_cantsendmore(struct socket *so)
|
||||||
{
|
{
|
||||||
so->so_state |= SS_CANTSENDMORE;
|
so->so_state |= SS_CANTSENDMORE;
|
||||||
sowwakeup(so);
|
sowwakeup(so);
|
||||||
}
|
}
|
||||||
|
|
||||||
void socantrcvmore(struct socket *so)
|
void socket_set_cantrcvmore(struct socket *so)
|
||||||
{
|
{
|
||||||
so->so_state |= SS_CANTRCVMORE;
|
so->so_state |= SS_CANTRCVMORE;
|
||||||
sorwakeup(so);
|
sorwakeup(so);
|
||||||
}
|
}
|
||||||
|
|
||||||
void soisconnecting(struct socket *so)
|
void socket_set_connecting(struct socket *so)
|
||||||
{
|
{
|
||||||
so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING);
|
so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING);
|
||||||
so->so_state |= SS_ISCONNECTING;
|
so->so_state |= SS_ISCONNECTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
void soisconnected(struct socket *so)
|
void socket_set_connected(struct socket *so)
|
||||||
{
|
{
|
||||||
struct socket *head = so->so_head;
|
struct socket *head = so->so_head;
|
||||||
|
|
||||||
@@ -1407,7 +1422,7 @@ void soisconnected(struct socket *so)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void soisdisconnecting(struct socket *so)
|
void socket_set_disconnecting(struct socket *so)
|
||||||
{
|
{
|
||||||
so->so_state &= ~SS_ISCONNECTING;
|
so->so_state &= ~SS_ISCONNECTING;
|
||||||
so->so_state |= (SS_ISDISCONNECTING|SS_CANTRCVMORE|SS_CANTSENDMORE);
|
so->so_state |= (SS_ISDISCONNECTING|SS_CANTRCVMORE|SS_CANTSENDMORE);
|
||||||
@@ -1416,7 +1431,7 @@ void soisdisconnecting(struct socket *so)
|
|||||||
sorwakeup(so);
|
sorwakeup(so);
|
||||||
}
|
}
|
||||||
|
|
||||||
void soisdisconnected(struct socket *so)
|
void socket_set_disconnected(struct socket *so)
|
||||||
{
|
{
|
||||||
so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
|
so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
|
||||||
so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE|SS_ISDISCONNECTED);
|
so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE|SS_ISDISCONNECTED);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void rip_input(struct mbuf *m, int hdrlen)
|
|||||||
if (last) {
|
if (last) {
|
||||||
struct mbuf *n;
|
struct mbuf *n;
|
||||||
if ((n = m_copym(m, 0, (int)M_COPYALL))) {
|
if ((n = m_copym(m, 0, (int)M_COPYALL))) {
|
||||||
if (sbappendaddr(&last->so_rcv, (struct sockaddr*)&ripsrc,
|
if (sockbuf_appendaddr(&last->so_rcv, (struct sockaddr*)&ripsrc,
|
||||||
n, NULL) == 0)
|
n, NULL) == 0)
|
||||||
m_freem(n);
|
m_freem(n);
|
||||||
else
|
else
|
||||||
@@ -72,7 +72,7 @@ void rip_input(struct mbuf *m, int hdrlen)
|
|||||||
last = inp->inp_socket;
|
last = inp->inp_socket;
|
||||||
}
|
}
|
||||||
if (last) {
|
if (last) {
|
||||||
if (sbappendaddr(&last->so_rcv, (struct sockaddr*)&ripsrc,
|
if (sockbuf_appendaddr(&last->so_rcv, (struct sockaddr*)&ripsrc,
|
||||||
m, NULL) == 0)
|
m, NULL) == 0)
|
||||||
m_freem(m);
|
m_freem(m);
|
||||||
else
|
else
|
||||||
@@ -150,7 +150,7 @@ int rip_userreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PRU_ABORT:
|
case PRU_ABORT:
|
||||||
soisdisconnected(so);
|
socket_set_disconnected(so);
|
||||||
case PRU_DETACH:
|
case PRU_DETACH:
|
||||||
if (inp == NULL) {
|
if (inp == NULL) {
|
||||||
printf("Can't detach from NULL protocol block!\n");
|
printf("Can't detach from NULL protocol block!\n");
|
||||||
@@ -212,14 +212,14 @@ int rip_userreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
inp->faddr = addr->sin_addr;
|
inp->faddr = addr->sin_addr;
|
||||||
soisconnected(so);
|
socket_set_connected(so);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PRU_CONNECT2:
|
case PRU_CONNECT2:
|
||||||
error = EOPNOTSUPP;
|
error = EOPNOTSUPP;
|
||||||
break;
|
break;
|
||||||
case PRU_SHUTDOWN:
|
case PRU_SHUTDOWN:
|
||||||
socantsendmore(so);
|
socket_set_cantsendmore(so);
|
||||||
break;
|
break;
|
||||||
case PRU_RCVOOB:
|
case PRU_RCVOOB:
|
||||||
case PRU_RCVD:
|
case PRU_RCVD:
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ struct tcpcb *tcp_close(struct tcpcb *tp)
|
|||||||
|
|
||||||
pool_put(tcppool, tp);
|
pool_put(tcppool, tp);
|
||||||
inp->inp_ppcb = NULL;
|
inp->inp_ppcb = NULL;
|
||||||
soisdisconnected(so);
|
socket_set_disconnected(so);
|
||||||
if (inp == tcp_last_inpcb)
|
if (inp == tcp_last_inpcb)
|
||||||
tcp_last_inpcb = &tcb;
|
tcp_last_inpcb = &tcb;
|
||||||
in_pcbdetach(inp);
|
in_pcbdetach(inp);
|
||||||
@@ -301,7 +301,7 @@ struct tcpcb *tcp_usrclosed(struct tcpcb *tp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (tp && tp->t_state >= TCPS_FIN_WAIT_2)
|
if (tp && tp->t_state >= TCPS_FIN_WAIT_2)
|
||||||
soisdisconnected(tp->t_inpcb->inp_socket);
|
socket_set_disconnected(tp->t_inpcb->inp_socket);
|
||||||
return tp;
|
return tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,8 +314,8 @@ static struct tcpcb *tcp_disconnect(struct tcpcb *tp)
|
|||||||
else if ((so->so_options & SO_LINGER) && so->so_linger == 0)
|
else if ((so->so_options & SO_LINGER) && so->so_linger == 0)
|
||||||
tp = tcp_drop(tp, 0);
|
tp = tcp_drop(tp, 0);
|
||||||
else {
|
else {
|
||||||
soisdisconnecting(so);
|
socket_set_disconnecting(so);
|
||||||
sbflush(&so->so_rcv);
|
sockbuf_flush(&so->so_rcv);
|
||||||
tp = tcp_usrclosed(tp);
|
tp = tcp_usrclosed(tp);
|
||||||
if (tp)
|
if (tp)
|
||||||
tcp_output(tp);
|
tcp_output(tp);
|
||||||
@@ -455,7 +455,7 @@ int tcp_userreq(struct socket *so, int req, struct mbuf *m,
|
|||||||
while (tp->request_r_scale < TCP_MAX_WINSHIFT &&
|
while (tp->request_r_scale < TCP_MAX_WINSHIFT &&
|
||||||
(TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat)
|
(TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat)
|
||||||
tp->request_r_scale++;
|
tp->request_r_scale++;
|
||||||
soisconnecting(so);
|
socket_set_connecting(so);
|
||||||
tcpstat.tcps_connattempt++;
|
tcpstat.tcps_connattempt++;
|
||||||
tp->t_state = TCPS_SYN_SENT;
|
tp->t_state = TCPS_SYN_SENT;
|
||||||
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
|
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
|
||||||
@@ -479,14 +479,14 @@ int tcp_userreq(struct socket *so, int req, struct mbuf *m,
|
|||||||
req |= (int)nam << 8;
|
req |= (int)nam << 8;
|
||||||
break;
|
break;
|
||||||
case PRU_SEND:
|
case PRU_SEND:
|
||||||
sbappend(&so->so_snd, m);
|
sockbuf_append(&so->so_snd, m);
|
||||||
error = tcp_output(tp);
|
error = tcp_output(tp);
|
||||||
break;
|
break;
|
||||||
case PRU_RCVD:
|
case PRU_RCVD:
|
||||||
(void) tcp_output(tp);
|
(void) tcp_output(tp);
|
||||||
break;
|
break;
|
||||||
case PRU_SHUTDOWN:
|
case PRU_SHUTDOWN:
|
||||||
socantsendmore(so);
|
socket_set_cantsendmore(so);
|
||||||
tp = tcp_usrclosed(tp);
|
tp = tcp_usrclosed(tp);
|
||||||
if (tp)
|
if (tp)
|
||||||
error = tcp_output(tp);
|
error = tcp_output(tp);
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ extern uint32 sb_max;
|
|||||||
(flags) = (ti)->ti_flags & TH_FIN; \
|
(flags) = (ti)->ti_flags & TH_FIN; \
|
||||||
tcpstat.tcps_rcvpack++; \
|
tcpstat.tcps_rcvpack++; \
|
||||||
tcpstat.tcps_rcvbyte += (ti)->ti_len; \
|
tcpstat.tcps_rcvbyte += (ti)->ti_len; \
|
||||||
sbappend(&(so)->so_rcv, (m)); \
|
sockbuf_append(&(so)->so_rcv, (m)); \
|
||||||
sorwakeup(so); \
|
sorwakeup(so); \
|
||||||
} else { \
|
} else { \
|
||||||
(flags) = tcp_reass((tp), (ti), (m)); \
|
(flags) = tcp_reass((tp), (ti), (m)); \
|
||||||
@@ -247,7 +247,7 @@ present:
|
|||||||
* So, reverse the logic and only append data if we can.
|
* So, reverse the logic and only append data if we can.
|
||||||
*/
|
*/
|
||||||
if ((so->so_state & SS_CANTRCVMORE) == 0)
|
if ((so->so_state & SS_CANTRCVMORE) == 0)
|
||||||
sbappend(&so->so_rcv, m);
|
sockbuf_append(&so->so_rcv, m);
|
||||||
} while (ti != (struct tcpiphdr*)tp && ti->ti_seq == tp->rcv_nxt);
|
} while (ti != (struct tcpiphdr*)tp && ti->ti_seq == tp->rcv_nxt);
|
||||||
sorwakeup(so);
|
sorwakeup(so);
|
||||||
return (flags);
|
return (flags);
|
||||||
@@ -554,7 +554,7 @@ findpcb:
|
|||||||
acked = ti->ti_ack - tp->snd_una;
|
acked = ti->ti_ack - tp->snd_una;
|
||||||
tcpstat.tcps_rcvackpack++;
|
tcpstat.tcps_rcvackpack++;
|
||||||
tcpstat.tcps_rcvackbyte += acked;
|
tcpstat.tcps_rcvackbyte += acked;
|
||||||
sbdrop(&so->so_snd, acked);
|
sockbuf_drop(&so->so_snd, acked);
|
||||||
tp->snd_una = ti->ti_ack;
|
tp->snd_una = ti->ti_ack;
|
||||||
m_freem(m);
|
m_freem(m);
|
||||||
|
|
||||||
@@ -597,7 +597,7 @@ findpcb:
|
|||||||
*/
|
*/
|
||||||
m->m_data += sizeof(struct tcpiphdr) + off - sizeof(struct tcphdr);
|
m->m_data += sizeof(struct tcpiphdr) + off - sizeof(struct tcphdr);
|
||||||
m->m_len -= sizeof(struct tcpiphdr) + off - sizeof(struct tcphdr);
|
m->m_len -= sizeof(struct tcpiphdr) + off - sizeof(struct tcphdr);
|
||||||
sbappend(&so->so_rcv, m);
|
sockbuf_append(&so->so_rcv, m);
|
||||||
sorwakeup(so);
|
sorwakeup(so);
|
||||||
tp->t_flags |= TF_DELACK;
|
tp->t_flags |= TF_DELACK;
|
||||||
return;
|
return;
|
||||||
@@ -777,7 +777,7 @@ findpcb:
|
|||||||
tp->t_flags |= TF_ACKNOW;
|
tp->t_flags |= TF_ACKNOW;
|
||||||
if (tiflags & TH_ACK && SEQ_GT(tp->snd_una, tp->iss)) {
|
if (tiflags & TH_ACK && SEQ_GT(tp->snd_una, tp->iss)) {
|
||||||
tcpstat.tcps_connects++;
|
tcpstat.tcps_connects++;
|
||||||
soisconnected(so);
|
socket_set_connected(so);
|
||||||
tp->t_state = TCPS_ESTABLISHED;
|
tp->t_state = TCPS_ESTABLISHED;
|
||||||
/* Do window scaling on this connection? */
|
/* Do window scaling on this connection? */
|
||||||
if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
|
if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
|
||||||
@@ -1028,7 +1028,7 @@ close:
|
|||||||
goto dropwithreset;
|
goto dropwithreset;
|
||||||
}
|
}
|
||||||
tcpstat.tcps_connects++;
|
tcpstat.tcps_connects++;
|
||||||
soisconnected(so);
|
socket_set_connected(so);
|
||||||
tp->t_state = TCPS_ESTABLISHED;
|
tp->t_state = TCPS_ESTABLISHED;
|
||||||
/* Do window scaling? */
|
/* Do window scaling? */
|
||||||
if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
|
if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
|
||||||
@@ -1168,10 +1168,10 @@ close:
|
|||||||
}
|
}
|
||||||
if (acked > so->so_snd.sb_cc) {
|
if (acked > so->so_snd.sb_cc) {
|
||||||
tp->snd_wnd -= so->so_snd.sb_cc;
|
tp->snd_wnd -= so->so_snd.sb_cc;
|
||||||
sbdrop(&so->so_snd, (int)so->so_snd.sb_cc);
|
sockbuf_drop(&so->so_snd, (int)so->so_snd.sb_cc);
|
||||||
ourfinisacked = 1;
|
ourfinisacked = 1;
|
||||||
} else {
|
} else {
|
||||||
sbdrop(&so->so_snd, acked);
|
sockbuf_drop(&so->so_snd, acked);
|
||||||
tp->snd_wnd -= acked;
|
tp->snd_wnd -= acked;
|
||||||
ourfinisacked = 0;
|
ourfinisacked = 0;
|
||||||
}
|
}
|
||||||
@@ -1198,7 +1198,7 @@ close:
|
|||||||
* we'll hang forever.
|
* we'll hang forever.
|
||||||
*/
|
*/
|
||||||
if (so->so_state & SS_CANTRCVMORE) {
|
if (so->so_state & SS_CANTRCVMORE) {
|
||||||
soisdisconnected(so);
|
socket_set_disconnected(so);
|
||||||
tp->t_timer[TCPT_2MSL] = tcp_maxidle;
|
tp->t_timer[TCPT_2MSL] = tcp_maxidle;
|
||||||
}
|
}
|
||||||
tp->t_state = TCPS_FIN_WAIT_2;
|
tp->t_state = TCPS_FIN_WAIT_2;
|
||||||
@@ -1216,7 +1216,7 @@ close:
|
|||||||
tp->t_state = TCPS_TIME_WAIT;
|
tp->t_state = TCPS_TIME_WAIT;
|
||||||
tcp_canceltimers(tp);
|
tcp_canceltimers(tp);
|
||||||
tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL;
|
tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL;
|
||||||
soisdisconnected(so);
|
socket_set_disconnected(so);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1300,7 +1300,7 @@ step6:
|
|||||||
(tp->rcv_up - tp->rcv_nxt) - 1;
|
(tp->rcv_up - tp->rcv_nxt) - 1;
|
||||||
if (so->so_oobmark == 0)
|
if (so->so_oobmark == 0)
|
||||||
so->so_state |= SS_RCVATMARK;
|
so->so_state |= SS_RCVATMARK;
|
||||||
sohasoutofband(so);
|
socket_set_hasoutofband(so);
|
||||||
tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA);
|
tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -1351,7 +1351,7 @@ dodata: /* XXX */
|
|||||||
*/
|
*/
|
||||||
if ((tiflags & TH_FIN)) {
|
if ((tiflags & TH_FIN)) {
|
||||||
if (TCPS_HAVERCVDFIN(tp->t_state) == 0) {
|
if (TCPS_HAVERCVDFIN(tp->t_state) == 0) {
|
||||||
socantrcvmore(so);
|
socket_set_cantrcvmore(so);
|
||||||
tp->t_flags |= TF_ACKNOW;
|
tp->t_flags |= TF_ACKNOW;
|
||||||
tp->rcv_nxt++;
|
tp->rcv_nxt++;
|
||||||
}
|
}
|
||||||
@@ -1381,7 +1381,7 @@ dodata: /* XXX */
|
|||||||
tp->t_state = TCPS_TIME_WAIT;
|
tp->t_state = TCPS_TIME_WAIT;
|
||||||
tcp_canceltimers(tp);
|
tcp_canceltimers(tp);
|
||||||
tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL;
|
tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL;
|
||||||
soisdisconnected(so);
|
socket_set_disconnected(so);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1691,7 +1691,7 @@ void tcp_mss_update(struct tcpcb *tp)
|
|||||||
bufsize = roundup(bufsize, mss);
|
bufsize = roundup(bufsize, mss);
|
||||||
if (bufsize > sb_max)
|
if (bufsize > sb_max)
|
||||||
bufsize = sb_max;
|
bufsize = sb_max;
|
||||||
(void)sbreserve(&so->so_snd, bufsize);
|
(void)sockbuf_reserve(&so->so_snd, bufsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RTV_RPIPE
|
#ifdef RTV_RPIPE
|
||||||
@@ -1702,7 +1702,7 @@ void tcp_mss_update(struct tcpcb *tp)
|
|||||||
bufsize = roundup(bufsize, mss);
|
bufsize = roundup(bufsize, mss);
|
||||||
if (bufsize > sb_max)
|
if (bufsize > sb_max)
|
||||||
bufsize = sb_max;
|
bufsize = sb_max;
|
||||||
(void)sbreserve(&so->so_rcv, bufsize);
|
(void)sockbuf_reserve(&so->so_rcv, bufsize);
|
||||||
#ifdef RTV_RPIPE
|
#ifdef RTV_RPIPE
|
||||||
if (rt->rt_rmx.rmx_recvpipe > 0) {
|
if (rt->rt_rmx.rmx_recvpipe > 0) {
|
||||||
tp->request_r_scale = 0;
|
tp->request_r_scale = 0;
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ else
|
|||||||
bufsize = roundup(bufsize, mss);
|
bufsize = roundup(bufsize, mss);
|
||||||
if (bufsize > sb_max)
|
if (bufsize > sb_max)
|
||||||
bufsize = sb_max;
|
bufsize = sb_max;
|
||||||
sbreserve(&so->so_snd, bufsize);
|
sockbuf_reserve(&so->so_snd, bufsize);
|
||||||
}
|
}
|
||||||
tp->t_maxseg = mss;
|
tp->t_maxseg = mss;
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ else
|
|||||||
bufsize = roundup(bufsize, mss);
|
bufsize = roundup(bufsize, mss);
|
||||||
if (bufsize > sb_max)
|
if (bufsize > sb_max)
|
||||||
bufsize = sb_max;
|
bufsize = sb_max;
|
||||||
sbreserve(&so->so_rcv, bufsize);
|
sockbuf_reserve(&so->so_rcv, bufsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tp->snd_cwnd = mss;
|
tp->snd_cwnd = mss;
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ int udp_userreq(struct socket *so, int req,
|
|||||||
}
|
}
|
||||||
error = in_pcbconnect(inp, addr);
|
error = in_pcbconnect(inp, addr);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
soisconnected(so);
|
socket_set_connected(so);
|
||||||
break;
|
break;
|
||||||
case PRU_CONNECT2:
|
case PRU_CONNECT2:
|
||||||
error = EINVAL;//EOPNOTSUPP;
|
error = EINVAL;//EOPNOTSUPP;
|
||||||
@@ -304,7 +304,7 @@ void udp_input(struct mbuf *buf, int hdrlen)
|
|||||||
buf->m_pkthdr.len -= hdrlen;
|
buf->m_pkthdr.len -= hdrlen;
|
||||||
buf->m_data += hdrlen;
|
buf->m_data += hdrlen;
|
||||||
|
|
||||||
if (sbappendaddr(&inp->inp_socket->so_rcv, (struct sockaddr*)&udp_in,
|
if (sockbuf_appendaddr(&inp->inp_socket->so_rcv, (struct sockaddr*)&udp_in,
|
||||||
buf, opts) == 0) {
|
buf, opts) == 0) {
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user