7655 Commits

Author SHA1 Message Date
truckman
1d7291afd1 MFC r299921
Add an assertion to catch a potential underflow in an array index
calculation, though this should not happen in the current code.

Reported by:	Coverity
CID:		1008486
2016-06-07 16:53:05 +00:00
pfg
223f7999b2 MFC r301235:
dhclient(1): correct obvious mismatch in get_char().

Correct switch between current and previous line buffers when
encountering a carriage return in the input.

CID:		1305719
Obtained from:	OpenBSD (CVS rev. 1.30)
2016-06-06 13:31:28 +00:00
truckman
153cea5447 MFC r266941, r266955
Needed for anticipated dummynet AQM MFC next week.

r266941 | hiren | 2014-06-01 00:28:24 -0700 (Sun, 01 Jun 2014) | 9 lines

ECN marking implenetation for dummynet.
Changes include both DCTCP and RFC 3168 ECN marking methodology.

DCTCP draft: http://tools.ietf.org/html/draft-bensley-tcpm-dctcp-00

Submitted by:	Midori Kato (aoimidori27@gmail.com)
Worked with:	Lars Eggert (lars@netapp.com)
Reviewed by:	luigi, hiren

r266955 | hiren | 2014-06-01 13:19:17 -0700 (Sun, 01 Jun 2014) | 5 lines

DNOLD_IS_ECN introduced by r266941 is not required.
DNOLD_* flags are for compat with old binaries.

Suggested by: luigi

Discussed with:	hiren
Relnotes:	yes
2016-06-03 00:48:50 +00:00
loos
654f98ed08 MFC r297984:
Make pfctl(8) more flexible when parsing bandwidth values.

This is the current behaviour in OpenBSD and a similar patch exist in
pfSense too.

Obtained from:	OpenBSD (partly - rev. 1.625)
Sponsored by:	Rubicon Communications (Netgate)
2016-05-23 16:02:29 +00:00
truckman
f13286bea2 MFC r299873
Use strlcpy() instead of strncpy() when copying ifname to ensure
that it is NUL terminated.  Additional NUL padding is not required
for short names.

Use sizeof(destination) in a few places instead of IFNAMSIZ.

Cast afp->af_ridreq and afp->af_addreq  to make the intent of
the code more obvious.

Reported by:	Coverity
CID:		1009628, 1009630, 1009631, 1009632, 1009633, 1009635, 1009638
CID:		1009639, 1009640, 1009641, 1009642, 1009643, 1009644, 1009645
CID:		1009646, 1009647, 1010049, 1010050, 1010051, 1010052, 1010053
CID:		1010054, 1011293, 1011294, 1011295, 1011296, 1011297, 1011298
CID:		1011299, 1305821, 1351720, 1351721
2016-05-20 07:14:03 +00:00
asomers
af2f11439d MFC r298420, r298439, r298644
r298420 | asomers | 2016-04-21 10:43:15 -0600 (Thu, 21 Apr 2016) | 10 lines

Notify userspace listeners when geom disk attributes have changed

sys/geom/geom_disk.c:
        disk_attr_changed(): Generate a devctl event of type GEOM:<attr> for
        every call.

r298439 | asomers | 2016-04-21 15:13:41 -0600 (Thu, 21 Apr 2016) | 10 lines

DRY on buffer sizes.  Update to r298420.

sys/geom/geom_disk.c:
        In disk_attr_changed, don't repeat a buffer size.

r298644 | asomers | 2016-04-26 08:48:58 -0600 (Tue, 26 Apr 2016) | 8 lines

Add GEOM::physpath documentation to devd.conf(5)
2016-05-19 16:04:20 +00:00
pfg
4da88f96a8 MFC r299089:
fsck_msdosfs: Adjust a check.

The on-disk FAT array does not include anything before CLUST_FIRST,
compensate in size check.

Obtained from:	NetBSD (CVS Rev. 1.20)
2016-05-18 00:33:08 +00:00
garga
e948bacfe5 MFC r299196:
Add missing parameters -N and -l to reroot and halt usage()

Approved by:	bapt
Sponsored by:	Rubicon Communications (Netgate)
Differential Revision:	https://reviews.freebsd.org/D6173
2016-05-17 14:52:05 +00:00
pfg
03efafeb98 MFC r298901:
restore: promote some getfiles() parameters to size_t.

This is based on a change from OpenBSD:

  "Fix restore so that it can actually restore files larger than 4GB by
  changing the type of "size" to off_t in getfiles() plus little dependent
  type cleanup, from Daniel Lucq."

It is an important for machines with 32 bit longs.
While here unsign the flags, also from OpenBSD.

Obtained from:	OpenBSD (with changes)
2016-05-16 16:29:56 +00:00
sephe
a12d292261 MFC r298385
dhclient: Log a warning instead of bailing upon "illegal" options

In Azure, the DHCP servers add private option (id 0xf5), which contains
binary form of an IPv4 address. Once this option is converted to string
form, it could contain '$', e.g.

IPv4 address: 100.72.36.54
binary form: 0x64 0x48 0x24 0x36
string form: "dH$6"

dhclient bails upon "illegal" options like the above example, thus the
VM bring-up will fail.

Also as a side note, this "illegal" option detection was added in
OpenBSD ~11years ago:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c?rev=1.50&content-type=text/x-cvsweb-markup

And it was removed along with the removal of script support in OpenBSD
~3years ago:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c?rev=1.159&content-type=text/x-cvsweb-markup

Reported by:	Hongxiong Xian <v-hoxian microsoft com>
Reviewed by:	jhb, Dexuan Cui <decui microsoft com>
Tested by:	Hongxiong Xian <v-hoxian microsoft com>
Analyzed by:	Dong Liu <doliu microsoft com>
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5853
2016-05-06 05:44:12 +00:00
pfg
399bde7ffd MFC r298868, r298874:
restore: fix memory and resource handle leaks.

CID:		272297, 1007784
2016-05-06 01:37:06 +00:00
ngie
4e454a93db MFC r298758:
Remove logically impossible test in scsidoinquiry(..)

It was already done 4 lines prior and the value of error didn't change

CID: 1011236
2016-05-04 07:33:58 +00:00
pfg
621e8ca862 MFC r298556:
ifconfig: prevent some improbable signed integer overflows.

ic_nchans, from struct:ieee80211req_chaninfo, is an unsigned int.
Use an unsigned index to prevent overflowing the index.

Adopt unsigned integers in other cases where it is useful
to be aware of the unsigned quantities and there is no
risk of the values being negative.
2016-05-03 15:04:56 +00:00
pfg
a9fdf41ec6 MFC r298551, r298679, r298680:
fsck_ffs: use uint32_t for closedisk().

fs_ncg is of type uint32_t, and we were indexing it with an int.
Fixed this using an unsigned type.

Reviewed by:	mckusick
2016-04-29 03:04:56 +00:00
ae
437e80c6fb MFC r297820:
Fix the problem, when gpart(8) can't write both bootcode and partcode
  in one command due to wrong file size limit. Do not use bootcode size
  to calculate partsize limit.
  Also add report message about successful partcode writing.
2016-04-26 11:55:28 +00:00
pfg
89c6fc4bee MFC r297618:
fsck_msdosfs(8): Optimimize memsets

Obtained from:	NetBSD (bin/50908)
2016-04-20 00:44:13 +00:00
scottl
dab85cf430 Merge r298008
Update the devd.conf man page to describe the new CAM/periph system/subsystem.

Sponsored by:	Netflix
2016-04-17 01:38:37 +00:00
loos
99b723c568 MFC r287009, r287120 and r298131:
Add ALTQ(9) support for the CoDel algorithm.

CoDel is a parameterless queue discipline that handles variable bandwidth
and RTT.

It can be used as the single queue discipline on an interface or as a sub
discipline of existing queue disciplines such as PRIQ, CBQ, HFSC, FAIRQ.

Obtained from:	pfSense
Sponsored by:	Rubicon Communications (Netgate)
2016-04-16 22:02:32 +00:00
loos
b3015d8f28 Fix the build.
pointy hat to:	loos
Reported by:	gjb, Herbert J. Skuhra
2016-04-16 13:41:10 +00:00
loos
8113adf547 MFC r284777, r284814, r284863 and r298088:
ALTQ FAIRQ discipline import from DragonFLY.

Differential Revision:	https://reviews.freebsd.org/D2847
Obtained from:	pfSense
Sponsored by:	Rubicon Communications (Netgate)
2016-04-16 02:11:04 +00:00
asomers
9b388bff95 MFC 297838
Fix an intermittent bug in sbin/devd/client_test.stream

In case where the two events were being received in separate reads, the
event buffer was being null-terminated at the wrong offset.

Also, factored out some common code between the tests, and fixed a comment.
2016-04-14 15:24:45 +00:00
asomers
1e918163f5 MFC 270231
Misc fixes suggested by Coverity.

sbin/devd/tests/client_test.c
	* In the event that popen fails, don't dereference its return value.
	* Fix array overwrite in the stream and seqpacket tests.
	* Close sockets at the end of successful ATF tests.
2016-04-08 20:43:50 +00:00
hselasky
58bfc3556c MFC r296902:
Improve detection of extended QSFP diagnostics.

The standards in the QSFP diagnostics area are not clear when the
additional measurements are present or not. Use a valid temperature
reading as an indicator for the presence of voltage and TX/RX power
measurements.

Sponsored by:	Mellanox Technologies
Tested by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D5391
Reviewed by:	gallatin
2016-04-07 07:12:14 +00:00
mav
15e9e9abda MFC r296449: Update meaning of -n argument. 2016-03-28 09:18:18 +00:00
mav
1625cb7688 MFC r296653: Allow standard commands for "unknown" classes in RESCUE mode.
For example, it allows quite useful `geom disk list` command.
2016-03-18 13:29:43 +00:00
ngie
46bdbf0087 MFC r294973:
Add pidfile support to ggated(8)

The tests will manipulate the system daemon today, which can cause undesired
service interruption when the tests are run.

This change allows the geom_gate tests to be run with an arbitrary ggated(8)
daemon / geom_gate(4) device pairing.

Other changes:
- Sort #includes
- Use a more common idiom for parsing options with getopt(3)
2016-03-13 23:32:59 +00:00
ngie
e3064c8217 MFC r295121:
Delete argsize to fix a -Wunused-but-set-variable warning with gcc 4.9

The variable isn't actually checked -- just the end result which gets
returned from the function
2016-03-12 18:55:48 +00:00
ngie
08c25d7f54 MFC r295119:
Remove `r_tmp` to fix a -Wunused-but-set-variable warning with gcc 4.9
2016-03-12 18:40:51 +00:00
kp
a0a9dc5d39 MFC r295836:
ifconfig(8): can't use 'name' or 'description' when creating interface with auto numbering

If one does 'ifconfig tap create name blah', it will return error because the
'name' command doesn't properly populate the request sent to ioctl(...). The
'description' command has the same bug, and is also fixed with this patch.

If one does 'ifconfig tap create mtu 9000 name blah', it DOES work, but 'tap0'
(or other sequence number) is echoed, instead of the expected 'blah'. (assuming
the name change actually succeeded)

PR:		    206876
Submitted by:       Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Differential Revision:      https://reviews.freebsd.org/D5341
2016-03-06 08:52:03 +00:00
gnn
a80787b3cf MFC 285730
Only report the lack of ALTQ support if pfctl is using verbose (-v) mode.

PR:		194935
Submitted by:	Jim Thompson
Approved by: re (gjb)
2016-03-03 23:25:31 +00:00
ae
3b4b162df0 MFC r295969:
Fix bug in filling and handling ipfw's O_DSCP opcode.
  Due to integer overflow CS4 token was handled as BE.

  PR:		207459
Approved by:	re (gjb)
2016-03-02 13:38:21 +00:00
asomers
628004b785 MFC r292573
Fix "mount -a" for NFS and ZFS filesystems with shared mountpoints

sbin/mount.c
	Check whether an fstab entry has the same fstype as a mounted
	filesystem before declaring it to be mounted. This will allow NFS
	filesystems that share a mountpoint with a local filesystem to be
	automatically mounted at boot.

	This is not such an unusual situation. For example, if somebody uses
	the standard installer with a ZFS root, he'll get a /usr/home
	filesystem, even though he may choose to mount /usr/home over NFS.
2016-01-18 16:41:26 +00:00
melifaro
d201d6637a MFC r292831: Add SFF-8024 Extended Specification Compliance.
Submitted by:		markb_mellanox.com
Differential Revision:	https://reviews.freebsd.org/D4666
2016-01-17 05:38:03 +00:00
trasz
8bd7436f2b MFC r290689:
Fix resource leaks in error cases.

Sponsored by:	The FreeBSD Foundation
2016-01-12 10:24:08 +00:00
trasz
3aea2923e9 MFC r290548:
Userspace part of reroot support. This makes it possible to change
the root filesystem without full reboot, using "reboot -r". This can
be used to to eg. boot from a temporary md_image preloaded by loader(8),
setup an iSCSI session, and continue booting from rootfs mounted over
iSCSI.

Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3693
2016-01-12 10:14:57 +00:00
trasz
2d6e438962 MFC r289110:
Make geom_nop(4) collect statistics on all types of BIOs, not just
reads and writes.

PR:		kern/198405
Submitted by:	Matthew D. Fuller <fullermd at over-yonder dot net>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3679
2016-01-12 09:27:01 +00:00
allanjude
30790e76c2 MFC: r287842
Make ifconfig always exit with an error code if an important ioctl fails

PR:		203062
2016-01-12 05:56:49 +00:00
asomers
1b837fdf71 MFC r292020
Increase devd's client socket buffer size to 256KB. This is not as large as
it looks, because we'll hit the sockbuf's mbuf limit long before hitting its
data limit. A 256KB data limit allows creating a ZFS pool on about 450
drives without overflowing the client socket buffers.
2016-01-11 20:24:56 +00:00
trasz
89e4c13d2a MFC r287429:
The dumpfs(8) utility doesn't actually use disktab(5); remove it
from "SEE ALSO".

Sponsored by:	The FreeBSD Foundation
2016-01-11 20:11:41 +00:00
trasz
8a895b1fb5 MFC r287396:
It's 2015, and some people are still trying to use fdisk and then
go asking what debug flags to set for GEOM to make it work.  Advice
them to use gpart(8) instead.

Something similar should probably done with disklabel,
but I need to rewrite the disklabel examples first.

Sponsored by:	The FreeBSD Foundation
2016-01-11 20:10:14 +00:00
trasz
55bfa73168 MFC 289113:
Add 'p' postfix to mdconfig(8).

Sponsored by:	The FreeBSD Foundation
2016-01-11 20:01:50 +00:00
ae
09204e7670 MFC r292057:
Make detection of GPT a bit more reliable.

  When we are detecting a partition table and didn't find PMBR, try to
  read backup GPT header from the last sector and if it is correct,
  assume that we have GPT.

  Differential Revision:	https://reviews.freebsd.org/D4282

MFC r292058:
  Remove a note about damaged PMBR. Now GPT will be detected automatically
  with such corruption.

Relnotes:	yes
2016-01-10 13:53:57 +00:00
bdrewery
dc83b58bbe MFC r289677:
Fix a ton of speelling errors
2016-01-07 00:40:51 +00:00
smh
c8d8dd1a4d MFC: r292266 & r292947
Add flag to disable inital reboot(8) userland sync

Sponsored by:	Multiplay
2016-01-06 09:56:06 +00:00
rstone
81a34adc8a MFC r287920:
Fix /sbin/route to never look up (invalid) interface names through DNS

  /sbin/route has a bug where if it is passed an interface name that does
  not exist, it falls through and winds up interpreting it as a hostname.
  It fails out eventually, but on a system where DNS lookup is broken you
  can end up waiting for up to 60 seconds waiting for the DNS lookup to
  timeout.  I'm not quite sure what happens if the DNS lookup somehow
  succeeds but I doubt that can end well.

  Reviewed by:  markj, cem
  MFC after:    2 weeks
  Sponsored by: EMC/Isilon Storage Division
2016-01-05 16:58:07 +00:00
ngie
5952006acb MFC r292048:
Don't leak rsector/sector in mp_label(..)

Use calloc instead of malloc + memset(.., 0, ..) when allocating sector

Differential Revision: https://reviews.freebsd.org/D4450
Reported by: cppcheck
Reviewed by: mav
Sponsored by: EMC / Isilon Storage Division
2015-12-17 06:31:55 +00:00
ngie
510ad3accc MFC r292005:
Call va_end on ap when vsnprintf fails in run_cmd(..) to clean up
the variable state

Reported by: cppcheck
Sponsored by: EMC / Isilon Storage Division
2015-12-16 02:43:34 +00:00
kp
0696c87609 MFC r290236
pfctl: Fix uninitialised veriable

In pfctl_set_debug() we used 'level' without ever initialising it.
We correctly parsed the option, but them failed to actually assign the parsed
value to 'level' before performing to ioctl() to configure the debug level.

PR:		202996
Submitted by:	Andrej Kolontai
2015-12-15 21:02:53 +00:00
bdrewery
092e8d5213 MFC r291329:
Remove redundant DPSRCS which were already in SRCS.
2015-12-04 18:50:12 +00:00
bdrewery
21a7306566 MFC r290083:
Use more appropriate ${SHAREDIR} rather than /usr/share.
2015-12-04 18:21:05 +00:00