Skip to content

Commit

Permalink
xnu-344.32
Browse files Browse the repository at this point in the history
  • Loading branch information
Darwin authored and das committed Jun 4, 2017
1 parent a002595 commit dcccffa
Show file tree
Hide file tree
Showing 34 changed files with 351 additions and 161 deletions.
2 changes: 1 addition & 1 deletion bsd/conf/version.minor
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4
5
17 changes: 17 additions & 0 deletions bsd/hfs/hfs_readwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,7 @@ hfs_cmap(ap)
return (0);

p = current_proc();
retry:
if (fp->ff_unallocblocks) {
lockExtBtree = 1;

Expand Down Expand Up @@ -1036,6 +1037,22 @@ hfs_cmap(ap)
if (fp->ff_unallocblocks) {
SInt64 reqbytes, actbytes;

//
// Make sure we have a transaction. It's possible
// that we came in and fp->ff_unallocblocks was zero
// but during the time we blocked acquiring the extents
// btree, ff_unallocblocks became non-zero and so we
// will need to start a transaction.
//
if (hfsmp->jnl && started_tr == 0) {
if (lockExtBtree) {
(void) hfs_metafilelocking(hfsmp, kHFSExtentsFileID, LK_RELEASE, p);
lockExtBtree = 0;
}

goto retry;
}

reqbytes = (SInt64)fp->ff_unallocblocks *
(SInt64)HFSTOVCB(hfsmp)->blockSize;
/*
Expand Down
2 changes: 2 additions & 0 deletions bsd/kern/sysctl_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ extern struct sysctl_oid sysctl__net_inet_tcp_keepintvl;
extern struct sysctl_oid sysctl__net_inet_tcp_mssdflt;
extern struct sysctl_oid sysctl__net_inet_tcp_recvspace;
extern struct sysctl_oid sysctl__net_inet_tcp_sendspace;
extern struct sysctl_oid sysctl__net_inet_tcp_slowlink_wsize;
extern struct sysctl_oid sysctl__net_inet_tcp_blackhole;
extern struct sysctl_oid sysctl__net_inet_tcp_tcp_lq_overflow;
extern struct sysctl_oid sysctl__net_inet_tcp_path_mtu_discovery;
Expand Down Expand Up @@ -442,6 +443,7 @@ struct sysctl_oid *newsysctl_list[] =
,&sysctl__net_inet_tcp_mssdflt
,&sysctl__net_inet_tcp_recvspace
,&sysctl__net_inet_tcp_sendspace
,&sysctl__net_inet_tcp_slowlink_wsize
,&sysctl__net_inet_tcp_blackhole
,&sysctl__net_inet_tcp_tcp_lq_overflow
,&sysctl__net_inet_tcp_path_mtu_discovery
Expand Down
2 changes: 1 addition & 1 deletion bsd/net/if.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,6 @@ void if_rtproto_del(struct ifnet *ifp, int protocol)

struct radix_node_head *rnh;

if (((rnh = rt_tables[protocol]) != NULL) && (ifp != NULL))
if ((protocol <= AF_MAX) && ((rnh = rt_tables[protocol]) != NULL) && (ifp != NULL))
(void) rnh->rnh_walktree(rnh, if_rtdel, ifp);
}
37 changes: 35 additions & 2 deletions bsd/netinet/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
#include <kern/cpu_number.h> /* before tcp_seq.h, for tcp_random18() */

#include <net/if.h>
#include <net/if_types.h>
#include <net/route.h>

#include <netinet/in.h>
Expand Down Expand Up @@ -158,6 +159,11 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, drop_synfin, CTLFLAG_RW,
&drop_synfin, 0, "Drop TCP packets with SYN+FIN set");
#endif

__private_extern__ int slowlink_wsize = 8192;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, slowlink_wsize, CTLFLAG_RW,
&slowlink_wsize, 0, "Maximum advertised window size for slowlink");


u_long tcp_now;
struct inpcbhead tcb;
#define tcb6 tcb /* for KAME src sync over BSD*'s */
Expand Down Expand Up @@ -1135,6 +1141,10 @@ tcp_input(m, off0)
win = sbspace(&so->so_rcv);
if (win < 0)
win = 0;
else { /* clip rcv window to 4K for modems */
if (tp->t_flags & TF_SLOWLINK && slowlink_wsize > 0)
win = min(win, slowlink_wsize);
}
tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt));
}

Expand Down Expand Up @@ -1317,7 +1327,10 @@ tcp_input(m, off0)
* here. Even if we requested window scaling, it will
* become effective only later when our SYN is acked.
*/
tp->rcv_adv += min(tp->rcv_wnd, TCP_MAXWIN);
if (tp->t_flags & TF_SLOWLINK && slowlink_wsize > 0) /* clip window size for for slow link */
tp->rcv_adv += min(tp->rcv_wnd, slowlink_wsize);
else
tp->rcv_adv += min(tp->rcv_wnd, TCP_MAXWIN);
tcpstat.tcps_connects++;
soisconnected(so);
tp->t_timer[TCPT_KEEP] = tcp_keepinit;
Expand Down Expand Up @@ -2116,10 +2129,10 @@ tcp_input(m, off0)
tp->snd_wnd -= acked;
ourfinisacked = 0;
}
sowwakeup(so);
tp->snd_una = th->th_ack;
if (SEQ_LT(tp->snd_nxt, tp->snd_una))
tp->snd_nxt = tp->snd_una;
sowwakeup(so);

switch (tp->t_state) {

Expand Down Expand Up @@ -2841,6 +2854,16 @@ tcp_mss(tp, offer)
return;
}
ifp = rt->rt_ifp;
/*
* Slower link window correction:
* If a value is specificied for slowlink_wsize use it for PPP links
* believed to be on a serial modem (speed <128Kbps). Excludes 9600bps as
* it is the default value adversized by pseudo-devices over ppp.
*/
if (ifp->if_type == IFT_PPP && slowlink_wsize > 0 &&
ifp->if_baudrate > 9600 && ifp->if_baudrate <= 128000) {
tp->t_flags |= TF_SLOWLINK;
}
so = inp->inp_socket;

taop = rmx_taop(rt->rt_rmx);
Expand Down Expand Up @@ -3047,6 +3070,16 @@ tcp_mssopt(tp)
isipv6 ? tcp_v6mssdflt :
#endif /* INET6 */
tcp_mssdflt;
/*
* Slower link window correction:
* If a value is specificied for slowlink_wsize use it for PPP links
* believed to be on a serial modem (speed <128Kbps). Excludes 9600bps as
* it is the default value adversized by pseudo-devices over ppp.
*/
if (rt->rt_ifp->if_type == IFT_PPP && slowlink_wsize > 0 &&
rt->rt_ifp->if_baudrate > 9600 && rt->rt_ifp->if_baudrate <= 128000) {
tp->t_flags |= TF_SLOWLINK;
}

return rt->rt_ifp->if_mtu - min_protoh;
}
Expand Down
23 changes: 19 additions & 4 deletions bsd/netinet/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int ss_fltsz = 1;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, slowstart_flightsize, CTLFLAG_RW,
&ss_fltsz, 1, "Slow start flight size");

int ss_fltsz_local = TCP_MAXWIN; /* something large */
int ss_fltsz_local = 4; /* starts with four segments max */
SYSCTL_INT(_net_inet_tcp, OID_AUTO, local_slowstart_flightsize, CTLFLAG_RW,
&ss_fltsz_local, 1, "Slow start flight size for local networks");

Expand All @@ -129,6 +129,8 @@ struct mbuf *m_copym_with_hdrs __P((struct mbuf*, int, int, int, struct mbuf**,
extern int ipsec_bypass;
#endif

extern int slowlink_wsize; /* window correction for slow links */

/*
* Tcp output routine: figure out what should be sent and send it.
*/
Expand Down Expand Up @@ -219,6 +221,8 @@ tcp_output(tp)
sendalot = 0;
off = tp->snd_nxt - tp->snd_una;
win = min(tp->snd_wnd, tp->snd_cwnd);
if (tp->t_flags & TF_SLOWLINK && slowlink_wsize > 0)
win = min(win, slowlink_wsize);

flags = tcp_outflags[tp->t_state];
/*
Expand Down Expand Up @@ -325,7 +329,10 @@ tcp_output(tp)
if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + so->so_snd.sb_cc))
flags &= ~TH_FIN;

win = sbspace(&so->so_rcv);
if (tp->t_flags & TF_SLOWLINK && slowlink_wsize > 0 ) /* Clips window size for slow links */
win = min(sbspace(&so->so_rcv), slowlink_wsize);
else
win = sbspace(&so->so_rcv);

/*
* Sender silly window avoidance. If connection is idle
Expand Down Expand Up @@ -795,9 +802,17 @@ tcp_output(tp)
win = 0;
if (win < (long)(tp->rcv_adv - tp->rcv_nxt))
win = (long)(tp->rcv_adv - tp->rcv_nxt);
if (win > (long)TCP_MAXWIN << tp->rcv_scale)
if (tp->t_flags & TF_SLOWLINK && slowlink_wsize > 0) {
if (win > (long)slowlink_wsize)
win = slowlink_wsize;
th->th_win = htons((u_short) (win>>tp->rcv_scale));
}
else {

if (win > (long)TCP_MAXWIN << tp->rcv_scale)
win = (long)TCP_MAXWIN << tp->rcv_scale;
th->th_win = htons((u_short) (win>>tp->rcv_scale));
th->th_win = htons((u_short) (win>>tp->rcv_scale));
}
if (SEQ_GT(tp->snd_up, tp->snd_nxt)) {
th->th_urp = htons((u_short)(tp->snd_up - tp->snd_nxt));
th->th_flags |= TH_URG;
Expand Down
1 change: 1 addition & 0 deletions bsd/netinet/tcp_var.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ struct tcpcb {
#define TF_MORETOCOME 0x10000 /* More data to be appended to sock */
#define TF_LQ_OVERFLOW 0x20000 /* listen queue overflow */
#define TF_RXWIN0SENT 0x40000 /* sent a receiver win 0 in response */
#define TF_SLOWLINK 0x80000 /* route is a on a modem speed link */

int t_force; /* 1 if forcing out a byte */

Expand Down
2 changes: 1 addition & 1 deletion bsd/netinet6/ipsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -3384,7 +3384,7 @@ ipsec_copypkt(m)
*/
if (
n->m_ext.ext_free ||
mclrefcnt[mtocl(n->m_ext.ext_buf)] > 1
m_mclhasreference(n)
)
{
int remain, copied;
Expand Down
14 changes: 13 additions & 1 deletion bsd/nfs/nfs_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,10 @@ nfs_reply(myrep)
FSDBG(530, myrep->r_xid, myrep, nmp, error);
nfs_rcvunlock(&nmp->nm_flag);

/* Bailout asap if nfsmount struct gone (unmounted). */
if (!myrep->r_nmp || !nmp->nm_so)
return (ECONNABORTED);

/*
* Ignore routing errors on connectionless protocols??
*/
Expand Down Expand Up @@ -1996,9 +2000,17 @@ static int
nfs_rcvlock(rep)
register struct nfsreq *rep;
{
register int *flagp = &rep->r_nmp->nm_flag;
register int *flagp;
int slpflag, slptimeo = 0;

/* make sure we still have our mountpoint */
if (!rep->r_nmp) {
if (rep->r_mrep != NULL)
return (EALREADY);
return (ECONNABORTED);
}

flagp = &rep->r_nmp->nm_flag;
FSDBG_TOP(534, rep->r_xid, rep, rep->r_nmp, *flagp);
if (*flagp & NFSMNT_INT)
slpflag = PCATCH;
Expand Down
28 changes: 19 additions & 9 deletions bsd/vfs/vfs_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,24 +143,28 @@ mount(p, uap, retval)
return (EINVAL);
}
mp = vp->v_mount;
flag = mp->mnt_flag;

if (vfs_busy(mp, LK_NOWAIT, 0, p)) {
vput(vp);
return (EBUSY);
}
/*
* We only allow the filesystem to be reloaded if it
* is currently mounted read-only.
*/
if ((uap->flags & MNT_RELOAD) &&
((mp->mnt_flag & MNT_RDONLY) == 0)) {
vfs_unbusy(mp, p);
vput(vp);
return (EOPNOTSUPP); /* Needs translation */
}
mp->mnt_flag |=
uap->flags & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE);
/*
* Only root, or the user that did the original mount is
* permitted to update it.
*/
if (mp->mnt_stat.f_owner != p->p_ucred->cr_uid &&
(error = suser(p->p_ucred, &p->p_acflag))) {
vfs_unbusy(mp, p);
vput(vp);
return (error);
}
Expand All @@ -171,18 +175,21 @@ mount(p, uap, retval)
*/
if (p->p_ucred->cr_uid != 0) {
if (uap->flags & MNT_EXPORTED) {
vfs_unbusy(mp, p);
vput(vp);
return (EPERM);
}
uap->flags |= MNT_NOSUID | MNT_NODEV;
if (flag & MNT_NOEXEC)
if (mp->mnt_flag & MNT_NOEXEC)
uap->flags |= MNT_NOEXEC;
}
if (vfs_busy(mp, LK_NOWAIT, 0, p)) {
vput(vp);
return (EBUSY);
}
flag = mp->mnt_flag;

mp->mnt_flag |=
uap->flags & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE);

VOP_UNLOCK(vp, 0, p);

goto update;
}
/*
Expand Down Expand Up @@ -296,7 +303,8 @@ mount(p, uap, retval)
* Mount the filesystem.
*/
error = VFS_MOUNT(mp, uap->path, uap->data, &nd, p);
if (mp->mnt_flag & MNT_UPDATE) {

if (uap->flags & MNT_UPDATE) {
vrele(vp);
if (mp->mnt_kern_flag & MNTK_WANTRDWR)
mp->mnt_flag &= ~MNT_RDONLY;
Expand Down Expand Up @@ -324,6 +332,7 @@ mount(p, uap, retval)
vp->v_mountedhere =mp;
simple_unlock(&vp->v_interlock);
simple_lock(&mountlist_slock);

CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
simple_unlock(&mountlist_slock);
checkdirs(vp);
Expand Down Expand Up @@ -544,6 +553,7 @@ dounmount(mp, flags, p)
/* increment the operations count */
if (!error)
vfs_nummntops++;

CIRCLEQ_REMOVE(&mountlist, mp, mnt_list);
if ((coveredvp = mp->mnt_vnodecovered) != NULLVP) {
coveredvp->v_mountedhere = (struct mount *)0;
Expand Down
8 changes: 4 additions & 4 deletions config/System.kext/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleGetInfoString</key>
<string>System Resource Pseudoextension, Apple Computer Inc, 6.4</string>
<string>System Resource Pseudoextension, Apple Computer Inc, 6.5</string>
<key>CFBundleIdentifier</key>
<string>com.apple.kernel</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -15,13 +15,13 @@
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>6.4</string>
<string>6.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>6.4</string>
<string>6.5</string>
<key>OSBundleCompatibleVersion</key>
<string>6.4</string>
<string>6.5</string>
<key>OSBundleRequired</key>
<string>Root</string>
<key>OSKernelResource</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleGetInfoString</key>
<string>AppleNMI Pseudoextension, Apple Computer Inc, 6.4</string>
<string>AppleNMI Pseudoextension, Apple Computer Inc, 6.5</string>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AppleNMI</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand All @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>6.4</string>
<string>6.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>6.4</string>
<string>6.5</string>
<key>OSBundleRequired</key>
<string>Root</string>
<key>OSKernelResource</key>
Expand Down
Loading

0 comments on commit dcccffa

Please sign in to comment.