diff --git a/etc/regdomain.xml b/etc/regdomain.xml
index 9b406055f5a..ff5711392c4 100644
--- a/etc/regdomain.xml
+++ b/etc/regdomain.xml
@@ -323,6 +323,14 @@
+
+
+ 23
+
+
+
+ 23
+
23
@@ -333,6 +341,12 @@
IEEE80211_CHAN_PASSIVE
IEEE80211_CHAN_DFS
+
+
+ 23
+ IEEE80211_CHAN_PASSIVE
+ IEEE80211_CHAN_DFS
+
@@ -349,6 +363,26 @@
+
+
+ 23
+ IEEE80211_CHAN_HT20
+
+
+
+ 23
+ IEEE80211_CHAN_HT40
+
+
+
+ 23
+ IEEE80211_CHAN_HT20
+
+
+
+ 23
+ IEEE80211_CHAN_HT40
+
23
@@ -373,6 +407,20 @@
IEEE80211_CHAN_PASSIVE
IEEE80211_CHAN_DFS
+
+
+ 23
+ IEEE80211_CHAN_HT20
+ IEEE80211_CHAN_PASSIVE
+ IEEE80211_CHAN_DFS
+
+
+
+ 23
+ IEEE80211_CHAN_HT40
+ IEEE80211_CHAN_PASSIVE
+ IEEE80211_CHAN_DFS
+
@@ -1624,11 +1672,31 @@
IEEE80211_CHAN_A
IEEE80211_CHAN_HALF
+
+ 4920 4980
+ 20 20
+ IEEE80211_CHAN_A
+
+
+ 4920 4980
+ 40 20
+ IEEE80211_CHAN_A
+
4950 4980
20 5
IEEE80211_CHAN_A
+
+ 5040 5080
+ 20 20
+ IEEE80211_CHAN_A
+
+
+ 5040 5080
+ 40 20
+ IEEE80211_CHAN_A
+
5120 5240
20 20
diff --git a/sbin/shutdown/shutdown.8 b/sbin/shutdown/shutdown.8
index 032c4f3ca2d..b7067e12fff 100644
--- a/sbin/shutdown/shutdown.8
+++ b/sbin/shutdown/shutdown.8
@@ -28,7 +28,7 @@
.\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95
.\" $FreeBSD$
.\"
-.Dd December 30, 2010
+.Dd July 13, 2011
.Dt SHUTDOWN 8
.Os
.Sh NAME
@@ -83,20 +83,20 @@ If one of the
.Fl p
or
.Fl r
-is specified,
+options are specified,
.Nm
will execute
.Xr halt 8
or
.Xr reboot 8
-instead of sending signal to
+instead of sending a signal to
.Xr init 8 .
.It Fl n
If the
.Fl o
-is specified, prevent the file system cache from being flushed by passing
+option is specified, prevent the file system cache from being flushed by passing
.Fl n
-option to
+to
.Xr halt 8
or
.Xr reboot 8 .
@@ -106,10 +106,10 @@ This option should probably not be used.
is the time at which
.Nm
will bring the system down and
-may be the word
+may be the case-insensitive word
.Ar now
(indicating an immediate shutdown) or
-specify a future time in one of two formats:
+a future time in one of two formats:
.Ar +number ,
or
.Ar yymmddhhmm ,
@@ -148,7 +148,7 @@ exits.
.Pp
At shutdown time a message is written to the system log, containing the
time of shutdown, the person who initiated the shutdown and the reason.
-Corresponding signal is then sent to
+The corresponding signal is then sent to
.Xr init 8
to respectively halt, reboot or bring the system down to single-user state
(depending on the above options).
@@ -170,22 +170,24 @@ file that
.Nm
created will be removed automatically.
.Pp
-When run without options, the
+When run without options, the
.Nm
-utility will place the system into single user mode at the
+utility will place the system into single user mode at the
.Ar time
specified.
.Pp
-Calling utility as
-.Nm poweroff
-is equivalent of calling:
+Calling
+.Dq Nm poweroff
+is equivalent to running:
.Bd -literal -offset indent
shutdown -p now
.Ed
.Sh FILES
.Bl -tag -width /var/run/nologin -compact
.It Pa /var/run/nologin
-tells login not to let anyone log in
+tells
+.Xr login 1
+not to let anyone log in
.El
.Sh COMPATIBILITY
The hours and minutes in the second time format may be separated by
diff --git a/sys/dev/cas/if_cas.c b/sys/dev/cas/if_cas.c
index 5d830f85a6a..858c8bc381c 100644
--- a/sys/dev/cas/if_cas.c
+++ b/sys/dev/cas/if_cas.c
@@ -203,7 +203,7 @@ cas_attach(struct cas_softc *sc)
IFQ_SET_READY(&ifp->if_snd);
callout_init_mtx(&sc->sc_tick_ch, &sc->sc_mtx, 0);
- callout_init(&sc->sc_rx_ch, 1);
+ callout_init_mtx(&sc->sc_rx_ch, &sc->sc_mtx, 0);
/* Create local taskq. */
TASK_INIT(&sc->sc_intr_task, 0, cas_intr_task, sc);
TASK_INIT(&sc->sc_tx_task, 1, cas_tx_task, ifp);
@@ -1599,7 +1599,7 @@ cas_rint_timeout(void *arg)
{
struct cas_softc *sc = arg;
- CAS_LOCK_ASSERT(sc, MA_NOTOWNED);
+ CAS_LOCK_ASSERT(sc, MA_OWNED);
cas_rint(sc);
}
@@ -1614,7 +1614,7 @@ cas_rint(struct cas_softc *sc)
uint32_t rxhead;
u_int idx, idx2, len, off, skip;
- CAS_LOCK_ASSERT(sc, MA_NOTOWNED);
+ CAS_LOCK_ASSERT(sc, MA_OWNED);
callout_stop(&sc->sc_rx_ch);
@@ -1742,7 +1742,9 @@ cas_rint(struct cas_softc *sc)
cas_rxcksum(m, CAS_GET(word4,
CAS_RC4_TCP_CSUM));
/* Pass it on. */
+ CAS_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
+ CAS_LOCK(sc);
} else
ifp->if_iqdrops++;
@@ -1838,7 +1840,9 @@ cas_rint(struct cas_softc *sc)
cas_rxcksum(m, CAS_GET(word4,
CAS_RC4_TCP_CSUM));
/* Pass it on. */
+ CAS_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
+ CAS_LOCK(sc);
} else
ifp->if_iqdrops++;
@@ -1876,7 +1880,7 @@ cas_free(void *arg1, void *arg2)
{
struct cas_rxdsoft *rxds;
struct cas_softc *sc;
- u_int idx;
+ u_int idx, locked;
#if __FreeBSD_version < 800016
rxds = arg2;
@@ -1894,17 +1898,18 @@ cas_free(void *arg1, void *arg2)
* NB: this function can be called via m_freem(9) within
* this driver!
*/
-
+ if ((locked = CAS_LOCK_OWNED(sc)) == 0)
+ CAS_LOCK(sc);
cas_add_rxdesc(sc, idx);
+ if (locked == 0)
+ CAS_UNLOCK(sc);
}
static inline void
cas_add_rxdesc(struct cas_softc *sc, u_int idx)
{
- u_int locked;
- if ((locked = CAS_LOCK_OWNED(sc)) == 0)
- CAS_LOCK(sc);
+ CAS_LOCK_ASSERT(sc, MA_OWNED);
bus_dmamap_sync(sc->sc_rdmatag, sc->sc_rxdsoft[idx].rxds_dmamap,
BUS_DMASYNC_PREREAD);
@@ -1922,9 +1927,6 @@ cas_add_rxdesc(struct cas_softc *sc, u_int idx)
CAS_WRITE_4(sc, CAS_RX_KICK,
(sc->sc_rxdptr + CAS_NRXDESC - 4) & CAS_NRXDESC_MASK);
}
-
- if (locked == 0)
- CAS_UNLOCK(sc);
}
static void
@@ -1932,7 +1934,7 @@ cas_eint(struct cas_softc *sc, u_int status)
{
struct ifnet *ifp = sc->sc_ifp;
- CAS_LOCK_ASSERT(sc, MA_NOTOWNED);
+ CAS_LOCK_ASSERT(sc, MA_OWNED);
ifp->if_ierrors++;
@@ -1949,7 +1951,7 @@ cas_eint(struct cas_softc *sc, u_int status)
printf("\n");
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
- cas_init(sc);
+ cas_init_locked(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
taskqueue_enqueue(sc->sc_tq, &sc->sc_tx_task);
}
@@ -1986,6 +1988,7 @@ cas_intr_task(void *arg, int pending __unused)
if (__predict_false((status & CAS_INTR_SUMMARY) == 0))
goto done;
+ CAS_LOCK(sc);
#ifdef CAS_DEBUG
CTR4(KTR_CAS, "%s: %s: cplt %x, status %x",
device_get_name(sc->sc_dev), __func__,
@@ -2025,6 +2028,7 @@ cas_intr_task(void *arg, int pending __unused)
(CAS_INTR_TX_TAG_ERR | CAS_INTR_RX_TAG_ERR |
CAS_INTR_RX_LEN_MMATCH | CAS_INTR_PCI_ERROR_INT)) != 0)) {
cas_eint(sc, status);
+ CAS_UNLOCK(sc);
return;
}
@@ -2032,7 +2036,7 @@ cas_intr_task(void *arg, int pending __unused)
status2 = CAS_READ_4(sc, CAS_MAC_TX_STATUS);
if ((status2 &
(CAS_MAC_TX_UNDERRUN | CAS_MAC_TX_MAX_PKT_ERR)) != 0)
- sc->sc_ifp->if_oerrors++;
+ ifp->if_oerrors++;
else if ((status2 & ~CAS_MAC_TX_FRAME_XMTD) != 0)
device_printf(sc->sc_dev,
"MAC TX fault, status %x\n", status2);
@@ -2041,7 +2045,7 @@ cas_intr_task(void *arg, int pending __unused)
if (__predict_false(status & CAS_INTR_RX_MAC_INT)) {
status2 = CAS_READ_4(sc, CAS_MAC_RX_STATUS);
if ((status2 & CAS_MAC_RX_OVERFLOW) != 0)
- sc->sc_ifp->if_ierrors++;
+ ifp->if_ierrors++;
else if ((status2 & ~CAS_MAC_RX_FRAME_RCVD) != 0)
device_printf(sc->sc_dev,
"MAC RX fault, status %x\n", status2);
@@ -2061,16 +2065,15 @@ cas_intr_task(void *arg, int pending __unused)
}
if ((status &
- (CAS_INTR_TX_INT_ME | CAS_INTR_TX_ALL | CAS_INTR_TX_DONE)) != 0) {
- CAS_LOCK(sc);
+ (CAS_INTR_TX_INT_ME | CAS_INTR_TX_ALL | CAS_INTR_TX_DONE)) != 0)
cas_tint(sc);
- CAS_UNLOCK(sc);
- }
- if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
+ CAS_UNLOCK(sc);
return;
- else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+ } else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
taskqueue_enqueue(sc->sc_tq, &sc->sc_tx_task);
+ CAS_UNLOCK(sc);
status = CAS_READ_4(sc, CAS_STATUS_ALIAS);
if (__predict_false((status & CAS_INTR_SUMMARY) != 0)) {
@@ -2403,7 +2406,7 @@ cas_mii_statchg(device_t dev)
CAS_WRITE_4(sc, CAS_MAC_XIF_CONF, v);
sc->sc_mac_rxcfg = rxcfg;
- if ((sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 &&
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 &&
(sc->sc_flags & CAS_LINK) != 0) {
CAS_WRITE_4(sc, CAS_MAC_TX_CONF,
txcfg | CAS_MAC_TX_CONF_EN);
diff --git a/sys/dev/mpt/mpt.h b/sys/dev/mpt/mpt.h
index 47af5ba6e50..d12c307c803 100644
--- a/sys/dev/mpt/mpt.h
+++ b/sys/dev/mpt/mpt.h
@@ -721,11 +721,9 @@ struct mpt_softc {
* DMA Mapping Stuff
*/
struct resource * pci_reg; /* Register map for chip */
- int pci_mem_rid; /* Resource ID */
bus_space_tag_t pci_st; /* Bus tag for registers */
bus_space_handle_t pci_sh; /* Bus handle for registers */
/* PIO versions of above. */
- int pci_pio_rid;
struct resource * pci_pio_reg;
bus_space_tag_t pci_pio_st;
bus_space_handle_t pci_pio_sh;
diff --git a/sys/dev/mpt/mpt_pci.c b/sys/dev/mpt/mpt_pci.c
index a3cb61151fe..f7201b613e6 100644
--- a/sys/dev/mpt/mpt_pci.c
+++ b/sys/dev/mpt/mpt_pci.c
@@ -193,8 +193,6 @@ __FBSDID("$FreeBSD$");
#define PCIM_CMD_SERRESPEN 0x0100
#endif
-
-
static int mpt_pci_probe(device_t);
static int mpt_pci_attach(device_t);
static void mpt_free_bus_resources(struct mpt_softc *mpt);
@@ -362,17 +360,17 @@ mpt_set_options(struct mpt_softc *mpt)
mpt->cfg_role = tval;
mpt->do_cfg_role = 1;
}
-
tval = 0;
mpt->msi_enable = 0;
- if (resource_int_value(device_get_name(mpt->dev),
- device_get_unit(mpt->dev), "msi_enable", &tval) == 0 && tval == 1) {
+ if (mpt->is_sas)
mpt->msi_enable = 1;
+ if (resource_int_value(device_get_name(mpt->dev),
+ device_get_unit(mpt->dev), "msi_enable", &tval) == 0) {
+ mpt->msi_enable = tval;
}
}
#endif
-
static void
mpt_link_peer(struct mpt_softc *mpt)
{
@@ -411,7 +409,6 @@ mpt_unlink_peer(struct mpt_softc *mpt)
}
}
-
static int
mpt_pci_attach(device_t dev)
{
@@ -522,9 +519,9 @@ mpt_pci_attach(device_t dev)
* certain reset operations (but must be disabled for
* some cards otherwise).
*/
- mpt->pci_pio_rid = PCIR_BAR(mpt_io_bar);
+ mpt_io_bar = PCIR_BAR(mpt_io_bar);
mpt->pci_pio_reg = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
- &mpt->pci_pio_rid, RF_ACTIVE);
+ &mpt_io_bar, RF_ACTIVE);
if (mpt->pci_pio_reg == NULL) {
device_printf(dev, "unable to map registers in PIO mode\n");
goto bad;
@@ -533,9 +530,9 @@ mpt_pci_attach(device_t dev)
mpt->pci_pio_sh = rman_get_bushandle(mpt->pci_pio_reg);
/* Allocate kernel virtual memory for the 9x9's Mem0 region */
- mpt->pci_mem_rid = PCIR_BAR(mpt_mem_bar);
+ mpt_mem_bar = PCIR_BAR(mpt_mem_bar);
mpt->pci_reg = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
- &mpt->pci_mem_rid, RF_ACTIVE);
+ &mpt_mem_bar, RF_ACTIVE);
if (mpt->pci_reg == NULL) {
device_printf(dev, "Unable to memory map registers.\n");
if (mpt->is_sas) {
@@ -575,7 +572,7 @@ mpt_pci_attach(device_t dev)
}
}
mpt->pci_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd,
- RF_ACTIVE | RF_SHAREABLE);
+ RF_ACTIVE | (mpt->pci_msi_count ? 0 : RF_SHAREABLE));
if (mpt->pci_irq == NULL) {
device_printf(dev, "could not allocate interrupt\n");
goto bad;
@@ -594,7 +591,6 @@ mpt_pci_attach(device_t dev)
}
/* Allocate dma memory */
-/* XXX JGibbs -Should really be done based on IOCFacts. */
if (mpt_dma_mem_alloc(mpt)) {
mpt_prt(mpt, "Could not allocate DMA memory\n");
goto bad;
@@ -660,13 +656,13 @@ mpt_free_bus_resources(struct mpt_softc *mpt)
{
if (mpt->ih) {
bus_teardown_intr(mpt->dev, mpt->pci_irq, mpt->ih);
- mpt->ih = 0;
+ mpt->ih = NULL;
}
if (mpt->pci_irq) {
bus_release_resource(mpt->dev, SYS_RES_IRQ,
- mpt->pci_msi_count ? 1 : 0, mpt->pci_irq);
- mpt->pci_irq = 0;
+ rman_get_rid(mpt->pci_irq), mpt->pci_irq);
+ mpt->pci_irq = NULL;
}
if (mpt->pci_msi_count) {
@@ -675,19 +671,18 @@ mpt_free_bus_resources(struct mpt_softc *mpt)
}
if (mpt->pci_pio_reg) {
- bus_release_resource(mpt->dev, SYS_RES_IOPORT, mpt->pci_pio_rid,
- mpt->pci_pio_reg);
- mpt->pci_pio_reg = 0;
+ bus_release_resource(mpt->dev, SYS_RES_IOPORT,
+ rman_get_rid(mpt->pci_pio_reg), mpt->pci_pio_reg);
+ mpt->pci_pio_reg = NULL;
}
if (mpt->pci_reg) {
- bus_release_resource(mpt->dev, SYS_RES_MEMORY, mpt->pci_mem_rid,
- mpt->pci_reg);
- mpt->pci_reg = 0;
+ bus_release_resource(mpt->dev, SYS_RES_MEMORY,
+ rman_get_rid(mpt->pci_reg), mpt->pci_reg);
+ mpt->pci_reg = NULL;
}
MPT_LOCK_DESTROY(mpt);
}
-
/*
* Disconnect ourselves from the system.
*/
@@ -712,7 +707,6 @@ mpt_pci_detach(device_t dev)
return(0);
}
-
/*
* Disable the hardware
*/
@@ -808,8 +802,6 @@ mpt_dma_mem_alloc(struct mpt_softc *mpt)
return (0);
}
-
-
/* Deallocate memory that was allocated by mpt_dma_mem_alloc
*/
static void
@@ -826,14 +818,11 @@ mpt_dma_mem_free(struct mpt_softc *mpt)
bus_dmamem_free(mpt->reply_dmat, mpt->reply, mpt->reply_dmap);
bus_dma_tag_destroy(mpt->reply_dmat);
bus_dma_tag_destroy(mpt->parent_dmat);
- mpt->reply_dmat = 0;
+ mpt->reply_dmat = NULL;
free(mpt->request_pool, M_DEVBUF);
- mpt->request_pool = 0;
-
+ mpt->request_pool = NULL;
}
-
-
/* Reads modifiable (via PCI transactions) config registers */
static void
mpt_read_config_regs(struct mpt_softc *mpt)
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 004190a321b..7eb84e6e5ee 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -1353,8 +1353,11 @@ pci_alloc_msix_method(device_t dev, device_t child, int *count)
for (i = 0; i < max; i++) {
/* Allocate a message. */
error = PCIB_ALLOC_MSIX(device_get_parent(dev), child, &irq);
- if (error)
+ if (error) {
+ if (i == 0)
+ return (error);
break;
+ }
resource_list_add(&dinfo->resources, SYS_RES_IRQ, i + 1, irq,
irq, 1);
}
diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c
index aa68f7eba32..1ad3bd59cb6 100644
--- a/sys/dev/usb/input/ukbd.c
+++ b/sys/dev/usb/input/ukbd.c
@@ -59,6 +59,8 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
+#include
#include
#include
@@ -385,6 +387,33 @@ ukbd_put_key(struct ukbd_softc *sc, uint32_t key)
}
}
+static void
+ukbd_yield(void)
+{
+ struct thread *td = curthread;
+ uint32_t old_prio;
+
+ DROP_GIANT();
+
+ thread_lock(td);
+
+ /* get current priority */
+ old_prio = td->td_base_pri;
+
+ /* set new priority */
+ sched_prio(td, td->td_user_pri);
+
+ /* cause a task switch */
+ mi_switch(SW_INVOL | SWT_RELINQUISH, NULL);
+
+ /* restore priority */
+ sched_prio(td, old_prio);
+
+ thread_unlock(td);
+
+ PICKUP_GIANT();
+}
+
static void
ukbd_do_poll(struct ukbd_softc *sc, uint8_t wait)
{
@@ -396,8 +425,9 @@ ukbd_do_poll(struct ukbd_softc *sc, uint8_t wait)
if (kdb_active == 0) {
while (sc->sc_inputs == 0) {
- /* make sure the USB code gets a chance to run */
- pause("UKBD", 1);
+
+ /* give USB threads a chance to run */
+ ukbd_yield();
/* check if we should wait */
if (!wait)
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index bf6dab8dbe3..955bd8b0f22 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -397,6 +397,7 @@ devfs_allocv(struct devfs_dirent *de, struct mount *mp, int lockmode,
sx_xunlock(&dmp->dm_lock);
return (ENOENT);
}
+loop:
DEVFS_DE_HOLD(de);
DEVFS_DMP_HOLD(dmp);
mtx_lock(&devfs_de_interlock);
@@ -405,16 +406,21 @@ devfs_allocv(struct devfs_dirent *de, struct mount *mp, int lockmode,
VI_LOCK(vp);
mtx_unlock(&devfs_de_interlock);
sx_xunlock(&dmp->dm_lock);
- error = vget(vp, lockmode | LK_INTERLOCK, curthread);
+ vget(vp, lockmode | LK_INTERLOCK | LK_RETRY, curthread);
sx_xlock(&dmp->dm_lock);
if (devfs_allocv_drop_refs(0, dmp, de)) {
- if (error == 0)
- vput(vp);
+ vput(vp);
return (ENOENT);
}
- else if (error) {
- sx_xunlock(&dmp->dm_lock);
- return (error);
+ else if ((vp->v_iflag & VI_DOOMED) != 0) {
+ mtx_lock(&devfs_de_interlock);
+ if (de->de_vnode == vp) {
+ de->de_vnode = NULL;
+ vp->v_data = NULL;
+ }
+ mtx_unlock(&devfs_de_interlock);
+ vput(vp);
+ goto loop;
}
sx_xunlock(&dmp->dm_lock);
*vpp = vp;
diff --git a/usr.sbin/bsdinstall/scripts/config b/usr.sbin/bsdinstall/scripts/config
index 5d7c3cead61..4340450b896 100755
--- a/usr.sbin/bsdinstall/scripts/config
+++ b/usr.sbin/bsdinstall/scripts/config
@@ -30,3 +30,7 @@ cat $BSDINSTALL_TMPETC/rc.conf.* >> $BSDINSTALL_TMPETC/rc.conf
rm $BSDINSTALL_TMPETC/rc.conf.*
cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc
+
+# Set up other things from installed config
+chroot $BSDINSTALL_CHROOT /usr/bin/newaliases
+
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index 01a27eb0d08..a1e83c35082 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -1789,10 +1789,9 @@ get_exp(void)
{
struct exportlist *ep;
- ep = (struct exportlist *)malloc(sizeof (struct exportlist));
+ ep = (struct exportlist *)calloc(1, sizeof (struct exportlist));
if (ep == (struct exportlist *)NULL)
out_of_mem();
- memset(ep, 0, sizeof(struct exportlist));
return (ep);
}
@@ -1804,10 +1803,9 @@ get_grp(void)
{
struct grouplist *gp;
- gp = (struct grouplist *)malloc(sizeof (struct grouplist));
+ gp = (struct grouplist *)calloc(1, sizeof (struct grouplist));
if (gp == (struct grouplist *)NULL)
out_of_mem();
- memset(gp, 0, sizeof(struct grouplist));
return (gp);
}
diff --git a/usr.sbin/rpcbind/rpcb_stat.c b/usr.sbin/rpcbind/rpcb_stat.c
index b10ed508b0b..30617545f7b 100644
--- a/usr.sbin/rpcbind/rpcb_stat.c
+++ b/usr.sbin/rpcbind/rpcb_stat.c
@@ -54,7 +54,7 @@
static rpcb_stat_byvers inf;
void
-rpcbs_init()
+rpcbs_init(void)
{
}
diff --git a/usr.sbin/rpcbind/rpcb_svc_com.c b/usr.sbin/rpcbind/rpcb_svc_com.c
index 79cb93751f5..f90dc5964b5 100644
--- a/usr.sbin/rpcbind/rpcb_svc_com.c
+++ b/usr.sbin/rpcbind/rpcb_svc_com.c
@@ -1076,7 +1076,7 @@ netbuffree(struct netbuf *ap)
extern bool_t __svc_clean_idle(fd_set *, int, bool_t);
void
-my_svc_run()
+my_svc_run(void)
{
size_t nfds;
struct pollfd pollfds[FD_SETSIZE];
diff --git a/usr.sbin/rpcbind/rpcbind.c b/usr.sbin/rpcbind/rpcbind.c
index 5a76a68f1f3..dff0b08993c 100644
--- a/usr.sbin/rpcbind/rpcbind.c
+++ b/usr.sbin/rpcbind/rpcbind.c
@@ -178,12 +178,13 @@ main(int argc, char *argv[])
init_transport(nconf);
while ((nconf = getnetconfig(nc_handle))) {
- if (nconf->nc_flag & NC_VISIBLE)
+ if (nconf->nc_flag & NC_VISIBLE) {
if (ipv6_only == 1 && strcmp(nconf->nc_protofmly,
"inet") == 0) {
/* DO NOTHING */
} else
init_transport(nconf);
+ }
}
endnetconfig(nc_handle);
@@ -766,7 +767,7 @@ terminate(int dummy __unused)
}
void
-rpcbind_abort()
+rpcbind_abort(void)
{
#ifdef WARMSTART
write_warmstart(); /* Dump yourself */
diff --git a/usr.sbin/rpcbind/util.c b/usr.sbin/rpcbind/util.c
index 6c41253d2ec..16e6f700266 100644
--- a/usr.sbin/rpcbind/util.c
+++ b/usr.sbin/rpcbind/util.c
@@ -283,7 +283,7 @@ addrmerge(struct netbuf *caller, char *serv_uaddr, char *clnt_uaddr,
}
void
-network_init()
+network_init(void)
{
#ifdef INET6
struct ifaddrs *ifap, *ifp;
diff --git a/usr.sbin/rpcbind/warmstart.c b/usr.sbin/rpcbind/warmstart.c
index 410f270820f..fc0956f574f 100644
--- a/usr.sbin/rpcbind/warmstart.c
+++ b/usr.sbin/rpcbind/warmstart.c
@@ -142,7 +142,7 @@ error: fprintf(stderr, "rpcbind: will start from scratch\n");
}
void
-write_warmstart()
+write_warmstart(void)
{
(void) write_struct(RPCBFILE, (xdrproc_t)xdr_rpcblist_ptr, &list_rbl);
#ifdef PORTMAP
@@ -152,7 +152,7 @@ write_warmstart()
}
void
-read_warmstart()
+read_warmstart(void)
{
rpcblist_ptr tmp_rpcbl = NULL;
#ifdef PORTMAP
diff --git a/usr.sbin/syslogd/syslogd.8 b/usr.sbin/syslogd/syslogd.8
index ff0141daa08..23ba6d0542c 100644
--- a/usr.sbin/syslogd/syslogd.8
+++ b/usr.sbin/syslogd/syslogd.8
@@ -36,7 +36,7 @@
.Nd log systems messages
.Sh SYNOPSIS
.Nm
-.Op Fl 468ACcdknosuv
+.Op Fl 468ACcdkNnosuv
.Op Fl a Ar allowed_peer
.Op Fl b Ar bind_address
.Op Fl f Ar config_file
@@ -227,6 +227,13 @@ facility is reserved for messages read directly from
Select the number of minutes between
.Dq mark
messages; the default is 20 minutes.
+.It Fl N
+Disable binding on UDP sockets. RFC 3164 recommends that outgoing
+syslogd messages should originate from the privileged port, this
+option
+.Em disables
+the recommended behavior. This option inherits
+.Fl s .
.It Fl n
Disable dns query for every request.
.It Fl o
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 045da5b8159..d1c9fd16e28 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -278,6 +278,7 @@ static int fklog = -1; /* /dev/klog */
static int Initialized; /* set when we have initialized ourselves */
static int MarkInterval = 20 * 60; /* interval between marks in seconds */
static int MarkSeq; /* mark sequence number */
+static int NoBind; /* don't bind() as suggested by RFC 3164 */
static int SecureMode; /* when true, receive only unix domain socks */
#ifdef INET6
static int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */
@@ -358,7 +359,7 @@ main(int argc, char *argv[])
dprintf("madvise() failed: %s\n", strerror(errno));
bindhostname = NULL;
- while ((ch = getopt(argc, argv, "468Aa:b:cCdf:kl:m:nop:P:sS:Tuv"))
+ while ((ch = getopt(argc, argv, "468Aa:b:cCdf:kl:m:nNop:P:sS:Tuv"))
!= -1)
switch (ch) {
case '4':
@@ -437,6 +438,10 @@ main(int argc, char *argv[])
case 'm': /* mark interval */
MarkInterval = atoi(optarg) * 60;
break;
+ case 'N':
+ NoBind = 1;
+ SecureMode = 1;
+ break;
case 'n':
resolve = 0;
break;
@@ -2685,13 +2690,24 @@ socksetup(int af, char *bindhostname)
close(*s);
continue;
}
- if (bind(*s, r->ai_addr, r->ai_addrlen) < 0) {
- close(*s);
- logerror("bind");
- continue;
- }
+ /*
+ * RFC 3164 recommends that client side message
+ * should come from the privileged syslogd port.
+ *
+ * If the system administrator choose not to obey
+ * this, we can skip the bind() step so that the
+ * system will choose a port for us.
+ */
+ if (!NoBind) {
+ if (bind(*s, r->ai_addr, r->ai_addrlen) < 0) {
+ close(*s);
+ logerror("bind");
+ continue;
+ }
- double_rbuf(*s);
+ if (!SecureMode)
+ double_rbuf(*s);
+ }
(*socks)++;
s++;