This commit is contained in:
attilio 2011-05-08 14:56:02 +00:00
commit 7ff10cb598
44 changed files with 1148 additions and 578 deletions

View File

@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <wchar.h>
/*
* Routines to expand arguments to commands. We have to deal with
@ -111,16 +112,16 @@ static void addfname(char *);
static struct strlist *expsort(struct strlist *);
static struct strlist *msort(struct strlist *, int);
static char *cvtnum(int, char *);
static int collate_range_cmp(int, int);
static int collate_range_cmp(wchar_t, wchar_t);
static int
collate_range_cmp(int c1, int c2)
collate_range_cmp(wchar_t c1, wchar_t c2)
{
static char s1[2], s2[2];
static wchar_t s1[2], s2[2];
s1[0] = c1;
s2[0] = c2;
return (strcoll(s1, s2));
return (wcscoll(s1, s2));
}
/*
@ -1377,6 +1378,23 @@ msort(struct strlist *list, int len)
static wchar_t
get_wc(const char **p)
{
wchar_t c;
int chrlen;
chrlen = mbtowc(&c, *p, 4);
if (chrlen == 0)
return 0;
else if (chrlen == -1)
c = 0;
else
*p += chrlen;
return c;
}
/*
* Returns true if the pattern matches the string.
*/
@ -1386,6 +1404,7 @@ patmatch(const char *pattern, const char *string, int squoted)
{
const char *p, *q;
char c;
wchar_t wc, wc2;
p = pattern;
q = string;
@ -1404,7 +1423,11 @@ patmatch(const char *pattern, const char *string, int squoted)
case '?':
if (squoted && *q == CTLESC)
q++;
if (*q++ == '\0')
if (localeisutf8)
wc = get_wc(&q);
else
wc = *q++;
if (wc == '\0')
return 0;
break;
case '*':
@ -1434,7 +1457,7 @@ patmatch(const char *pattern, const char *string, int squoted)
case '[': {
const char *endp;
int invert, found;
char chr;
wchar_t chr;
endp = p;
if (*endp == '!' || *endp == '^')
@ -1455,8 +1478,11 @@ patmatch(const char *pattern, const char *string, int squoted)
p++;
}
found = 0;
chr = *q++;
if (squoted && chr == CTLESC)
if (squoted && *q == CTLESC)
q++;
if (localeisutf8)
chr = get_wc(&q);
else
chr = *q++;
if (chr == '\0')
return 0;
@ -1466,19 +1492,31 @@ patmatch(const char *pattern, const char *string, int squoted)
continue;
if (c == CTLESC)
c = *p++;
if (localeisutf8 && c & 0x80) {
p--;
wc = get_wc(&p);
if (wc == 0) /* bad utf-8 */
return 0;
} else
wc = c;
if (*p == '-' && p[1] != ']') {
p++;
while (*p == CTLQUOTEMARK)
p++;
if (*p == CTLESC)
p++;
if ( collate_range_cmp(chr, c) >= 0
&& collate_range_cmp(chr, *p) <= 0
if (localeisutf8) {
wc2 = get_wc(&p);
if (wc2 == 0) /* bad utf-8 */
return 0;
} else
wc2 = *p++;
if ( collate_range_cmp(chr, wc) >= 0
&& collate_range_cmp(chr, wc2) <= 0
)
found = 1;
p++;
} else {
if (chr == c)
if (chr == wc)
found = 1;
}
} while ((c = *p++) != ']');

View File

@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd May 5, 2011
.Dd May 8, 2011
.Dt SH 1
.Os
.Sh NAME
@ -2591,4 +2591,9 @@ was originally written by
.Sh BUGS
The
.Nm
utility does not recognize multibyte characters.
utility does not recognize multibyte characters other than UTF-8.
Splitting using
.Va IFS
and the line editing library
.Xr editline 3
do not recognize multibyte characters.

View File

@ -33,13 +33,13 @@ nfsd_precmd()
else
rc_flags="${nfs_server_flags}"
# Load the modules now, so that the vfs.newnfs sysctl
# Load the modules now, so that the vfs.nfsd sysctl
# oids are available.
load_kld nfsd
if checkyesno nfs_reserved_port_only; then
echo 'NFS on reserved port only=YES'
sysctl vfs.newnfs.nfs_privport=1 > /dev/null
sysctl vfs.nfsd.nfs_privport=1 > /dev/null
fi
if checkyesno nfsv4_server_enable; then
@ -52,7 +52,7 @@ nfsd_precmd()
fi
else
echo 'NFSv4 is disabled'
sysctl vfs.newnfs.server_max_nfsvers=3 > /dev/null
sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null
fi
fi

View File

@ -28,12 +28,12 @@
.\" @(#)dumpfs.8 8.1 (Berkeley) 6/5/93
.\" $FreeBSD$
.\"
.Dd January 28, 2009
.Dd May 8, 2011
.Dt DUMPFS 8
.Os
.Sh NAME
.Nm dumpfs
.Nd dump file system information
.Nd dump UFS file system information
.Sh SYNOPSIS
.Nm
.Op Fl f
@ -42,7 +42,7 @@
.Sh DESCRIPTION
The
.Nm
utility prints out the super block and cylinder group information
utility prints out the UFS super block and cylinder group information
for the file system or special device specified, unless the
.Fl f
or

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 2005-2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
.\" Copyright (c) 2005-2011 Pawel Jakub Dawidek <pawel@dawidek.net>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@ -627,9 +627,13 @@ variables can be used to control the behavior of the
.Nm ELI
GEOM class.
The default value is shown next to each variable.
All variables can also be set in
Some variables can also be set in
.Pa /boot/loader.conf .
.Bl -tag -width indent
.It Va kern.geom.eli.version
Version number of the
.Nm ELI
GEOM class.
.It Va kern.geom.eli.debug : No 0
Debug level of the
.Nm ELI
@ -668,6 +672,22 @@ When set to 1, can speed-up crypto operations by using batching.
Batching allows to reduce number of interrupts by responding on a group of
crypto requests with one interrupt.
The crypto card and the driver has to support this feature.
.It Va kern.geom.eli.key_cache_limit : No 8192
Specifies how many encryption keys to cache.
The default limit
.No ( 8192
keys) will allow to cache all keys for 4TB provider with 512 bytes sectors and
will take around 1MB of memory.
.It Va kern.geom.eli.key_cache_hits
Reports how many times we were looking up a key and it was already in cache.
This sysctl is not updated for providers that need less keys than the limit
specified in
.Va kern.geom.eli.key_cache_limit .
.It Va kern.geom.eli.key_cache_misses
Reports how many times we were looking up a key and it was not in cache.
This sysctl is not updated for providers that need less keys than the limit
specified in
.Va kern.geom.eli.key_cache_limit .
.El
.Sh EXIT STATUS
Exit status is 0 on success, and 1 if the command fails.

View File

@ -37,12 +37,12 @@
.\" $TSHeader: src/sbin/growfs/growfs.8,v 1.3 2000/12/12 19:31:00 tomsoft Exp $
.\" $FreeBSD$
.\"
.Dd September 8, 2000
.Dd May 8, 2011
.Dt GROWFS 8
.Os
.Sh NAME
.Nm growfs
.Nd grow size of an existing ufs file system
.Nd grow size of an existing UFS file system
.Sh SYNOPSIS
.Nm
.Op Fl Ny

View File

@ -92,8 +92,10 @@ isitme(const char *name)
* Now check if it matches first part of the host name.
*/
pos = strchr(buf, '.');
if (pos != NULL && pos != buf && strncmp(buf, name, pos - buf) == 0)
if (pos != NULL && (size_t)(pos - buf) == strlen(name) &&
strncmp(buf, name, pos - buf) == 0) {
return (1);
}
/*
* At the end check if name is equal to our host's UUID.
@ -287,6 +289,7 @@ yy_config_free(struct hastd_config *config)
%token FULLSYNC MEMSYNC ASYNC NONE CRC32 SHA256 HOLE LZF
%token NUM STR OB CB
%type <str> remote_str
%type <num> replication_type
%type <num> checksum_type
%type <num> compression_type
@ -794,7 +797,7 @@ resource_node_entry:
source_statement
;
remote_statement: REMOTE STR
remote_statement: REMOTE remote_str
{
assert(depth == 2);
if (mynode) {
@ -811,6 +814,12 @@ remote_statement: REMOTE STR
}
;
remote_str:
NONE { $$ = strdup("none"); }
|
STR { }
;
source_statement: SOURCE STR
{
assert(depth == 2);

View File

@ -28,12 +28,12 @@
.\" @(#)tunefs.8 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
.Dd December 9, 2010
.Dd May 8, 2011
.Dt TUNEFS 8
.Os
.Sh NAME
.Nm tunefs
.Nd tune up an existing file system
.Nd tune up an existing UFS file system
.Sh SYNOPSIS
.Nm
.Op Fl A
@ -56,7 +56,7 @@
.Sh DESCRIPTION
The
.Nm
utility is designed to change the dynamic parameters of a file system
utility is designed to change the dynamic parameters of a UFS file system
which affect the layout policies.
The
.Nm

View File

@ -95,10 +95,10 @@
#define AR5416_OPFLAGS_11A 0x01
#define AR5416_OPFLAGS_11G 0x02
#define AR5416_OPFLAGS_5G_HT40 0x04
#define AR5416_OPFLAGS_2G_HT40 0x08
#define AR5416_OPFLAGS_5G_HT20 0x10
#define AR5416_OPFLAGS_2G_HT20 0x20
#define AR5416_OPFLAGS_N_5G_HT40 0x04 /* If set, disable 5G HT40 */
#define AR5416_OPFLAGS_N_2G_HT40 0x08
#define AR5416_OPFLAGS_N_5G_HT20 0x10
#define AR5416_OPFLAGS_N_2G_HT20 0x20
/* RF silent fields in EEPROM */
#define EEP_RFSILENT_ENABLED 0x0001 /* enabled/disabled */

View File

@ -286,6 +286,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMODE opmode,
ar5416InitIMR(ah, opmode);
ar5212SetCoverageClass(ah, AH_PRIVATE(ah)->ah_coverageClass, 1);
ar5416InitQoS(ah);
/* This may override the AR_DIAG_SW register */
ar5416InitUserSettings(ah);
/*
@ -520,7 +521,6 @@ ar5416InitBB(struct ath_hal *ah, const struct ieee80211_channel *chan)
/* Turn on PLL on 5416 */
HALDEBUG(ah, HAL_DEBUG_RESET, "%s %s channel\n",
__func__, IEEE80211_IS_CHAN_5GHZ(chan) ? "5GHz" : "2GHz");
AH5416(ah)->ah_initPLL(ah, chan);
/* Activate the PHY (includes baseband activate and synthesizer on) */
OS_REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN);
@ -673,6 +673,10 @@ ar5416ChipReset(struct ath_hal *ah, const struct ieee80211_channel *chan)
if (!ar5416SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE))
return AH_FALSE;
#ifdef notyet
ahp->ah_chipFullSleep = AH_FALSE;
#endif
AH5416(ah)->ah_initPLL(ah, chan);
/*
@ -681,8 +685,7 @@ ar5416ChipReset(struct ath_hal *ah, const struct ieee80211_channel *chan)
* with an active radio can result in corrupted shifts to the
* radio device.
*/
if (chan != AH_NULL)
ar5416SetRfMode(ah, chan);
ar5416SetRfMode(ah, chan);
return AH_TRUE;
}
@ -1102,7 +1105,11 @@ ar5416Disable(struct ath_hal *ah)
{
if (!ar5212SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE))
return AH_FALSE;
return ar5416SetResetReg(ah, HAL_RESET_COLD);
if (! ar5416SetResetReg(ah, HAL_RESET_COLD))
return AH_FALSE;
AH5416(ah)->ah_initPLL(ah, AH_NULL);
return AH_TRUE;
}
/*
@ -1114,7 +1121,11 @@ ar5416Disable(struct ath_hal *ah)
HAL_BOOL
ar5416PhyDisable(struct ath_hal *ah)
{
return ar5416SetResetReg(ah, HAL_RESET_WARM);
if (! ar5416SetResetReg(ah, HAL_RESET_WARM))
return AH_FALSE;
AH5416(ah)->ah_initPLL(ah, AH_NULL);
return AH_TRUE;
}
/*
@ -1277,34 +1288,52 @@ ar5416SetReset(struct ath_hal *ah, int type)
}
}
AH5416(ah)->ah_initPLL(ah, AH_NULL);
return AH_TRUE;
}
void
ar5416InitChainMasks(struct ath_hal *ah)
{
if (AH5416(ah)->ah_rx_chainmask == 0x5 ||
AH5416(ah)->ah_tx_chainmask == 0x5)
OS_REG_WRITE(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN);
/* Setup Chain Masks */
OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, AH5416(ah)->ah_rx_chainmask);
OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, AH5416(ah)->ah_rx_chainmask);
int rx_chainmask = AH5416(ah)->ah_rx_chainmask;
if (rx_chainmask)
OS_REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN);
/*
* Workaround for OWL 1.0 calibration failure; enable multi-chain;
* then set true mask after calibration.
*/
if (IS_5416V1(ah) && (rx_chainmask == 0x5 || rx_chainmask == 0x3)) {
OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, 0x7);
OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, 0x7);
} else {
OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, AH5416(ah)->ah_rx_chainmask);
OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, AH5416(ah)->ah_rx_chainmask);
}
OS_REG_WRITE(ah, AR_SELFGEN_MASK, AH5416(ah)->ah_tx_chainmask);
if (AH5416(ah)->ah_tx_chainmask == 0x5)
OS_REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN);
if (AR_SREV_HOWL(ah)) {
OS_REG_WRITE(ah, AR_PHY_ANALOG_SWAP,
OS_REG_READ(ah, AR_PHY_ANALOG_SWAP) | 0x00000001);
}
}
/*
* Work-around for Owl 1.0 calibration failure.
*
* ar5416InitChainMasks sets the RX chainmask to 0x7 if it's Owl 1.0
* due to init calibration failures. ar5416RestoreChainMask restores
* these registers to the correct setting.
*/
void
ar5416RestoreChainMask(struct ath_hal *ah)
{
int rx_chainmask = AH5416(ah)->ah_rx_chainmask;
if ((rx_chainmask == 0x5) || (rx_chainmask == 0x3)) {
if (IS_5416V1(ah) && (rx_chainmask == 0x5 || rx_chainmask == 0x3)) {
OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx_chainmask);
OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx_chainmask);
}
@ -2488,17 +2517,17 @@ ar5416OverrideIni(struct ath_hal *ah, const struct ieee80211_channel *chan)
*/
OS_REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
if (AR_SREV_MERLIN_20_OR_LATER(ah)) {
val = OS_REG_READ(ah, AR_PCU_MISC_MODE2);
if (AR_SREV_MERLIN_10_OR_LATER(ah)) {
val = OS_REG_READ(ah, AR_PCU_MISC_MODE2);
val &= (~AR_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE);
if (!AR_SREV_9271(ah))
val &= ~AR_PCU_MISC_MODE2_HWWAR1;
if (!AR_SREV_9271(ah))
val &= ~AR_PCU_MISC_MODE2_HWWAR1;
if (AR_SREV_9287_11_OR_LATER(ah))
val = val & (~AR_PCU_MISC_MODE2_HWWAR2);
if (AR_SREV_9287_11_OR_LATER(ah))
val = val & (~AR_PCU_MISC_MODE2_HWWAR2);
OS_REG_WRITE(ah, AR_PCU_MISC_MODE2, val);
}
OS_REG_WRITE(ah, AR_PCU_MISC_MODE2, val);
}
/*
* Disable RIFS search on some chips to avoid baseband

View File

@ -535,6 +535,12 @@
#define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002
#define AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT 0x00000004
/*
* This bit enables the Multicast search based on both MAC Address and Key ID.
* If bit is 0, then Multicast search is based on MAC address only.
* For Merlin and above only.
*/
#define AR_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE 0x00000040
#define AR_PCU_MISC_MODE2_HWWAR1 0x00100000
#define AR_PCU_MISC_MODE2_HWWAR2 0x02000000

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,9 @@
#define IWN4965_NTXQUEUES 16
#define IWN5000_NTXQUEUES 20
#define IWN4965_FIRSTAGGQUEUE 7
#define IWN5000_FIRSTAGGQUEUE 10
#define IWN4965_NDMACHNLS 7
#define IWN5000_NDMACHNLS 8
@ -489,6 +492,10 @@ struct iwn_rxon {
#define IWN_RXON_ANTENNA_A (1 << 8)
#define IWN_RXON_ANTENNA_B (1 << 9)
#define IWN_RXON_TSF (1 << 15)
#define IWN_RXON_HT_HT40MINUS (1 << 22)
#define IWN_RXON_HT_PROTMODE(x) (x << 23)
#define IWN_RXON_HT_MODEPURE40 (1 << 25)
#define IWN_RXON_HT_MODEMIXED (2 << 25)
#define IWN_RXON_CTS_TO_SELF (1 << 30)
uint32_t filter;
@ -588,7 +595,10 @@ struct iwn_node_info {
uint8_t txmic[8];
uint32_t htflags;
#define IWN_SMPS_MIMO_PROT (1 << 17)
#define IWN_AMDPU_SIZE_FACTOR(x) ((x) << 19)
#define IWN_NODE_HT40 (1 << 21)
#define IWN_SMPS_MIMO_DIS (1 << 22)
#define IWN_AMDPU_DENSITY(x) ((x) << 23)
uint32_t mask;
@ -625,8 +635,13 @@ struct iwn4965_node_info {
uint32_t reserved7;
} __packed;
#define IWN_RFLAG_CCK (1 << 1)
#define IWN_RFLAG_ANT(x) ((x) << 6)
#define IWN_RFLAG_MCS (1 << 8)
#define IWN_RFLAG_CCK (1 << 9)
#define IWN_RFLAG_GREENFIELD (1 << 10)
#define IWN_RFLAG_HT40 (1 << 11)
#define IWN_RFLAG_DUPLICATE (1 << 12)
#define IWN_RFLAG_SGI (1 << 13)
#define IWN_RFLAG_ANT(x) ((x) << 14)
/* Structure for command IWN_CMD_TX_DATA. */
struct iwn_cmd_data {
@ -647,9 +662,7 @@ struct iwn_cmd_data {
#define IWN_TX_NEED_PADDING (1 << 20)
uint32_t scratch;
uint8_t plcp;
uint8_t rflags;
uint16_t xrflags;
uint32_t rate;
uint8_t id;
uint8_t security;
@ -690,11 +703,7 @@ struct iwn_cmd_link_quality {
uint8_t ampdu_threshold;
uint8_t ampdu_max;
uint32_t reserved2;
struct {
uint8_t plcp;
uint8_t rflags;
uint16_t xrflags;
} __packed retry[IWN_MAX_TX_RETRIES];
uint32_t retry[IWN_MAX_TX_RETRIES];
uint32_t reserved3;
} __packed;
@ -1065,9 +1074,7 @@ struct iwn4965_tx_stat {
uint8_t btkillcnt;
uint8_t rtsfailcnt;
uint8_t ackfailcnt;
uint8_t rate;
uint8_t rflags;
uint16_t xrflags;
uint32_t rate;
uint16_t duration;
uint16_t reserved;
uint32_t power[2];
@ -1079,9 +1086,7 @@ struct iwn5000_tx_stat {
uint8_t btkillcnt;
uint8_t rtsfailcnt;
uint8_t ackfailcnt;
uint8_t rate;
uint8_t rflags;
uint16_t xrflags;
uint32_t rate;
uint16_t duration;
uint16_t reserved;
uint32_t power[2];
@ -1136,9 +1141,7 @@ struct iwn_rx_stat {
uint16_t chan;
uint8_t phybuf[32];
uint8_t rate;
uint8_t rflags;
uint16_t xrflags;
uint32_t rate;
uint16_t len;
uint16_t reserve3;
} __packed;
@ -1403,6 +1406,7 @@ struct iwn_fw_tlv {
#define IWN5000_EEPROM_BAND4 0x02e
#define IWN5000_EEPROM_BAND5 0x03a
#define IWN5000_EEPROM_BAND6 0x041
#define IWN6000_EEPROM_BAND6 0x040
#define IWN5000_EEPROM_BAND7 0x049
#define IWN6000_EEPROM_ENHINFO 0x054
#define IWN5000_EEPROM_CRYSTAL 0x128
@ -1432,7 +1436,17 @@ struct iwn_eeprom_chan {
} __packed;
struct iwn_eeprom_enhinfo {
uint16_t chan;
uint8_t flags;
#define IWN_ENHINFO_VALID 0x01
#define IWN_ENHINFO_5GHZ 0x02
#define IWN_ENHINFO_OFDM 0x04
#define IWN_ENHINFO_HT40 0x08
#define IWN_ENHINFO_HTAP 0x10
#define IWN_ENHINFO_RES1 0x20
#define IWN_ENHINFO_RES2 0x40
#define IWN_ENHINFO_COMMON 0x80
uint8_t chan;
int8_t chain[3]; /* max power in half-dBm */
uint8_t reserved;
int8_t mimo2; /* max power in half-dBm */
@ -1486,6 +1500,16 @@ static const uint32_t iwn5000_regulatory_bands[IWN_NBANDS] = {
IWN5000_EEPROM_BAND7
};
static const uint32_t iwn6000_regulatory_bands[IWN_NBANDS] = {
IWN5000_EEPROM_BAND1,
IWN5000_EEPROM_BAND2,
IWN5000_EEPROM_BAND3,
IWN5000_EEPROM_BAND4,
IWN5000_EEPROM_BAND5,
IWN6000_EEPROM_BAND6,
IWN5000_EEPROM_BAND7
};
#define IWN_CHAN_BANDS_COUNT 7
#define IWN_MAX_CHAN_PER_BAND 14
static const struct iwn_chan_band {
@ -1513,26 +1537,6 @@ static const struct iwn_chan_band {
#define IWN_RIDX_CCK1 0
#define IWN_RIDX_OFDM6 4
static const struct iwn_rate {
uint8_t rate;
uint8_t plcp;
uint8_t flags;
} iwn_rates[IWN_RIDX_MAX + 1] = {
{ 2, 10, IWN_RFLAG_CCK },
{ 4, 20, IWN_RFLAG_CCK },
{ 11, 55, IWN_RFLAG_CCK },
{ 22, 110, IWN_RFLAG_CCK },
{ 12, 0xd, 0 },
{ 18, 0xf, 0 },
{ 24, 0x5, 0 },
{ 36, 0x7, 0 },
{ 48, 0x9, 0 },
{ 72, 0xb, 0 },
{ 96, 0x1, 0 },
{ 108, 0x3, 0 },
{ 120, 0x3, 0 }
};
#define IWN4965_MAX_PWR_INDEX 107
/*

View File

@ -78,6 +78,7 @@ struct iwn_tx_ring {
int qid;
int queued;
int cur;
int read;
};
struct iwn_softc;
@ -101,7 +102,12 @@ struct iwn_node {
struct ieee80211_node ni; /* must be the first */
uint16_t disable_tid;
uint8_t id;
uint8_t ridx[IEEE80211_RATE_MAXSIZE];
uint32_t ridx[256];
struct {
uint64_t bitmap;
int startidx;
int nframes;
} agg[IEEE80211_TID_SIZE];
};
struct iwn_calib_state {
@ -174,12 +180,10 @@ struct iwn_ops {
int);
void (*tx_done)(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
#if 0 /* HT */
void (*ampdu_tx_start)(struct iwn_softc *,
struct ieee80211_node *, uint8_t, uint16_t);
void (*ampdu_tx_stop)(struct iwn_softc *, uint8_t,
struct ieee80211_node *, int, uint8_t, uint16_t);
void (*ampdu_tx_stop)(struct iwn_softc *, int, uint8_t,
uint16_t);
#endif
};
struct iwn_vap {
@ -215,6 +219,7 @@ struct iwn_softc {
const struct iwn_sensitivity_limits
*limits;
int ntxqs;
int firstaggqueue;
int ndmachnls;
uint8_t broadcast_id;
int rxonsz;
@ -295,7 +300,6 @@ struct iwn_softc {
int8_t maxpwr2GHz;
int8_t maxpwr5GHz;
int8_t maxpwr[IEEE80211_CHAN_MAX];
int8_t enh_maxpwr[35];
int32_t temp_off;
uint32_t int_mask;
@ -307,6 +311,20 @@ struct iwn_softc {
int sc_tx_timer;
struct ieee80211_tx_ampdu *qid2tap[IWN5000_NTXQUEUES];
int (*sc_ampdu_rx_start)(struct ieee80211_node *,
struct ieee80211_rx_ampdu *, int, int, int);
void (*sc_ampdu_rx_stop)(struct ieee80211_node *,
struct ieee80211_rx_ampdu *);
int (*sc_addba_request)(struct ieee80211_node *,
struct ieee80211_tx_ampdu *, int, int, int);
int (*sc_addba_response)(struct ieee80211_node *,
struct ieee80211_tx_ampdu *, int, int, int);
void (*sc_addba_stop)(struct ieee80211_node *,
struct ieee80211_tx_ampdu *);
struct iwn_rx_radiotap_header sc_rxtap;
struct iwn_tx_radiotap_header sc_txtap;
};

View File

@ -2387,77 +2387,6 @@ usbd_get_device_index(struct usb_device *udev)
}
#if USB_HAVE_DEVCTL
/*------------------------------------------------------------------------*
* usb_notify_addq
*
* This function will generate events for dev.
*------------------------------------------------------------------------*/
#ifndef BURN_BRIDGES
static void
usb_notify_addq_compat(const char *type, struct usb_device *udev)
{
char *data = NULL;
const char *ntype;
struct malloc_type *mt;
const size_t buf_size = 512;
/* Convert notify type */
if (strcmp(type, "ATTACH") == 0)
ntype = "+";
else if (strcmp(type, "DETACH") == 0)
ntype = "-";
else
return;
mtx_lock(&malloc_mtx);
mt = malloc_desc2type("bus"); /* XXX M_BUS */
mtx_unlock(&malloc_mtx);
if (mt == NULL)
return;
data = malloc(buf_size, mt, M_NOWAIT);
if (data == NULL)
return;
/* String it all together. */
snprintf(data, buf_size,
"%s"
#if USB_HAVE_UGEN
"%s "
#endif
"at port=%u "
"vendor=0x%04x "
"product=0x%04x "
"devclass=0x%02x "
"devsubclass=0x%02x "
"sernum=\"%s\" "
"release=0x%04x "
#if USB_HAVE_UGEN
"on %s\n"
#endif
"",
ntype,
#if USB_HAVE_UGEN
udev->ugen_name,
#endif
udev->port_no,
UGETW(udev->ddesc.idVendor),
UGETW(udev->ddesc.idProduct),
udev->ddesc.bDeviceClass,
udev->ddesc.bDeviceSubClass,
usb_get_serial(udev),
UGETW(udev->ddesc.bcdDevice)
#if USB_HAVE_UGEN
, udev->parent_hub != NULL ?
udev->parent_hub->ugen_name :
device_get_nameunit(device_get_parent(udev->bus->bdev))
#endif
);
devctl_queue_data(data);
}
#endif
static void
usb_notify_addq(const char *type, struct usb_device *udev)
{
@ -2465,10 +2394,6 @@ usb_notify_addq(const char *type, struct usb_device *udev)
struct sbuf *sb;
int i;
#ifndef BURN_BRIDGES
usb_notify_addq_compat(type, udev);
#endif
/* announce the device */
sb = sbuf_new_auto();
sbuf_printf(sb,

View File

@ -75,21 +75,21 @@ static int newnfs_nfsv3_procid[NFS_V3NPROCS] = {
};
SYSCTL_DECL(_vfs_newnfs);
SYSCTL_DECL(_vfs_nfsd);
SVCPOOL *nfsrvd_pool;
static int nfs_privport = 0;
SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs_privport, CTLFLAG_RW,
SYSCTL_INT(_vfs_nfsd, OID_AUTO, nfs_privport, CTLFLAG_RW,
&nfs_privport, 0,
"Only allow clients using a privileged port for NFSv2 and 3");
static int nfs_minvers = NFS_VER2;
SYSCTL_INT(_vfs_newnfs, OID_AUTO, server_min_nfsvers, CTLFLAG_RW,
SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_min_nfsvers, CTLFLAG_RW,
&nfs_minvers, 0, "The lowest version of NFS handled by the server");
static int nfs_maxvers = NFS_VER4;
SYSCTL_INT(_vfs_newnfs, OID_AUTO, server_max_nfsvers, CTLFLAG_RW,
SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_max_nfsvers, CTLFLAG_RW,
&nfs_maxvers, 0, "The highest version of NFS handled by the server");
static int nfs_proc(struct nfsrv_descript *, u_int32_t, struct socket *,
@ -475,7 +475,7 @@ nfsrvd_init(int terminating)
NFSD_UNLOCK();
nfsrvd_pool = svcpool_create("nfsd", SYSCTL_STATIC_CHILDREN(_vfs_newnfs));
nfsrvd_pool = svcpool_create("nfsd", SYSCTL_STATIC_CHILDREN(_vfs_nfsd));
nfsrvd_pool->sp_rcache = NULL;
nfsrvd_pool->sp_assign = NULL;
nfsrvd_pool->sp_done = NULL;

View File

@ -76,16 +76,16 @@ static int nfs_commit_miss;
extern int nfsrv_issuedelegs;
extern int nfsrv_dolocallocks;
SYSCTL_DECL(_vfs_newnfs);
SYSCTL_INT(_vfs_newnfs, OID_AUTO, mirrormnt, CTLFLAG_RW,
SYSCTL_NODE(_vfs, OID_AUTO, nfsd, CTLFLAG_RW, 0, "New NFS server");
SYSCTL_INT(_vfs_nfsd, OID_AUTO, mirrormnt, CTLFLAG_RW,
&nfsrv_enable_crossmntpt, 0, "Enable nfsd to cross mount points");
SYSCTL_INT(_vfs_newnfs, OID_AUTO, commit_blks, CTLFLAG_RW, &nfs_commit_blks,
SYSCTL_INT(_vfs_nfsd, OID_AUTO, commit_blks, CTLFLAG_RW, &nfs_commit_blks,
0, "");
SYSCTL_INT(_vfs_newnfs, OID_AUTO, commit_miss, CTLFLAG_RW, &nfs_commit_miss,
SYSCTL_INT(_vfs_nfsd, OID_AUTO, commit_miss, CTLFLAG_RW, &nfs_commit_miss,
0, "");
SYSCTL_INT(_vfs_newnfs, OID_AUTO, issue_delegations, CTLFLAG_RW,
SYSCTL_INT(_vfs_nfsd, OID_AUTO, issue_delegations, CTLFLAG_RW,
&nfsrv_issuedelegs, 0, "Enable nfsd to issue delegations");
SYSCTL_INT(_vfs_newnfs, OID_AUTO, enable_locallocks, CTLFLAG_RW,
SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_locallocks, CTLFLAG_RW,
&nfsrv_dolocallocks, 0, "Enable nfsd to acquire local locks on files");
#define NUM_HEURISTIC 1017

View File

@ -57,6 +57,9 @@ MALLOC_DEFINE(M_ELI, "eli data", "GEOM_ELI Data");
SYSCTL_DECL(_kern_geom);
SYSCTL_NODE(_kern_geom, OID_AUTO, eli, CTLFLAG_RW, 0, "GEOM_ELI stuff");
static int g_eli_version = G_ELI_VERSION;
SYSCTL_INT(_kern_geom_eli, OID_AUTO, version, CTLFLAG_RD, &g_eli_version, 0,
"GELI version");
int g_eli_debug = 0;
TUNABLE_INT("kern.geom.eli.debug", &g_eli_debug);
SYSCTL_INT(_kern_geom_eli, OID_AUTO, debug, CTLFLAG_RW, &g_eli_debug, 0,
@ -329,7 +332,12 @@ g_eli_newsession(struct g_eli_worker *wr)
crie.cri_klen = sc->sc_ekeylen;
if (sc->sc_ealgo == CRYPTO_AES_XTS)
crie.cri_klen <<= 1;
crie.cri_key = sc->sc_ekey;
if ((sc->sc_flags & G_ELI_FLAG_FIRST_KEY) != 0) {
crie.cri_key = g_eli_key_hold(sc, 0,
LIST_FIRST(&sc->sc_geom->consumer)->provider->sectorsize);
} else {
crie.cri_key = sc->sc_ekey;
}
if (sc->sc_flags & G_ELI_FLAG_AUTH) {
bzero(&cria, sizeof(cria));
cria.cri_alg = sc->sc_aalgo;
@ -368,6 +376,9 @@ g_eli_newsession(struct g_eli_worker *wr)
panic("%s: invalid condition", __func__);
}
if ((sc->sc_flags & G_ELI_FLAG_FIRST_KEY) != 0)
g_eli_key_drop(sc, crie.cri_key);
return (error);
}
@ -708,6 +719,8 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp,
sc->sc_flags |= G_ELI_FLAG_NATIVE_BYTE_ORDER;
if (md->md_version < 5)
sc->sc_flags |= G_ELI_FLAG_SINGLE_KEY;
if (md->md_version < 6 && (sc->sc_flags & G_ELI_FLAG_AUTH) != 0)
sc->sc_flags |= G_ELI_FLAG_FIRST_KEY;
sc->sc_ealgo = md->md_ealgo;
sc->sc_nkey = nkey;

View File

@ -63,10 +63,19 @@
* 2 - Added G_ELI_FLAG_READONLY.
* 3 - Added 'configure' subcommand.
* 4 - IV is generated from offset converted to little-endian
* (flag G_ELI_FLAG_NATIVE_BYTE_ORDER will be set for older versions).
* (the G_ELI_FLAG_NATIVE_BYTE_ORDER flag will be set for older versions).
* 5 - Added multiple encrypton keys and AES-XTS support.
* 6 - Fixed usage of multiple keys for authenticated providers (the
* G_ELI_FLAG_FIRST_KEY flag will be set for older versions).
*/
#define G_ELI_VERSION 5
#define G_ELI_VERSION_00 0
#define G_ELI_VERSION_01 1
#define G_ELI_VERSION_02 2
#define G_ELI_VERSION_03 3
#define G_ELI_VERSION_04 4
#define G_ELI_VERSION_05 5
#define G_ELI_VERSION_06 6
#define G_ELI_VERSION G_ELI_VERSION_06
/* ON DISK FLAGS. */
/* Use random, onetime keys. */
@ -92,6 +101,8 @@
#define G_ELI_FLAG_SINGLE_KEY 0x00080000
/* Device suspended. */
#define G_ELI_FLAG_SUSPEND 0x00100000
/* Provider uses first encryption key. */
#define G_ELI_FLAG_FIRST_KEY 0x00200000
#define G_ELI_NEW_BIO 255
@ -254,7 +265,7 @@ eli_metadata_decode_v0(const u_char *data, struct g_eli_metadata *md)
}
static __inline int
eli_metadata_decode_v1v2v3v4v5(const u_char *data, struct g_eli_metadata *md)
eli_metadata_decode_v1v2v3v4v5v6(const u_char *data, struct g_eli_metadata *md)
{
MD5_CTX ctx;
const u_char *p;
@ -285,15 +296,16 @@ eli_metadata_decode(const u_char *data, struct g_eli_metadata *md)
bcopy(data, md->md_magic, sizeof(md->md_magic));
md->md_version = le32dec(data + sizeof(md->md_magic));
switch (md->md_version) {
case 0:
case G_ELI_VERSION_00:
error = eli_metadata_decode_v0(data, md);
break;
case 1:
case 2:
case 3:
case 4:
case 5:
error = eli_metadata_decode_v1v2v3v4v5(data, md);
case G_ELI_VERSION_01:
case G_ELI_VERSION_02:
case G_ELI_VERSION_03:
case G_ELI_VERSION_04:
case G_ELI_VERSION_05:
case G_ELI_VERSION_06:
error = eli_metadata_decode_v1v2v3v4v5v6(data, md);
break;
default:
error = EINVAL;
@ -509,8 +521,6 @@ void g_eli_config(struct gctl_req *req, struct g_class *mp, const char *verb);
void g_eli_read_done(struct bio *bp);
void g_eli_write_done(struct bio *bp);
int g_eli_crypto_rerun(struct cryptop *crp);
uint8_t *g_eli_crypto_key(struct g_eli_softc *sc, off_t offset,
size_t blocksize);
void g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv,
size_t size);

View File

@ -1014,7 +1014,12 @@ g_eli_config(struct gctl_req *req, struct g_class *mp, const char *verb)
gctl_error(req, "No '%s' argument.", "version");
return;
}
if (*version != G_ELI_VERSION) {
while (*version != G_ELI_VERSION) {
if (G_ELI_VERSION == G_ELI_VERSION_06 &&
*version == G_ELI_VERSION_05) {
/* Compatible. */
break;
}
gctl_error(req, "Userland and kernel parts are out of sync.");
return;
}

View File

@ -149,7 +149,7 @@ g_eli_auth_read_done(struct cryptop *crp)
bp->bio_error = crp->crp_etype;
}
sc = bp->bio_to->geom->softc;
g_eli_key_drop(sc, crp->crp_desc->crd_key);
g_eli_key_drop(sc, crp->crp_desc->crd_next->crd_key);
/*
* Do we have all sectors already?
*/
@ -513,6 +513,8 @@ g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp)
crde->crd_skip = sc->sc_alen;
crde->crd_len = data_secsize;
crde->crd_flags = CRD_F_IV_EXPLICIT | CRD_F_IV_PRESENT;
if ((sc->sc_flags & G_ELI_FLAG_FIRST_KEY) == 0)
crde->crd_flags |= CRD_F_KEY_EXPLICIT;
if (bp->bio_cmd == BIO_WRITE)
crde->crd_flags |= CRD_F_ENCRYPT;
crde->crd_alg = sc->sc_ealgo;

View File

@ -57,9 +57,13 @@ static uint64_t g_eli_key_cache_misses;
SYSCTL_UQUAD(_kern_geom_eli, OID_AUTO, key_cache_misses, CTLFLAG_RW,
&g_eli_key_cache_misses, 0, "Key cache misses");
#define G_ELI_KEY_MAGIC 0xe11341c
struct g_eli_key {
/* Key value, must be first in the structure. */
uint8_t gek_key[G_ELI_DATAKEYLEN];
/* Magic. */
int gek_magic;
/* Key number. */
uint64_t gek_keyno;
/* Reference counter. */
@ -98,6 +102,7 @@ g_eli_key_fill(struct g_eli_softc *sc, struct g_eli_key *key, uint64_t keyno)
sizeof(hmacdata), key->gek_key, 0);
key->gek_keyno = keyno;
key->gek_count = 0;
key->gek_magic = G_ELI_KEY_MAGIC;
}
static struct g_eli_key *
@ -150,6 +155,7 @@ g_eli_key_replace(struct g_eli_softc *sc, struct g_eli_key *key, uint64_t keyno)
{
mtx_assert(&sc->sc_ekeys_lock, MA_OWNED);
KASSERT(key->gek_magic == G_ELI_KEY_MAGIC, ("Invalid magic."));
RB_REMOVE(g_eli_key_tree, &sc->sc_ekeys_tree, key);
TAILQ_REMOVE(&sc->sc_ekeys_queue, key, gek_next);
@ -167,7 +173,7 @@ g_eli_key_remove(struct g_eli_softc *sc, struct g_eli_key *key)
{
mtx_assert(&sc->sc_ekeys_lock, MA_OWNED);
KASSERT(key->gek_magic == G_ELI_KEY_MAGIC, ("Invalid magic."));
KASSERT(key->gek_count == 0, ("gek_count=%d", key->gek_count));
RB_REMOVE(g_eli_key_tree, &sc->sc_ekeys_tree, key);
@ -276,6 +282,8 @@ g_eli_key_hold(struct g_eli_softc *sc, off_t offset, size_t blocksize)
/* We have all the keys, so avoid some overhead. */
key = RB_FIND(g_eli_key_tree, &sc->sc_ekeys_tree, &keysearch);
KASSERT(key != NULL, ("No key %ju found.", (uintmax_t)keyno));
KASSERT(key->gek_magic == G_ELI_KEY_MAGIC,
("Invalid key magic."));
return (key->gek_key);
}
@ -306,6 +314,8 @@ g_eli_key_hold(struct g_eli_softc *sc, off_t offset, size_t blocksize)
key->gek_count++;
mtx_unlock(&sc->sc_ekeys_lock);
KASSERT(key->gek_magic == G_ELI_KEY_MAGIC, ("Invalid key magic."));
return (key->gek_key);
}
@ -317,6 +327,8 @@ g_eli_key_drop(struct g_eli_softc *sc, uint8_t *rawkey)
if ((sc->sc_flags & G_ELI_FLAG_SINGLE_KEY) != 0)
return;
KASSERT(key->gek_magic == G_ELI_KEY_MAGIC, ("Invalid key magic."));
if (sc->sc_ekeys_total == sc->sc_ekeys_allocated)
return;

View File

@ -255,7 +255,7 @@ g_part_apm_create(struct g_part_table *basetable, struct g_part_parms *gpp)
return (ENOSPC);
/* APM uses 32-bit LBAs. */
last = MIN(pp->mediasize / pp->sectorsize, 0xffffffff) - 1;
last = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX) - 1;
basetable->gpt_first = 2 + basetable->gpt_entries;
basetable->gpt_last = last;
@ -398,6 +398,8 @@ g_part_apm_probe(struct g_part_table *basetable, struct g_consumer *cp)
g_free(buf);
if (table->ddr.ddr_blksize != pp->sectorsize)
return (ENXIO);
if (table->ddr.ddr_blkcount > pp->mediasize / pp->sectorsize)
return (ENXIO);
} else {
/*
* Check for Tivo drives, which have no DDR and a different
@ -412,7 +414,8 @@ g_part_apm_probe(struct g_part_table *basetable, struct g_consumer *cp)
}
table->ddr.ddr_sig = APM_DDR_SIG; /* XXX */
table->ddr.ddr_blksize = pp->sectorsize; /* XXX */
table->ddr.ddr_blkcount = pp->mediasize / pp->sectorsize;/* XXX */
table->ddr.ddr_blkcount =
MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
table->tivo_series1 = 1;
g_free(buf);
}

View File

@ -206,7 +206,7 @@ g_part_bsd_create(struct g_part_table *basetable, struct g_part_parms *gpp)
if (BBSIZE % pp->sectorsize)
return (ENOTBLK);
msize = MIN(pp->mediasize / pp->sectorsize, 0xffffffff);
msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
secpercyl = basetable->gpt_sectors * basetable->gpt_heads;
ncyls = msize / secpercyl;
@ -365,7 +365,7 @@ g_part_bsd_read(struct g_part_table *basetable, struct g_consumer *cp)
pp = cp->provider;
table = (struct g_part_bsd_table *)basetable;
msize = pp->mediasize / pp->sectorsize;
msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
table->bbarea = g_read_data(cp, 0, BBSIZE, &error);
if (table->bbarea == NULL)

View File

@ -288,7 +288,7 @@ g_part_ebr_create(struct g_part_table *basetable, struct g_part_parms *gpp)
if (strcmp(psn, "MBR"))
return (ENXIO);
msize = MIN(pp->mediasize / pp->sectorsize, 0xffffffff);
msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
msize -= msize % basetable->gpt_sectors;
basetable->gpt_first = 0;
basetable->gpt_last = msize - 1;
@ -464,7 +464,7 @@ g_part_ebr_read(struct g_part_table *basetable, struct g_consumer *cp)
pp = cp->provider;
table = (struct g_part_ebr_table *)basetable;
msize = pp->mediasize / pp->sectorsize;
msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
lba = 0;
while (1) {

View File

@ -262,7 +262,7 @@ g_part_mbr_create(struct g_part_table *basetable, struct g_part_parms *gpp)
if (pp->sectorsize < MBRSIZE)
return (ENOSPC);
msize = MIN(pp->mediasize / pp->sectorsize, 0xffffffff);
msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
basetable->gpt_first = basetable->gpt_sectors;
basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1;
@ -433,7 +433,7 @@ g_part_mbr_read(struct g_part_table *basetable, struct g_consumer *cp)
pp = cp->provider;
table = (struct g_part_mbr_table *)basetable;
msize = pp->mediasize / pp->sectorsize;
msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
buf = g_read_data(cp, 0L, pp->sectorsize, &error);
if (buf == NULL)

View File

@ -261,7 +261,7 @@ g_part_pc98_create(struct g_part_table *basetable, struct g_part_parms *gpp)
cyl = basetable->gpt_heads * basetable->gpt_sectors;
msize = MIN(pp->mediasize / SECSIZE, 0xffffffff);
msize = MIN(pp->mediasize / SECSIZE, UINT32_MAX);
basetable->gpt_first = cyl;
basetable->gpt_last = msize - (msize % cyl) - 1;
@ -451,7 +451,7 @@ g_part_pc98_read(struct g_part_table *basetable, struct g_consumer *cp)
pp = cp->provider;
table = (struct g_part_pc98_table *)basetable;
msize = pp->mediasize / SECSIZE;
msize = MIN(pp->mediasize / SECSIZE, UINT32_MAX);
buf = g_read_data(cp, 0L, BOOTSIZE, &error);
if (buf == NULL)

View File

@ -198,9 +198,7 @@ g_part_vtoc8_create(struct g_part_table *basetable, struct g_part_parms *gpp)
table = (struct g_part_vtoc8_table *)basetable;
msize = pp->mediasize / pp->sectorsize;
if (msize > 0xffffffffu)
msize = 0xffffffffu;
msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
table->secpercyl = basetable->gpt_sectors * basetable->gpt_heads;
pcyls = msize / table->secpercyl;
acyls = 2;
@ -392,8 +390,7 @@ g_part_vtoc8_read(struct g_part_table *basetable, struct g_consumer *cp)
bcopy(buf, &table->vtoc, sizeof(table->vtoc));
g_free(buf);
msize = pp->mediasize / pp->sectorsize;
msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
sectors = be16dec(&table->vtoc.nsecs);
if (sectors < 1)
goto invalid_label;

View File

@ -598,7 +598,11 @@ sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t key_id)
}
void
sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id)
sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
#endif
)
{
sctp_sharedkey_t *skey;
@ -616,7 +620,7 @@ sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id)
if ((skey->refcount <= 1) && (skey->deactivated)) {
/* notify ULP that key is no longer used */
sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb,
key_id, 0, SCTP_SO_LOCKED);
key_id, 0, so_locked);
SCTPDBG(SCTP_DEBUG_AUTH2,
"%s: stcb %p key %u no longer used, %d\n",
__FUNCTION__, stcb, key_id, skey->refcount);

View File

@ -156,7 +156,9 @@ sctp_copy_skeylist(const struct sctp_keyhead *src,
/* ref counts on shared keys, by key id */
extern void sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t keyid);
extern void sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t keyid);
extern void
sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t keyid,
int so_locked);
/* hmac list handling */

View File

@ -375,7 +375,7 @@ abandon:
chk->data = NULL;
}
/* Now free the address and data */
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
/* sa_ignore FREED_MEMORY */
}
return;
@ -479,7 +479,7 @@ abandon:
sctp_ucount_decr(asoc->cnt_on_reasm_queue);
/* free up the chk */
chk->data = NULL;
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
if (asoc->fragmented_delivery_inprogress == 0) {
/*
@ -1011,7 +1011,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struct sctp_association *asoc,
sctp_m_freem(chk->data);
chk->data = NULL;
}
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
return;
} else {
last_flags = at->rec.data.rcv_flags;
@ -2416,7 +2416,7 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap, int *abort_flag)
stcb->sctp_ep, stcb, NULL, SCTP_FROM_SCTP_INDATA + SCTP_LOC_18);
}
sctp_send_shutdown(stcb, stcb->asoc.primary_destination);
sctp_send_sack(stcb);
sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED);
} else {
int is_a_gap;
@ -2466,7 +2466,7 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap, int *abort_flag)
* there are gaps or duplicates.
*/
(void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer);
sctp_send_sack(stcb);
sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED);
}
} else {
if (!SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
@ -3993,7 +3993,7 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,
SCTP_LOG_FREE_SENT);
}
asoc->sent_queue_cnt--;
sctp_free_a_chunk(stcb, tp1);
sctp_free_a_chunk(stcb, tp1, SCTP_SO_NOT_LOCKED);
} else {
break;
}
@ -4709,7 +4709,7 @@ sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,
0,
SCTP_LOG_FREE_SENT);
}
sctp_free_a_chunk(stcb, tp1);
sctp_free_a_chunk(stcb, tp1, SCTP_SO_NOT_LOCKED);
wake_him++;
}
if (TAILQ_EMPTY(&asoc->sent_queue) && (asoc->total_flight > 0)) {
@ -5260,7 +5260,7 @@ sctp_flush_reassm_for_str_seq(struct sctp_tcb *stcb,
sctp_m_freem(chk->data);
chk->data = NULL;
}
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
} else if (SCTP_SSN_GT(chk->rec.data.stream_seq, seq)) {
/*
* If the stream_seq is > than the purging one, we
@ -5431,7 +5431,7 @@ sctp_handle_forward_tsn(struct sctp_tcb *stcb,
sctp_m_freem(chk->data);
chk->data = NULL;
}
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
} else {
/*
* Ok we have gone beyond the end of the fwd-tsn's

View File

@ -193,7 +193,11 @@ outnow:
*/
int
sctp_is_there_unsent_data(struct sctp_tcb *stcb)
sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
#endif
)
{
int unsent_data = 0;
unsigned int i;
@ -242,7 +246,7 @@ sctp_is_there_unsent_data(struct sctp_tcb *stcb)
sctp_m_freem(sp->data);
sp->data = NULL;
}
sctp_free_a_strmoq(stcb, sp);
sctp_free_a_strmoq(stcb, sp, so_locked);
} else {
unsent_data++;
break;
@ -301,7 +305,7 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb,
chk->data = NULL;
}
}
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
/* sa_ignore FREED_MEMORY */
}
}
@ -323,7 +327,7 @@ sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb,
sp->net = NULL;
}
/* Free the chunk */
sctp_free_a_strmoq(stcb, sp);
sctp_free_a_strmoq(stcb, sp, SCTP_SO_NOT_LOCKED);
/* sa_ignore FREED_MEMORY */
}
}
@ -902,7 +906,7 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp,
sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_8);
}
/* Now is there unsent data on a stream somewhere? */
some_on_streamwheel = sctp_is_there_unsent_data(stcb);
some_on_streamwheel = sctp_is_there_unsent_data(stcb, SCTP_SO_NOT_LOCKED);
if (!TAILQ_EMPTY(&asoc->send_queue) ||
!TAILQ_EMPTY(&asoc->sent_queue) ||
@ -3127,7 +3131,7 @@ sctp_handle_ecn_cwr(struct sctp_cwr_chunk *cp, struct sctp_tcb *stcb, struct sct
chk->data = NULL;
}
stcb->asoc.ctrl_queue_cnt--;
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
if (override == 0) {
break;
}
@ -3367,7 +3371,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
case SCTP_SELECTIVE_ACK:
case SCTP_NR_SELECTIVE_ACK:
/* resend the sack */
sctp_send_sack(stcb);
sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED);
break;
case SCTP_HEARTBEAT_REQUEST:
/* resend a demand HB */
@ -3376,7 +3380,7 @@ process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
* Only retransmit if we KNOW we wont destroy the
* tcb
*/
(void)sctp_send_hb(stcb, 1, net);
(void)sctp_send_hb(stcb, 1, net, SCTP_SO_NOT_LOCKED);
}
break;
case SCTP_SHUTDOWN:
@ -3547,7 +3551,7 @@ sctp_clean_up_stream_reset(struct sctp_tcb *stcb)
chk->data = NULL;
}
asoc->ctrl_queue_cnt--;
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
/* sa_ignore NO_NULL_CHK */
stcb->asoc.str_reset = NULL;
}
@ -3987,7 +3991,7 @@ strres_nochunk:
sctp_m_freem(chk->data);
chk->data = NULL;
}
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
return (ret_code);
}
SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD);

View File

@ -53,7 +53,7 @@ sctp_reset_in_stream(struct sctp_tcb *stcb, int number_entries,
uint16_t * list);
int sctp_is_there_unsent_data(struct sctp_tcb *stcb);
int sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked);
#endif
#endif

View File

@ -6178,7 +6178,7 @@ sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr,
/* shutdown this assoc */
int cnt;
cnt = sctp_is_there_unsent_data(stcb);
cnt = sctp_is_there_unsent_data(stcb, SCTP_SO_NOT_LOCKED);
if (TAILQ_EMPTY(&asoc->send_queue) &&
TAILQ_EMPTY(&asoc->sent_queue) &&
@ -6425,7 +6425,7 @@ sctp_toss_old_cookies(struct sctp_tcb *stcb, struct sctp_association *asoc)
chk->data = NULL;
}
asoc->ctrl_queue_cnt--;
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
}
}
}
@ -6454,7 +6454,7 @@ sctp_toss_old_asconf(struct sctp_tcb *stcb)
chk->data = NULL;
}
asoc->ctrl_queue_cnt--;
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
}
}
}
@ -6553,7 +6553,11 @@ all_done:
}
static void
sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc)
sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_locked
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
#endif
)
{
struct sctp_tmit_chunk *chk, *nchk;
@ -6580,7 +6584,7 @@ sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc)
asoc->ctrl_queue_cnt--;
if (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN)
asoc->fwd_tsn_cnt--;
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, so_locked);
} else if (chk->rec.chunk_id.id == SCTP_STREAM_RESET) {
/* special handling, we must look into the param */
if (chk != asoc->str_reset) {
@ -6660,7 +6664,12 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb,
int *locked,
int *giveup,
int eeor_mode,
int *bail)
int *bail,
int so_locked
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
#endif
)
{
/* Move from the stream to the send_queue keeping track of the total */
struct sctp_association *asoc;
@ -6731,7 +6740,7 @@ one_more_time:
sctp_m_freem(sp->data);
sp->data = NULL;
}
sctp_free_a_strmoq(stcb, sp);
sctp_free_a_strmoq(stcb, sp, so_locked);
/* we can't be locked to it */
*locked = 0;
stcb->asoc.locked_on_sending = NULL;
@ -6897,7 +6906,7 @@ dont_do_it:
chk->last_mbuf = NULL;
if (chk->data == NULL) {
sp->some_taken = some_taken;
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, so_locked);
*bail = 1;
to_move = 0;
goto out_of;
@ -7001,7 +7010,7 @@ dont_do_it:
atomic_add_int(&sp->length, to_move);
chk->data = NULL;
*bail = 1;
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, so_locked);
to_move = 0;
goto out_of;
} else {
@ -7018,7 +7027,7 @@ dont_do_it:
panic("prepend failes HELP?");
#else
SCTP_PRINTF("prepend fails HELP?\n");
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, so_locked);
#endif
*bail = 1;
to_move = 0;
@ -7140,7 +7149,7 @@ dont_do_it:
sctp_m_freem(sp->data);
sp->data = NULL;
}
sctp_free_a_strmoq(stcb, sp);
sctp_free_a_strmoq(stcb, sp, so_locked);
/* we can't be locked to it */
*locked = 0;
@ -7163,7 +7172,11 @@ out_of:
static void
sctp_fill_outqueue(struct sctp_tcb *stcb,
struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now)
struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now, int so_locked
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
#endif
)
{
struct sctp_association *asoc;
struct sctp_stream_out *strq, *strqn;
@ -7200,7 +7213,7 @@ sctp_fill_outqueue(struct sctp_tcb *stcb,
giveup = 0;
bail = 0;
moved_how_much = sctp_move_to_outqueue(stcb, strq, goal_mtu, frag_point, &locked,
&giveup, eeor_mode, &bail);
&giveup, eeor_mode, &bail, so_locked);
if (moved_how_much)
stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, moved_how_much);
@ -7440,7 +7453,7 @@ nothing_to_send:
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) {
sctp_log_cwnd(stcb, net, 4, SCTP_CWND_LOG_FILL_OUTQ_CALLED);
}
sctp_fill_outqueue(stcb, net, frag_point, eeor_mode, &quit_now);
sctp_fill_outqueue(stcb, net, frag_point, eeor_mode, &quit_now, so_locked);
if (quit_now) {
/* memory alloc failure */
no_data_chunks = 1;
@ -8378,7 +8391,7 @@ no_data_fill:
} else {
*reason_code = 5;
}
sctp_clean_up_ctl(stcb, asoc);
sctp_clean_up_ctl(stcb, asoc, so_locked);
return (0);
}
@ -8403,7 +8416,7 @@ sctp_queue_op_err(struct sctp_tcb *stcb, struct mbuf *op_err)
chk->copy_by_ref = 0;
SCTP_BUF_PREPEND(op_err, sizeof(struct sctp_chunkhdr), M_DONTWAIT);
if (op_err == NULL) {
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
return;
}
chk->send_size = 0;
@ -8992,7 +9005,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
return (0);
} else {
/* Clean up the fwd-tsn list */
sctp_clean_up_ctl(stcb, asoc);
sctp_clean_up_ctl(stcb, asoc, so_locked);
return (0);
}
}
@ -9446,7 +9459,7 @@ sctp_chunk_output(struct sctp_inpcb *inp,
* running, if so piggy-back the sack.
*/
if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
sctp_send_sack(stcb);
sctp_send_sack(stcb, so_locked);
(void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer);
}
while (asoc->sent_queue_retran_cnt) {
@ -9730,7 +9743,7 @@ send_forward_tsn(struct sctp_tcb *stcb,
chk->whoTo = NULL;
chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_DONTWAIT, 1, MT_DATA);
if (chk->data == NULL) {
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
return;
}
SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD);
@ -9875,7 +9888,11 @@ sctp_fill_in_rest:
}
void
sctp_send_sack(struct sctp_tcb *stcb)
sctp_send_sack(struct sctp_tcb *stcb, int so_locked
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
#endif
)
{
/*-
* Queue up a SACK or NR-SACK in the control queue.
@ -10017,7 +10034,7 @@ sctp_send_sack(struct sctp_tcb *stcb)
sctp_m_freem(a_chk->data);
a_chk->data = NULL;
}
sctp_free_a_chunk(stcb, a_chk);
sctp_free_a_chunk(stcb, a_chk, so_locked);
/* sa_ignore NO_NULL_CHK */
if (stcb->asoc.delayed_ack) {
sctp_timer_stop(SCTP_TIMER_TYPE_RECV,
@ -10691,7 +10708,11 @@ sctp_select_hb_destination(struct sctp_tcb *stcb, struct timeval *now)
}
int
sctp_send_hb(struct sctp_tcb *stcb, int user_req, struct sctp_nets *u_net)
sctp_send_hb(struct sctp_tcb *stcb, int user_req, struct sctp_nets *u_net, int so_locked
#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)
SCTP_UNUSED
#endif
)
{
struct sctp_tmit_chunk *chk;
struct sctp_nets *net;
@ -10747,7 +10768,7 @@ sctp_send_hb(struct sctp_tcb *stcb, int user_req, struct sctp_nets *u_net)
chk->data = sctp_get_mbuf_for_msg(chk->send_size, 0, M_DONTWAIT, 1, MT_HEADER);
if (chk->data == NULL) {
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, so_locked);
return (0);
}
SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD);
@ -10836,7 +10857,7 @@ sctp_send_hb(struct sctp_tcb *stcb, int user_req, struct sctp_nets *u_net)
sctp_free_remote_addr(chk->whoTo);
chk->whoTo = NULL;
}
sctp_free_a_chunk((struct sctp_tcb *)NULL, chk);
sctp_free_a_chunk((struct sctp_tcb *)NULL, chk, so_locked);
return (-1);
}
}
@ -10892,7 +10913,7 @@ sctp_send_ecn_echo(struct sctp_tcb *stcb, struct sctp_nets *net,
chk->send_size = sizeof(struct sctp_ecne_chunk);
chk->data = sctp_get_mbuf_for_msg(chk->send_size, 0, M_DONTWAIT, 1, MT_HEADER);
if (chk->data == NULL) {
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
return;
}
SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD);
@ -10955,7 +10976,7 @@ sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net,
chk->copy_by_ref = 0;
iph = mtod(m, struct ip *);
if (iph == NULL) {
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
return;
}
switch (iph->ip_v) {
@ -10995,7 +11016,7 @@ sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net,
* INIT-ACK, because we can't know if the initiation
* tag is correct or not.
*/
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
return;
default:
break;
@ -11018,7 +11039,7 @@ sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net,
chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_DONTWAIT, 1, MT_DATA);
if (chk->data == NULL) {
jump_out:
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
return;
}
SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD);
@ -11129,7 +11150,7 @@ sctp_send_cwr(struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t high_tsn, u
chk->send_size = sizeof(struct sctp_cwr_chunk);
chk->data = sctp_get_mbuf_for_msg(chk->send_size, 0, M_DONTWAIT, 1, MT_HEADER);
if (chk->data == NULL) {
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
return;
}
SCTP_BUF_RESV_UF(chk->data, SCTP_MIN_OVERHEAD);
@ -11418,7 +11439,7 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb,
chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_DONTWAIT, 1, MT_DATA);
if (chk->data == NULL) {
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED);
SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM);
return (ENOMEM);
}
@ -12108,7 +12129,7 @@ sctp_copy_it_in(struct sctp_tcb *stcb,
*error = sctp_copy_one(sp, uio, resv_in_first);
skip_copy:
if (*error) {
sctp_free_a_strmoq(stcb, sp);
sctp_free_a_strmoq(stcb, sp, SCTP_SO_LOCKED);
sp = NULL;
} else {
if (sp->sinfo_flags & SCTP_ADDR_OVER) {
@ -13206,7 +13227,7 @@ dataless_eof:
SCTP_TCB_LOCK(stcb);
hold_tcblock = 1;
}
cnt = sctp_is_there_unsent_data(stcb);
cnt = sctp_is_there_unsent_data(stcb, SCTP_SO_LOCKED);
if (TAILQ_EMPTY(&asoc->send_queue) &&
TAILQ_EMPTY(&asoc->sent_queue) &&
(cnt == 0)) {

View File

@ -152,9 +152,9 @@ sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int
void send_forward_tsn(struct sctp_tcb *, struct sctp_association *);
void sctp_send_sack(struct sctp_tcb *);
void sctp_send_sack(struct sctp_tcb *, int);
int sctp_send_hb(struct sctp_tcb *, int, struct sctp_nets *);
int sctp_send_hb(struct sctp_tcb *, int, struct sctp_nets *, int);
void sctp_send_ecn_echo(struct sctp_tcb *, struct sctp_nets *, uint32_t);

View File

@ -4988,7 +4988,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
}
sctp_free_spbufspace(stcb, asoc, sp);
if (sp->holds_key_ref)
sctp_auth_key_release(stcb, sp->auth_keyid);
sctp_auth_key_release(stcb, sp->auth_keyid, SCTP_SO_LOCKED);
/* Free the zone stuff */
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), sp);
SCTP_DECR_STRMOQ_COUNT();
@ -5021,7 +5021,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
chk->data = NULL;
}
if (chk->holds_key_ref)
sctp_auth_key_release(stcb, chk->auth_keyid);
sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED);
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk);
SCTP_DECR_CHK_COUNT();
atomic_subtract_int(&SCTP_BASE_INFO(ipi_free_chunks), 1);
@ -5043,7 +5043,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
}
}
if (chk->holds_key_ref)
sctp_auth_key_release(stcb, chk->auth_keyid);
sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED);
if (chk->whoTo) {
sctp_free_remote_addr(chk->whoTo);
chk->whoTo = NULL;
@ -5067,7 +5067,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
}
}
if (chk->holds_key_ref)
sctp_auth_key_release(stcb, chk->auth_keyid);
sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED);
sctp_free_remote_addr(chk->whoTo);
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk);
SCTP_DECR_CHK_COUNT();
@ -5081,7 +5081,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
chk->data = NULL;
}
if (chk->holds_key_ref)
sctp_auth_key_release(stcb, chk->auth_keyid);
sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED);
sctp_free_remote_addr(chk->whoTo);
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk);
SCTP_DECR_CHK_COUNT();
@ -5095,7 +5095,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
chk->data = NULL;
}
if (chk->holds_key_ref)
sctp_auth_key_release(stcb, chk->auth_keyid);
sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED);
sctp_free_remote_addr(chk->whoTo);
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk);
SCTP_DECR_CHK_COUNT();
@ -5108,7 +5108,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre
chk->data = NULL;
}
if (chk->holds_key_ref)
sctp_auth_key_release(stcb, chk->auth_keyid);
sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED);
sctp_free_remote_addr(chk->whoTo);
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), chk);
SCTP_DECR_CHK_COUNT();
@ -6895,7 +6895,7 @@ sctp_drain_mbufs(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
sctp_m_freem(chk->data);
chk->data = NULL;
}
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
}
}
/* Ok that was fun, now we will drain all the inbound streams? */
@ -6958,7 +6958,7 @@ sctp_drain_mbufs(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
asoc->last_revoke_count = cnt;
(void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer);
/* sa_ignore NO_NULL_CHK */
sctp_send_sack(stcb);
sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED);
sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_DRAIN, SCTP_SO_NOT_LOCKED);
reneged_asoc_ids[reneged_at] = sctp_get_associd(stcb);
reneged_at++;

View File

@ -597,7 +597,7 @@ sctp_recover_sent_list(struct sctp_tcb *stcb)
}
}
asoc->sent_queue_cnt--;
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
}
}
SCTP_PRINTF("after recover order is as follows\n");
@ -1056,7 +1056,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
* no recent feed back in an RTO or
* more, request a RTT update
*/
if (sctp_send_hb(stcb, 1, net) < 0)
if (sctp_send_hb(stcb, 1, net, SCTP_SO_NOT_LOCKED) < 0)
/*
* Less than 0 means we lost
* the assoc
@ -1120,7 +1120,7 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
* but is in PF state, a PF-heartbeat needs to be sent
* manually.
*/
if (sctp_send_hb(stcb, 1, net) < 0)
if (sctp_send_hb(stcb, 1, net, SCTP_SO_NOT_LOCKED) < 0)
/* Return less than 0 means we lost the association */
return (1);
}
@ -1598,7 +1598,7 @@ sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
}
/* Send a new HB, this will do threshold managment, pick a new dest */
if (cnt_of_unconf == 0) {
if (sctp_send_hb(stcb, 0, NULL) < 0) {
if (sctp_send_hb(stcb, 0, NULL, SCTP_SO_NOT_LOCKED) < 0) {
return (1);
}
} else {
@ -1620,7 +1620,7 @@ sctp_heartbeat_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
net->src_addr_selected = 0;
}
}
ret = sctp_send_hb(stcb, 1, net);
ret = sctp_send_hb(stcb, 1, net, SCTP_SO_NOT_LOCKED);
if (ret < 0)
return 1;
else if (ret == 0) {

View File

@ -3997,7 +3997,7 @@ sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize,
/************************NET SPECIFIC SET ******************/
if (paddrp->spp_flags & SPP_HB_DEMAND) {
/* on demand HB */
if (sctp_send_hb(stcb, 1, net) < 0) {
if (sctp_send_hb(stcb, 1, net, SCTP_SO_LOCKED) < 0) {
/* asoc destroyed */
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
error = EINVAL;

View File

@ -87,9 +87,9 @@ extern struct pr_usrreqs sctp_usrreqs;
} \
}
#define sctp_free_a_strmoq(_stcb, _strmoq) { \
#define sctp_free_a_strmoq(_stcb, _strmoq, _so_locked) { \
if ((_strmoq)->holds_key_ref) { \
sctp_auth_key_release(stcb, sp->auth_keyid); \
sctp_auth_key_release(stcb, sp->auth_keyid, _so_locked); \
(_strmoq)->holds_key_ref = 0; \
} \
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), (_strmoq)); \
@ -105,9 +105,9 @@ extern struct pr_usrreqs sctp_usrreqs;
} \
}
#define sctp_free_a_chunk(_stcb, _chk) { \
#define sctp_free_a_chunk(_stcb, _chk, _so_locked) { \
if ((_chk)->holds_key_ref) {\
sctp_auth_key_release((_stcb), (_chk)->auth_keyid); \
sctp_auth_key_release((_stcb), (_chk)->auth_keyid, _so_locked); \
(_chk)->holds_key_ref = 0; \
} \
if (_stcb) { \

View File

@ -1634,7 +1634,7 @@ sctp_timeout_handler(void *t)
} {
SCTP_STAT_INCR(sctps_timosack);
stcb->asoc.timosack++;
sctp_send_sack(stcb);
sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED);
}
#ifdef SCTP_AUDITING_ENABLED
sctp_auditing(4, inp, stcb, net);
@ -3656,7 +3656,7 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, int holds_lock, int so_locked
chk->data = NULL;
}
}
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, so_locked);
/* sa_ignore FREED_MEMORY */
}
/* pending send queue SHOULD be empty */
@ -3672,7 +3672,7 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, int holds_lock, int so_locked
chk->data = NULL;
}
}
sctp_free_a_chunk(stcb, chk);
sctp_free_a_chunk(stcb, chk, so_locked);
/* sa_ignore FREED_MEMORY */
}
for (i = 0; i < asoc->streamoutcnt; i++) {
@ -3697,7 +3697,7 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, int holds_lock, int so_locked
sp->net = NULL;
}
/* Free the chunk */
sctp_free_a_strmoq(stcb, sp);
sctp_free_a_strmoq(stcb, sp, so_locked);
/* sa_ignore FREED_MEMORY */
}
}
@ -5033,7 +5033,7 @@ sctp_user_rcvd(struct sctp_tcb *stcb, uint32_t * freed_so_far, int hold_rlock,
goto out;
}
SCTP_STAT_INCR(sctps_wu_sacks_sent);
sctp_send_sack(stcb);
sctp_send_sack(stcb, SCTP_SO_LOCKED);
sctp_chunk_output(stcb->sctp_ep, stcb,
SCTP_OUTPUT_FROM_USR_RCVD, SCTP_SO_LOCKED);

View File

@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/queue.h>
#include <sys/cpuset.h>
#include <sys/lock.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
@ -115,7 +117,7 @@ vm_offset_t mp_tramp;
u_int mp_boot_mid;
static volatile cpumask_t shutdown_cpus;
static volatile cpuset_t shutdown_cpus;
void cpu_mp_unleash(void *);
SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL);
@ -221,7 +223,7 @@ cpu_mp_setmaxid(void)
char buf[128];
int cpus;
all_cpus = 1 << PCPU_GET(cpuid);
CPU_SETOF(PCPU_GET(cpuid), &all_cpus);
mp_ncpus = 1;
cpus = 0;
@ -292,6 +294,7 @@ cpu_mp_start(void)
u_int clock;
int cpuid, bp_skipped;
u_long s;
cpuset_t ocpus;
root = OF_peer(0);
csa = &cpu_start_args;
@ -328,7 +331,7 @@ cpu_mp_start(void)
cpuid);
pc->pc_addr = va;
all_cpus |= 1 << cpuid;
CPU_SET(cpuid, &all_cpus);
if (mp_ncpus == MAXCPU)
break;
@ -336,7 +339,9 @@ cpu_mp_start(void)
printf("%d cpus: UltraSparc T1 Processor (%d.%02d MHz CPU)\n", mp_ncpus,
(clock + 4999) / 1000000, ((clock + 4999) / 10000) % 100);
PCPU_SET(other_cpus, all_cpus & ~(1 << PCPU_GET(cpuid)));
ocpus = all_cpus;
CPU_CLR(PCPU_GET(cpuid), &ocpus);
PCPU_SET(other_cpus, ocpus);
smp_active = 1;
}
@ -384,6 +389,7 @@ cpu_mp_unleash(void *v)
void
cpu_mp_bootstrap(struct pcpu *pc)
{
cpuset_t ocpus;
volatile struct cpu_start_args *csa;
csa = &cpu_start_args;
@ -404,7 +410,9 @@ cpu_mp_bootstrap(struct pcpu *pc)
smp_cpus++;
KASSERT(curthread != NULL, ("cpu_mp_bootstrap: curthread"));
PCPU_SET(other_cpus, all_cpus & ~(1 << curcpu));
ocpus = all_cpus;
CPU_CLR(curcpu, &ocpus);
PCPU_SET(other_cpus, ocpus);
printf("AP: #%d\n", curcpu);
csa->csa_count--;
membar(StoreLoad);
@ -423,14 +431,22 @@ cpu_mp_bootstrap(struct pcpu *pc)
void
cpu_mp_shutdown(void)
{
cpuset_t cpus;
int i;
critical_enter();
shutdown_cpus = PCPU_GET(other_cpus);
if (stopped_cpus != PCPU_GET(other_cpus)) /* XXX */
stop_cpus(stopped_cpus ^ PCPU_GET(other_cpus));
cpus = shutdown_cpus;
/* XXX: Stop all the CPUs which aren't already. */
if (CPU_CMP(&stopped_cpus, &cpus)) {
/* pc_other_cpus is just a flat "on" mask without curcpu. */
CPU_NAND(&cpus, &stopped_cpus);
stop_cpus(cpus);
}
i = 0;
while (shutdown_cpus != 0) {
while (!CPU_EMPTY(&shutdown_cpus)) {
if (i++ > 100000) {
printf("timeout shutting down CPUs.\n");
break;
@ -450,7 +466,6 @@ void
cpu_ipi_stop(struct trapframe *tf)
{
CTR1(KTR_SMP, "cpu_ipi_stop: stopped %d", curcpu);
savectx(&stoppcbs[curcpu]);
atomic_set_acq_int(&stopped_cpus, PCPU_GET(cpumask));
while ((started_cpus & PCPU_GET(cpumask)) == 0) {
@ -539,13 +554,15 @@ retry:
}
void
ipi_selected(cpumask_t icpus, u_int ipi)
ipi_selected(cpuset_t icpus, u_int ipi)
{
int i, cpu_count;
int cpu_count, cpu;
uint16_t *cpulist;
cpumask_t cpus;
uint64_t ackmask;
KASSERT(!CPU_ISSET(PCPU_GET(cpuid), &icpus),
("Invalid passed CPU mask"));
/*
*
* 3) forward_wakeup appears to abuse ASTs
@ -553,14 +570,12 @@ ipi_selected(cpumask_t icpus, u_int ipi)
* and not in forward wakeup
*/
cpulist = PCPU_GET(cpulist);
cpus = (icpus & ~PCPU_GET(cpumask));
for (cpu_count = 0, i = 0; i < 32 && cpus; cpus = cpus >> 1, i++) {
if (!(cpus & 0x1))
continue;
cpulist[cpu_count] = (uint16_t)i;
for (cpu_count = 0; (cpu = cpusetobj_ffs(&cpus)) != 0 && cpu < MAXCPU;
CPU_CLR(cpu, &cpus)) {
cpulist[cpu_count] = (uint16_t)cpu;
cpu_count++;
}
cpu_ipi_selected(cpu_count, cpulist, (u_long)tl_ipi_level, ipi, 0,

View File

@ -0,0 +1,57 @@
# $FreeBSD$
unset LC_ALL
LC_CTYPE=en_US.UTF-8
export LC_CTYPE
c1=e
# a umlaut
c2=$(printf '\303\244')
# euro sign
c3=$(printf '\342\202\254')
# some sort of 't' outside BMP
c4=$(printf '\360\235\225\245')
ok=0
case $c1$c2$c3$c4 in
*) ok=1 ;;
esac
if [ $ok = 0 ]; then
echo wrong at $LINENO
exit 3
fi
case $c1$c2$c3$c4 in
$c1$c2$c3$c4) ;;
*) echo wrong at $LINENO ;;
esac
case $c1$c2$c3$c4 in
"$c1$c2$c3$c4") ;;
*) echo wrong at $LINENO ;;
esac
case $c1$c2$c3$c4 in
????) ;;
*) echo wrong at $LINENO ;;
esac
case $c1.$c2.$c3.$c4 in
?.?.?.?) ;;
*) echo wrong at $LINENO ;;
esac
case $c1$c2$c3$c4 in
[!a][!b][!c][!d]) ;;
*) echo wrong at $LINENO ;;
esac
case $c1$c2$c3$c4 in
[$c1][$c2][$c3][$c4]) ;;
*) echo wrong at $LINENO ;;
esac
case $c1$c2$c3$c4 in
["$c1"]["$c2"]["$c3"]["$c4"]) ;;
*) echo wrong at $LINENO ;;
esac

View File

@ -0,0 +1,75 @@
# $FreeBSD$
unset LC_ALL
LC_CTYPE=en_US.UTF-8
export LC_CTYPE
c1=e
# a umlaut
c2=$(printf '\303\244')
# euro sign
c3=$(printf '\342\202\254')
# some sort of 't' outside BMP
c4=$(printf '\360\235\225\245')
s=$c1$c2$c3$c4
testcase() {
code="$1"
expected="$2"
oIFS="$IFS"
eval "$code"
IFS='|'
result="$#|$*"
IFS="$oIFS"
if [ "x$result" = "x$expected" ]; then
ok=x$ok
else
failures=x$failures
echo "For $code, expected $expected actual $result"
fi
}
testcase 'set -- "$s"' "1|$s"
testcase 'set -- "${s#$c2}"' "1|$s"
testcase 'set -- "${s#*}"' "1|$s"
testcase 'set -- "${s#$c1}"' "1|$c2$c3$c4"
testcase 'set -- "${s#$c1$c2}"' "1|$c3$c4"
testcase 'set -- "${s#$c1$c2$c3}"' "1|$c4"
testcase 'set -- "${s#$c1$c2$c3$c4}"' "1|"
testcase 'set -- "${s#?}"' "1|$c2$c3$c4"
testcase 'set -- "${s#??}"' "1|$c3$c4"
testcase 'set -- "${s#???}"' "1|$c4"
testcase 'set -- "${s#????}"' "1|"
testcase 'set -- "${s#*$c3}"' "1|$c4"
testcase 'set -- "${s%$c4}"' "1|$c1$c2$c3"
testcase 'set -- "${s%$c3$c4}"' "1|$c1$c2"
testcase 'set -- "${s%$c2$c3$c4}"' "1|$c1"
testcase 'set -- "${s%$c1$c2$c3$c4}"' "1|"
testcase 'set -- "${s%?}"' "1|$c1$c2$c3"
testcase 'set -- "${s%??}"' "1|$c1$c2"
testcase 'set -- "${s%???}"' "1|$c1"
testcase 'set -- "${s%????}"' "1|"
testcase 'set -- "${s%$c2*}"' "1|$c1"
testcase 'set -- "${s##$c2}"' "1|$s"
testcase 'set -- "${s##*}"' "1|"
testcase 'set -- "${s##$c1}"' "1|$c2$c3$c4"
testcase 'set -- "${s##$c1$c2}"' "1|$c3$c4"
testcase 'set -- "${s##$c1$c2$c3}"' "1|$c4"
testcase 'set -- "${s##$c1$c2$c3$c4}"' "1|"
testcase 'set -- "${s##?}"' "1|$c2$c3$c4"
testcase 'set -- "${s##??}"' "1|$c3$c4"
testcase 'set -- "${s##???}"' "1|$c4"
testcase 'set -- "${s##????}"' "1|"
testcase 'set -- "${s##*$c3}"' "1|$c4"
testcase 'set -- "${s%%$c4}"' "1|$c1$c2$c3"
testcase 'set -- "${s%%$c3$c4}"' "1|$c1$c2"
testcase 'set -- "${s%%$c2$c3$c4}"' "1|$c1"
testcase 'set -- "${s%%$c1$c2$c3$c4}"' "1|"
testcase 'set -- "${s%%?}"' "1|$c1$c2$c3"
testcase 'set -- "${s%%??}"' "1|$c1$c2"
testcase 'set -- "${s%%???}"' "1|$c1"
testcase 'set -- "${s%%????}"' "1|"
testcase 'set -- "${s%%$c2*}"' "1|$c1"
test "x$failures" = x

View File

@ -34,7 +34,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd January 17, 2010
.Dd May 8, 2011
.Dt JAIL 8
.Os
.Sh NAME
@ -431,7 +431,7 @@ command script can be used:
.Bd -literal
D=/here/is/the/jail
cd /usr/src
mkdir -p $D
mkdir -p -m 0700 $D
make world DESTDIR=$D
make distribution DESTDIR=$D
mount -t devfs devfs $D/dev
@ -448,6 +448,10 @@ in the per-jail devfs.
A simple devfs ruleset for jails is available as ruleset #4 in
.Pa /etc/defaults/devfs.rules .
.Pp
Non-superusers in the host system should not be able to access the
jail's files; otherwise an attacker with root access to the jail
could obtain elevated privileges on the host.
.Pp
In many cases this example would put far more in the jail than needed.
In the other extreme case a jail might contain only one file:
the executable to be run in the jail.