4863 Commits

Author SHA1 Message Date
tuexen
c929c897c8 MFC r277815:
Whitespace change.
2015-05-29 12:48:14 +00:00
tuexen
03ab9820fc MFC r277424:
Remove comparisons which are not necessary.
With manual intervention.

Reported by:	Coverity
CID:		1237826, 1237844, 1237847
2015-05-29 12:45:55 +00:00
tuexen
4ed8a22fc6 MFC r277380:
Code cleanup.

Reported by:	Coverity
CID:		749578
2015-05-29 12:35:21 +00:00
tuexen
186be7c17d MFC r277350:
Fix a bug which only shows up when an mbuf allocation failed.
Therefore chances are low that we hit this.

Reported by:	Coverity
CID:		1018886
2015-05-29 12:33:02 +00:00
tuexen
7fa1168111 MFC r277348:
Remove an unnecessary check.

Reported by:	Coverity
CID:		749576
2015-05-29 12:30:19 +00:00
tuexen
e920cd42ce MFC r277347:
Add protection code to free memory in case of processing an address which
is neither IPv4 or IPv6.

Reported by:	Coverity
CID:		749311
2015-05-29 12:27:45 +00:00
tuexen
e522160ca4 MFC r277337:
Remove an unused variable.

Reported by:	Coverity
CID:		750999
2015-05-29 12:25:11 +00:00
tuexen
d303d373d1 MFC r277053:
Remove dead code.

Reported by:	Coverity
CID:		748664
2015-05-29 12:22:35 +00:00
tuexen
059450c5d6 MFC r277049:
Remove dead code.

Reported by:	Coverity
CID:		1018052
2015-05-29 12:19:41 +00:00
tuexen
f1c488bb6d MFC r277046:
Remove dead code.

Reported by:	Coverity
CID:		1018053
2015-05-29 12:17:21 +00:00
tuexen
a3f1c54c9d MFC r277034:
Remove dead code.

Reported by:	Coverity
CID:		748663
2015-05-29 12:13:52 +00:00
tuexen
b7947552da MFC r277033:
Remove dead code.

Reported by:	Coverity
CID:		748660, 748661
2015-05-29 12:11:14 +00:00
tuexen
6e1abed81c MFC r277031
Remove dead code.

Reported by:	Coverity
CID:		748665
2015-05-29 12:08:49 +00:00
tuexen
da3006cf8b MFC r277030:
Remove dead code.

Reported by:	Coverity
CID:		748666
2015-05-29 12:06:00 +00:00
tuexen
369d8e1e68 MFC r276914:
Minimize the usage of SCTP_BUF_IS_EXTENDED.
This should help Robert...
2015-05-29 12:03:02 +00:00
tuexen
9b5b9e6473 MFC r276009:
Don't check twice that inp is not NULL.

Reported by:	Coverity
CID:		748671
2015-05-29 11:52:32 +00:00
tuexen
be4dc0520d MFC r275967:
Fix and harmonize the validation of PR-SCTP policies.

Reported by:	Coverity
CID:		1232044
2015-05-29 11:47:54 +00:00
tuexen
25101e7981 MFC r275954:
Cleanup the code.

Reported by:	Coverity
CID:		1232003
2015-05-29 11:43:51 +00:00
tuexen
0a467bef43 MFC r275869:
Add a missing break.

Reported by:	Coverity
CID:		1232014
2015-05-29 11:40:50 +00:00
tuexen
76a9701748 MFC r275574:
Include the received chunk padding when reporting an unknown chunk.
2015-05-29 11:18:06 +00:00
tuexen
4e7201cd30 MFC r275567:
Fix the support of mapped IPv4 addresses.
Thanks to Mark Bonnekessel and Markus Boese for making me aware of the
problems.
2015-05-29 11:15:00 +00:00
tuexen
3c88229c08 MFC r273925:
Don't zero the stats before they are read out.
2015-05-29 11:04:55 +00:00
tuexen
1076c79452 MFC r273634:
Fix a use of an uninitialized variable by makeing sure
that sctp_med_chunk_output() always initialized the reason_code
instead of relying on the caller.
The variable is only used for debugging purpose.
This issue was reported by Peter Bostroem from Google.
2015-05-29 11:01:46 +00:00
jch
47cc02d0cc MFC r279821:
In TCP, connect() can return incorrect error code EINVAL
    instead of EADDRINUSE or ECONNREFUSED

    PR:                         196035
    Differential Revision:      https://reviews.freebsd.org/D1982
    Reported by:                Mark Nunberg <mnunberg@haskalah.org>
    Submitted by:               Harrison Grundy <harrison.grundy@astrodoggroup.com>
    Reviewed by:                adrian, jch, glebius, gnn
    Approved by:                jhb
2015-05-15 12:35:18 +00:00
jch
c3c407f451 MFC: r280904, r280990, r281599
r280904:
    Use appropriate timeout_t* instead of void* in tcp_timer_activate()

    Suggested by:               imp
    Differential Revision:      https://reviews.freebsd.org/D2154
    Reviewed by:                imp, jhb
    Approved by:                jhb

r280990:
    Provide better debugging information in tcp_timer_activate() and
    tcp_timer_active()

    Differential Revision:      https://reviews.freebsd.org/D2179
    Suggested by:               bz
    Reviewed by:                jhb
    Approved by:                jhb

r281599:
    Fix an old and well-documented use-after-free race condition in
    TCP timers:
     - Add a reference from tcpcb to its inpcb
     - Defer tcpcb deletion until TCP timers have finished

    Differential Revision:      https://reviews.freebsd.org/D2079
    Submitted by:               jch, Marc De La Gueronniere <mdelagueronniere@verisign.com>
    Reviewed by:                imp, rrs, adrian, jhb, bz
    Approved by:                jhb
    Sponsored by:               Verisign, Inc.
2015-05-15 12:07:43 +00:00
gnn
4215c2f123 MFC: 282215
Make it possible to statically link SIFTR into the kernel
as a new option.

Reviewed by:	bz
Discussed with:	lstewart
2015-05-13 00:28:36 +00:00
hiren
e545513c3e MFC r261708, r261847, r268525, r274316, r274347, r275593,
r276844, r276847, r279531, r279559, r279564, r279676

A bunch of IPv6 fixes by melifaro, hrs and ae

Major changes:
Simplify nd6_output_lle()
Add refcounting to DAD and fix races and other errors
Implement Enhanced DAD algorithm for IPv6

Suggested by: 	ae
Tested by: 	Jason Wolfe <j at nitrology.com>
Sponsored by:	Limelight Networks
2015-05-08 08:35:06 +00:00
hiren
b09afc6f3f MFC r275358 r275483 r276982 - Removing M_FLOWID by hps@
r275358:
Start process of removing the use of the deprecated "M_FLOWID" flag
from the FreeBSD network code. The flag is still kept around in the
"sys/mbuf.h" header file, but does no longer have any users. Instead
the "m_pkthdr.rsstype" field in the mbuf structure is now used to
decide the meaning of the "m_pkthdr.flowid" field. To modify the
"m_pkthdr.rsstype" field please use the existing "M_HASHTYPE_XXX"
macros as defined in the "sys/mbuf.h" header file.

This patch introduces new behaviour in the transmit direction.
Previously network drivers checked if "M_FLOWID" was set in "m_flags"
before using the "m_pkthdr.flowid" field. This check has now now been
replaced by checking if "M_HASHTYPE_GET(m)" is different from
"M_HASHTYPE_NONE". In the future more hashtypes will be added, for
example hashtypes for hardware dedicated flows.

"M_HASHTYPE_OPAQUE" indicates that the "m_pkthdr.flowid" value is
valid and has no particular type. This change removes the need for an
"if" statement in TCP transmit code checking for the presence of a
valid flowid value. The "if" statement mentioned above is now a direct
variable assignment which is then later checked by the respective
network drivers like before.

r275483:
Remove M_FLOWID from SCTP code.

r276982:
Remove no longer used "M_FLOWID" flag from mbuf.h and update the netisr
manpage.

Note: The FreeBSD version has been bumped.

Reviewed by:    hps, tuexen
Sponsored by:   Limelight Networks
2015-04-24 23:26:44 +00:00
markj
8089a48fdb MFC r272378:
Add net.inet.icmp.tstamprepl.

PR:	193689
2015-04-16 19:09:25 +00:00
delphij
e5ee1c2b41 Improve patch for SA-15:04.igmp to solve a potential buffer overflow.
Fix multiple vulnerabilities of ntp. [SA-15:07]

Fix bsdinstall(8) insecure default GELI keyfile permissions. [SA-15:08]

Fix Denial of Service with IPv6 Router Advertisements. [SA-15:09]
2015-04-07 20:20:24 +00:00
hiren
1116474bdc MFC r280233, r280237, r280441
Add connection flowid and flowtype to siftr(4).

Sponsored by:	Limelight Networks
2015-04-06 22:41:13 +00:00
hiren
39fb34452f MFC r266418, r266448
Add the flowtype to the inpcb.
Add -R to netstat to dump RSS/flow information.

Reviewed by:	delphij
Relnotes:	yes (for r266448)
Sponsored by:	Limelight Networks
2015-04-06 18:40:50 +00:00
hselasky
da7dc9ab83 MFC r279281:
Fix a special case in ip_fragment() to produce a more sensible chain
of packets. When the data payload length excluding any headers, of an
outgoing IPv4 packet exceeds PAGE_SIZE bytes, a special case in
ip_fragment() can kick in to optimise the outgoing payload(s). The
code which was added in r98849 as part of zero copy socket support
assumes that the beginning of any MTU sized payload is aligned to
where a MBUF's "m_data" pointer points. This is not always the case
and can sometimes cause large IPv4 packets, as part of ping replies,
to be split more than needed.

Instead of iterating the MBUFs to figure out how much data is in the
current chain, use the value already in the "m_pkthdr.len" field of
the first MBUF in the chain.

Reviewed by:		ken @
Differential Revision:	https://reviews.freebsd.org/D1893
Sponsored by:		Mellanox Technologies
2015-03-25 10:55:08 +00:00
ae
783dfdc075 MFC r279730:
lla_lookup() can directly call llentry_free() for static entries
  and the last one requires to hold afdata's wlock.

PR:		197096
2015-03-14 14:35:07 +00:00
delphij
9d303d647b Instant MFC:
Fix integer overflow in IGMP protocol.

Security:	FreeBSD-SA-15:04.igmp
Security:	CVE-2015-1414
Found by:	Mateusz Kocielski, Logicaltrust
Analyzed by:	Marek Kroemeke, Mateusz Kocielski (shm@NetBSD.org) and
		22733db72ab3ed94b5f8a1ffcde850251fe6f466
Submited by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
Reviewed by:	bms
Approved by:	so
2015-02-25 05:43:02 +00:00
marius
a445eafde3 MFC: r266990 (missed in r265946)
Fix build UDP-Lite with VIMAGE enabled when building with gcc.
2015-02-15 20:53:50 +00:00
rrs
3a3039379c MFC of r278472
This fixes a bug in the way that the LLE timers for nd6
and arp were being used. They basically would pass in the
mutex to the callout_init. Because they used this method
to the callout system, it was possible to "stop" the callout.
When flushing the table and you stopped the running callout, the
callout_stop code would return 1 indicating that it was going
to stop the callout (that was about to run on the callout_wheel blocked
by the function calling the stop). Now when 1 was returned, it would
lower the reference count one extra time for the stopped timer, then
a few lines later delete the memory. Of course the callout_wheel was
stuck in the lock code and would then crash since it was accessing
freed memory. By using callout_init(c, 1) we always get a 0 back
and the reference counting bug does not rear its head. We do have
to make a few adjustments to the callouts themselves though to make
sure it does the proper thing if rescheduled as well as gets the lock.

Sponsored by:	Netflix Inc.
2015-02-15 13:57:44 +00:00
jhb
e15ed53e77 MFC 277709:
Use an sbuf to generate the output of the net.inet.tcp.hostcache.list
sysctl to avoid a possible buffer overflow if the cache grows while the
text is being generated.

PR:		172675
2015-02-10 21:41:56 +00:00
hselasky
eaff30fc5d Append to the MFC of r278103 that we also pass along the M_FLOWID flag.
Sponsored by:	Mellanox Technologies
2015-02-10 13:43:23 +00:00
hselasky
4d9a35d031 MFC r278103:
The flowid and hashtype should be copied from the originating packet
when fragmenting IP packets to preserve the order of the packets in a
stream. Else the resulting fragments can be sent out of order when the
hardware supports multiple transmit rings.

Sponsored by:	Mellanox Technologies
2015-02-10 13:29:44 +00:00
loos
6ca887b620 MFC r276751:
Remove the check that prevent carp(4) advskew to be set to '0'.

CARP devices are created with advskew set to '0' and once you set it to
any other value in the valid range (0..254) you can't set it back to zero.

The code in question is also used to prevent that zeroed values overwrite
the CARP defaults when a new CARP device is created.  Since advskew already
defaults to '0' for newly created devices and the new value is guaranteed
to be within the valid range, it is safe to overwrite it here.

PR:		194672
Reported by:	cmb@pfsense.org
2015-02-02 11:42:35 +00:00
delphij
03ae650167 Fix SCTP SCTP_SS_VALUE kernel memory corruption and disclosure vulnerability
and SCTP stream reset vulnerability.

Security:	FreeBSD-SA-15:02.kmem
Security:	CVE-2014-8612
Security:	FreeBSD-SA-15:03.sctp
Security:	CVE-2014-8613
2015-01-27 19:36:08 +00:00
bryanv
b5fba8dc05 MFC r272886:
Add context pointer and source address to the UDP tunnel callback

  These are needed for the forthcoming vxlan implementation. The context
  pointer means we do not have to use a spare pointer field in the inpcb,
  and the source address is required to populate vxlan's forwarding table.
2015-01-27 06:19:30 +00:00
ae
7a82e24551 MFC r273087 (with modifications):
Overhaul if_gif(4):
   o convert to if_transmit;
   o use rmlock to protect access to gif_softc;
   o use sx lock to protect from concurrent ioctls;
   o remove a lot of unneeded and duplicated code;
   o remove cached route support (it won't work with concurrent io);
   o style fixes.

MFC r273090:
  Move memset under ifdef INET6.

MFC r273091:
  Add more ifdefs. SIOC*_IN6 are defined only with INET6.

MFC r273121:
  Add inet/inet6 to the dependency list. Without them if_gif is useless.

MFC r273209 by bz:
  After r273087,r273090,r273091,r273121 changes to gif(4) try to fix
  NOIP builds for real.

MFC r273587:
  Remove redundant check and m_pullup() call.
2014-12-23 16:33:44 +00:00
jch
0e426a7bb8 MFC r264321, r264342, r264351, r264356, r273850, r274629:
Currently, the TCP slow timer can starve TCP input processing while it
walks the list of connections in TIME_WAIT closing expired connections
due to contention on the global TCP pcbinfo lock.

To remediate, introduce a new global lock to protect the list of
connections in TIME_WAIT.  Only acquire the TCP pcbinfo lock when
closing an expired connection.  This limits the window of time when
TCP input processing is stopped to the amount of time needed to close
a single connection.

Approved by:    jhb (mentor)
2014-12-02 11:47:26 +00:00
hselasky
9fcf944d2a MFC r274376:
Fix some minor TSO issues:
- Improve description of TSO limits.
- Remove a not needed KASSERT()
- Remove some not needed variable casts.

Sponsored by:	Mellanox Technologies
2014-11-19 09:03:12 +00:00
bryanv
8677516401 MFC r272844:
Add missing UDP multicast receive dtrace probes
2014-11-08 02:53:55 +00:00
bryanv
520007fcf4 MFC r272797:
Check for mbuf copy failure when there are multiple multicast sockets

This partitular case is the only path where the mbuf could be NULL.
udp_append() checked for a NULL mbuf only after invoking the tunneling
callback. Our only in tree tunneling callback - SCTP - assumed a non
NULL mbuf, and it is a bit odd to make the callbacks responsible for
checking this condition.

This also reduces the differences between the IPv4 and IPv6 code.
2014-11-08 02:40:00 +00:00
hselasky
fa183f0174 MFC r271946 and r272595:
Improve transmit sending offload, TSO, algorithm in general. This
change allows all HCAs from Mellanox Technologies to function properly
when TSO is enabled. See r271946 and r272595 for more details about
this commit.

Sponsored by:	Mellanox Technologies
2014-11-03 12:38:29 +00:00
ae
33d2961d9a MFC r272770:
When tunneling interface is going to insert mbuf into netisr queue after stripping
  outer header, consider it as new packet and clear the protocols flags.

  This fixes problems when IPSEC traffic goes through various tunnels and router
  doesn't send ICMP/ICMPv6 errors.

PR:		174602
Sponsored by:	Yandex LLC
2014-10-30 13:53:57 +00:00