/[base]/head/sys/netinet6/in6.c
ViewVC logotype

Log of /head/sys/netinet6/in6.c

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (download) (annotate)
Sticky Revision:


Revision 365071 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 1 21:19:14 2020 UTC (3 years, 10 months ago) by mjg
File length: 67906 byte(s)
Diff to previous 364250
net: clean up empty lines in .c and .h files


Revision 364250 - (view) (download) (annotate) - [select for diffs]
Modified Sat Aug 15 11:37:44 2020 UTC (3 years, 10 months ago) by melifaro
File length: 67916 byte(s)
Diff to previous 362900
Make net.inet6.ip6.deembed_scopeid behaviour default & remove sysctl.

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Differential Revision:	https://reviews.freebsd.org/D25637


Revision 362900 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jul 2 21:04:08 2020 UTC (4 years ago) by melifaro
File length: 67941 byte(s)
Diff to previous 356755
Complete conversions from fib<4|6>_lookup_nh_<basic|ext> to fib<4|6>_lookup().

fib[46]_lookup_nh_ represents pre-epoch generation of fib api, providing less guarantees
 over pointer validness and requiring on-stack data copying.

With no callers remaining, remove fib[46]_lookup_nh_ functions.

Submitted by:	Neel Chauhan <neel AT neelc DOT org>
Differential Revision:	https://reviews.freebsd.org/D25445


Revision 356755 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 15 06:05:20 2020 UTC (4 years, 5 months ago) by glebius
File length: 67942 byte(s)
Diff to previous 356473
Introduce NET_EPOCH_CALL() macro and use it everywhere where we free
data based on the network epoch.   The macro reverses the argument
order of epoch_call(9) - first function, then its argument. NFC


Revision 356473 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 7 21:16:30 2020 UTC (4 years, 5 months ago) by melifaro
File length: 67974 byte(s)
Diff to previous 354865
Fix rtsock route message generation for interface addresses.

Reviewed by:	olivier
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D22974


Revision 354865 - (view) (download) (annotate) - [select for diffs]
Modified Tue Nov 19 21:14:15 2019 UTC (4 years, 7 months ago) by bz
File length: 67886 byte(s)
Diff to previous 353492
in6: move include

Move the include for sysctl.h out of the middle of the file to the
includes at the beginning.  This is will make it easier to add new
sysctls.

No functional changes.

MFC after:	3 weeks
Sponsored by:	Netflix


Revision 353492 - (view) (download) (annotate) - [select for diffs]
Modified Mon Oct 14 15:33:53 2019 UTC (4 years, 8 months ago) by glebius
File length: 67887 byte(s)
Diff to previous 353461
in6ifa_llaonifp() is never called from fast path, so do not require
epoch being entered.


Revision 353461 - (view) (download) (annotate) - [select for diffs]
Modified Sun Oct 13 04:25:16 2019 UTC (4 years, 8 months ago) by glebius
File length: 67839 byte(s)
Diff to previous 353292
Don't cover in6_ifattach() with network epoch, as it may call into
network drivers ioctls, that may sleep.

PR:		241223


Revision 353292 - (view) (download) (annotate) - [select for diffs]
Modified Mon Oct 7 22:40:05 2019 UTC (4 years, 8 months ago) by glebius
File length: 67839 byte(s)
Diff to previous 345739
Widen NET_EPOCH coverage.

When epoch(9) was introduced to network stack, it was basically
dropped in place of existing locking, which was mutexes and
rwlocks. For the sake of performance mutex covered areas were
as small as possible, so became epoch covered areas.

However, epoch doesn't introduce any contention, it just delays
memory reclaim. So, there is no point to minimise epoch covered
areas in sense of performance. Meanwhile entering/exiting epoch
also has non-zero CPU usage, so doing this less often is a win.

Not the least is also code maintainability. In the new paradigm
we can assume that at any stage of processing a packet, we are
inside network epoch. This makes coding both input and output
path way easier.

On output path we already enter epoch quite early - in the
ip_output(), in the ip6_output().

This patch does the same for the input path. All ISR processing,
network related callouts, other ways of packet injection to the
network stack shall be performed in net_epoch. Any leaf function
that walks network configuration now asserts epoch.

Tricky part is configuration code paths - ioctls, sysctls. They
also call into leaf functions, so some need to be changed.

This patch would introduce more epoch recursions (see EPOCH_TRACE)
than we had before. They will be cleaned up separately, as several
of them aren't trivial. Note, that unlike a lock recursion the
epoch recursion is safe and just wastes a bit of resources.

Reviewed by:	gallatin, hselasky, cy, adrian, kristof
Differential Revision:	https://reviews.freebsd.org/D19111


Revision 345739 - (view) (download) (annotate) - [select for diffs]
Modified Sat Mar 30 18:00:44 2019 UTC (5 years, 3 months ago) by markj
File length: 68218 byte(s)
Diff to previous 343364
Do not perform DAD on stf(4) interfaces.

stf(4) interfaces are not multicast-capable so they can't perform DAD.
They also did not set IFF_DRV_RUNNING when an address was assigned, so
the logic in nd6_timer() would periodically flag such an address as
tentative, resulting in interface flapping.

Fix the problem by setting IFF_DRV_RUNNING when an address is assigned,
and do some related cleanup:
- In in6if_do_dad(), remove a redundant check for !UP || !RUNNING.
  There is only one caller in the tree, and it only looks at whether
  the return value is non-zero.
- Have in6if_do_dad() return false if the interface is not
  multicast-capable.
- Set ND6_IFF_NO_DAD when an address is assigned to an stf(4) interface
  and the interface goes UP as a result. Note that this is not
  sufficient to fix the problem because the new address is marked as
  tentative and DAD is started before in6_ifattach() is called.
  However, setting no_dad is formally correct.
- Change nd6_timer() to not flag addresses as tentative if no_dad is
  set.

This is based on a patch from Viktor Dukhovni.

Reported by:	Viktor Dukhovni <ietf-dane@dukhovni.org>
Reviewed by:	ae
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19751


Revision 343364 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 23 22:19:49 2019 UTC (5 years, 5 months ago) by markj
File length: 68663 byte(s)
Diff to previous 343363
Style.

Reviewed by:	bz
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation


Revision 343363 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 23 22:18:23 2019 UTC (5 years, 5 months ago) by markj
File length: 68662 byte(s)
Diff to previous 342872
Fix an LLE lookup race.

After the afdata read lock was converted to epoch(9), readers could
observe a linked LLE and block on the LLE while a thread was
unlinking the LLE.  The writer would then release the lock and schedule
the LLE for deferred free, allowing readers to continue and potentially
schedule the LLE timer.  By the point the timer fires, the structure is
freed, typically resulting in a crash in the callout subsystem.

Fix the problem by modifying the lookup path to check for the LLE_LINKED
flag upon acquiring the LLE lock.  If it's not set, the lookup fails.

PR:		234296
Reviewed by:	bz
Tested by:	sbruno, Victor <chernov_victor@list.ru>,
		Mike Andrews <mandrews@bit0.com>
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D18906


Revision 342872 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 9 01:11:19 2019 UTC (5 years, 5 months ago) by glebius
File length: 68363 byte(s)
Diff to previous 339537
Mechanical cleanup of epoch(9) usage in network stack.

- Remove macros that covertly create epoch_tracker on thread stack. Such
  macros a quite unsafe, e.g. will produce a buggy code if same macro is
  used in embedded scopes. Explicitly declare epoch_tracker always.

- Unmask interface list IFNET_RLOCK_NOSLEEP(), interface address list
  IF_ADDR_RLOCK() and interface AF specific data IF_AFDATA_RLOCK() read
  locking macros to what they actually are - the net_epoch.
  Keeping them as is is very misleading. They all are named FOO_RLOCK(),
  while they no longer have lock semantics. Now they allow recursion and
  what's more important they now no longer guarantee protection against
  their companion WLOCK macros.
  Note: INP_HASH_RLOCK() has same problems, but not touched by this commit.

This is non functional mechanical change. The only functionally changed
functions are ni6_addrs() and ni6_store_addrs(), where we no longer enter
epoch recursively.

Discussed with:	jtl, gallatin


Revision 339537 - (view) (download) (annotate) - [select for diffs]
Modified Sun Oct 21 15:02:06 2018 UTC (5 years, 8 months ago) by ae
File length: 68144 byte(s)
Diff to previous 336405
Add ifaddr_event_ext event. It is similar to ifaddr_event, but the
handler receives the type of event IFADDR_EVENT_ADD/IFADDR_EVENT_DEL,
and the pointer to ifaddr. Also ifaddr_event now is implemented using
ifaddr_event_ext handler.

MFC after:	3 weeks
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D17100


Revision 336405 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jul 17 11:33:23 2018 UTC (5 years, 11 months ago) by ae
File length: 68016 byte(s)
Diff to previous 334193
Move invoking of callout_stop(&lle->lle_timer) into llentry_free().

This deduplicates the code a bit, and also implicitly adds missing
callout_stop() to in[6]_lltable_delete_entry() functions.

PR:		209682, 225927
Submitted by:	hselasky (previous version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D4605


Revision 334193 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 24 23:21:23 2018 UTC (6 years, 1 month ago) by mmacy
File length: 68076 byte(s)
Diff to previous 334118
CK: update consumers to use CK macros across the board

r334189 changed the fields to have names distinct from those in queue.h
in order to expose the oversights as compile time errors


Revision 334118 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 23 21:02:14 2018 UTC (6 years, 1 month ago) by mmacy
File length: 68061 byte(s)
Diff to previous 333813
UDP: further performance improvements on tx

Cumulative throughput while running 64
  netperf -H $DUT -t UDP_STREAM -- -m 1
on a 2x8x2 SKL went from 1.1Mpps to 2.5Mpps

Single stream throughput increases from 910kpps to 1.18Mpps

Baseline:
https://people.freebsd.org/~mmacy/2018.05.11/udpsender2.svg

- Protect read access to global ifnet list with epoch
https://people.freebsd.org/~mmacy/2018.05.11/udpsender3.svg

- Protect short lived ifaddr references with epoch
https://people.freebsd.org/~mmacy/2018.05.11/udpsender4.svg

- Convert if_afdata read lock path to epoch
https://people.freebsd.org/~mmacy/2018.05.11/udpsender5.svg

A fix for the inpcbhash contention is pending sufficient time
on a canary at LLNW.

Reviewed by:	gallatin
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15409


Revision 333813 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 18 20:13:34 2018 UTC (6 years, 1 month ago) by mmacy
File length: 67834 byte(s)
Diff to previous 333641
ifnet: Replace if_addr_lock rwlock with epoch + mutex

Run on LLNW canaries and tested by pho@

gallatin:
Using a 14-core, 28-HTT single socket E5-2697 v3 with a 40GbE MLX5
based ConnectX 4-LX NIC, I see an almost 12% improvement in received
packet rate, and a larger improvement in bytes delivered all the way
to userspace.

When the host receiving 64 streams of netperf -H $DUT -t UDP_STREAM -- -m 1,
I see, using nstat -I mce0 1 before the patch:

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
4.98   0.00   4.42   0.00 4235592     33   83.80 4720653 2149771   1235 247.32
4.73   0.00   4.20   0.00 4025260     33   82.99 4724900 2139833   1204 247.32
4.72   0.00   4.20   0.00 4035252     33   82.14 4719162 2132023   1264 247.32
4.71   0.00   4.21   0.00 4073206     33   83.68 4744973 2123317   1347 247.32
4.72   0.00   4.21   0.00 4061118     33   80.82 4713615 2188091   1490 247.32
4.72   0.00   4.21   0.00 4051675     33   85.29 4727399 2109011   1205 247.32
4.73   0.00   4.21   0.00 4039056     33   84.65 4724735 2102603   1053 247.32

After the patch

InMpps OMpps  InGbs  OGbs err TCP Est %CPU syscalls csw     irq GBfree
5.43   0.00   4.20   0.00 3313143     33   84.96 5434214 1900162   2656 245.51
5.43   0.00   4.20   0.00 3308527     33   85.24 5439695 1809382   2521 245.51
5.42   0.00   4.19   0.00 3316778     33   87.54 5416028 1805835   2256 245.51
5.42   0.00   4.19   0.00 3317673     33   90.44 5426044 1763056   2332 245.51
5.42   0.00   4.19   0.00 3314839     33   88.11 5435732 1792218   2499 245.52
5.44   0.00   4.19   0.00 3293228     33   91.84 5426301 1668597   2121 245.52

Similarly, netperf reports 230Mb/s before the patch, and 270Mb/s after the patch

Reviewed by:	gallatin
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15366


Revision 333641 - (view) (download) (annotate) - [select for diffs]
Modified Tue May 15 17:59:46 2018 UTC (6 years, 1 month ago) by brooks
File length: 67761 byte(s)
Diff to previous 333640
Unwrap some not-so-long lines now that extra tabs been removed.


Revision 333640 - (view) (download) (annotate) - [select for diffs]
Modified Tue May 15 17:57:46 2018 UTC (6 years, 1 month ago) by brooks
File length: 67783 byte(s)
Diff to previous 333362
Remove stray tabs in in6_lltable_dump_entry().  NFC.


Revision 333362 - (view) (download) (annotate) - [select for diffs]
Modified Tue May 8 11:39:01 2018 UTC (6 years, 1 month ago) by hselasky
File length: 67891 byte(s)
Diff to previous 333175
Fix for missing network interface address event when adding the default IPv6
based link-local address.

The default link local address for IPv6 is added as part of bringing the
network interface up. Move the call to "EVENTHANDLER_INVOKE(ifaddr_event,)"
from the SIOCAIFADDR_IN6 ioctl(2) handler to in6_notify_ifa() which should
catch all the cases of adding IPv6 based addresses to a network interface.
Add a witness warning in case the event handler is not allowed to sleep.

Reviewed by:	network (ae), kib
Differential Revision:	https://reviews.freebsd.org/D13407
MFC after:	1 week
Sponsored by:	Mellanox Technologies


Revision 333175 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 2 19:36:29 2018 UTC (6 years, 2 months ago) by shurd
File length: 67784 byte(s)
Diff to previous 332490
Separate list manipulation locking from state change in multicast

Multicast incorrectly calls in to drivers with a mutex held causing drivers
to have to go through all manner of contortions to use a non sleepable lock.
Serialize multicast updates instead.

Submitted by:	mmacy <mmacy@mattmacy.io>
Reviewed by:	shurd, sbruno
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D14969


Revision 332490 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 13 21:18:04 2018 UTC (6 years, 2 months ago) by brooks
File length: 67160 byte(s)
Diff to previous 332412
Remove support for the Arcnet protocol.

While Arcnet has some continued deployment in industrial controls, the
lack of drivers for any of the PCI, USB, or PCIe NICs on the market
suggests such users aren't running FreeBSD.

Evidence in the PR database suggests that the cm(4) driver (our sole
Arcnet NIC) was broken in 5.0 and has not worked since.

PR:		182297
Reviewed by:	jhibbits, vangyzen
Relnotes:	yes
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D15057


Revision 332412 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 11 17:28:24 2018 UTC (6 years, 2 months ago) by brooks
File length: 67207 byte(s)
Diff to previous 332122
Remove support for FDDI networks.

Defines in net/if_media.h remain in case code copied from ifconfig is in
use elsewere (supporting non-existant media type is harmless).

Reviewed by:	kib, jhb
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D15017


Revision 332122 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 6 17:35:35 2018 UTC (6 years, 2 months ago) by brooks
File length: 67253 byte(s)
Diff to previous 331831
Move most of the contents of opt_compat.h to opt_global.h.

opt_compat.h is mentioned in nearly 180 files. In-progress network
driver compabibility improvements may add over 100 more so this is
closer to "just about everywhere" than "only some files" per the
guidance in sys/conf/options.

Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of
sys/compat/linux/*.c.  A fake _COMPAT_LINUX option ensure opt_compat.h
is created on all architectures.

Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the
set of compiled files.

Reviewed by:	kib, cem, jhb, jtl
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14941


Revision 331831 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 30 21:38:53 2018 UTC (6 years, 3 months ago) by brooks
File length: 67277 byte(s)
Diff to previous 331776
Document and enforce assumptions about struct (in6_)ifreq.

- The two types must be type-punnable for shared members of ifr_ifru.
  This allows compatibility accessors to be shared.

- There must be no padding gap between ifr_name and ifr_ifru.  This is
  assumed in tcpdump's use of SIOCGIFFLAGS output which attempts to be
  broadly portable.  This is true for all current architectures, but very
  large (256-bit) fat-pointers could violate this invariant.

Reviewed by:	kib
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14910


Revision 331776 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 30 18:26:29 2018 UTC (6 years, 3 months ago) by brooks
File length: 66986 byte(s)
Diff to previous 331714
Remove a comment that suggests checking that a non-pointer is non-NULL.

Reviewed by:	melifaro, markj, hrs, ume
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14904


Revision 331714 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 28 23:33:26 2018 UTC (6 years, 3 months ago) by brooks
File length: 67072 byte(s)
Diff to previous 331098
Remove infrastructure for token-ring networks.

Reviewed by:	cem, imp, jhb, jmallett
Relnotes:	yes
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D14875


Revision 331098 - (view) (download) (annotate) - [select for diffs]
Modified Sat Mar 17 17:05:48 2018 UTC (6 years, 3 months ago) by melifaro
File length: 67144 byte(s)
Diff to previous 328296
Fix outgoing TCP/UDP packet drop on arp/ndp entry expiration.

Current arp/nd code relies on the feedback from the datapath indicating
 that the entry is still used. This mechanism is incorporated into the
 arpresolve()/nd6_resolve() routines. After the inpcb route cache
 introduction, the packet path for the locally-originated packets changed,
 passing cached lle pointer to the ether_output() directly. This resulted
 in the arp/ndp entry expire each time exactly after the configured max_age
 interval. During the small window between the ARP/NDP request and reply
 from the router, most of the packets got lost.

Fix this behaviour by plugging datapath notification code to the packet
 path used by route cache. Unify the notification code by using single
 inlined function with the per-AF callbacks.

Reported by:	sthaug at nethelp.no
Reviewed by:	ae
MFC after:	2 weeks


Revision 328296 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 23 19:40:05 2018 UTC (6 years, 5 months ago) by asomers
File length: 66736 byte(s)
Diff to previous 326023
sys/netinet6: fix typos in comments.  No functional change.

MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp


Revision 326023 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 20 19:43:44 2017 UTC (6 years, 7 months ago) by pfg
File length: 66730 byte(s)
Diff to previous 315458
sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


Revision 315458 - (view) (download) (annotate) - [select for diffs]
Modified Fri Mar 17 16:50:37 2017 UTC (7 years, 3 months ago) by asomers
File length: 66686 byte(s)
Diff to previous 314436
Constrain IPv6 routes to single FIBs when net.add_addr_allfibs=0

sys/netinet6/icmp6.c
	Use the interface's FIB for source address selection in ICMPv6 error
	responses.

sys/netinet6/in6.c
	In in6_newaddrmsg, announce arrival of local addresses on the
	interface's FIB only.  In in6_lltable_rtcheck, use a per-fib ND6
	cache instead of a single cache.

sys/netinet6/in6_src.c
	In in6_selectsrc, use the caller's fib instead of the default fib.
	In in6_selectsrc_socket, remove a superfluous check.

sys/netinet6/nd6.c
	In nd6_lle_event, use the interface's fib for routing socket
	messages.  In nd6_is_new_addr_neighbor, check all FIBs when trying
	to determine whether an address is a neighbor.  Also, simplify the
	code for point to point interfaces.

sys/netinet6/nd6.h
sys/netinet6/nd6.c
sys/netinet6/nd6_rtr.c
	Make defrouter_select fib-aware, and make all of its callers pass in
	the interface fib.

sys/netinet6/nd6_nbr.c
	When inputting a Neighbor Solicitation packet, consider the
	interface fib instead of the default fib for DAD.  Output NS and
	Neighbor Advertisement packets on the correct fib.

sys/netinet6/nd6_rtr.c
	Allow installing the same host route on different interfaces in
	different FIBs.  If rt_add_addr_allfibs=0, only install or delete
	the prefix route on the interface fib.

tests/sys/netinet/fibs_test.sh
	Clear some expected failures, but add a skip for the newly revealed
	BUG217871.

PR:		196361
Submitted by:	Erick Turnquist <jhujhiti@adjectivism.org>
Reported by:	Jason Healy <jhealy@logn.net>
Reviewed by:	asomers
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D9451


Revision 314436 - (view) (download) (annotate) - [select for diffs]
Modified Tue Feb 28 23:42:47 2017 UTC (7 years, 4 months ago) by imp
File length: 66588 byte(s)
Diff to previous 312929
Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96


Revision 312929 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 28 17:08:40 2017 UTC (7 years, 5 months ago) by avos
File length: 66588 byte(s)
Diff to previous 312770
Garbage collect IFT_IEEE80211 (but leave the define for possible reuse)

This interface type ("a parent interface of wlanX") is not used since
r287197

Reviewed by:	adrian, glebius
Differential Revision:	https://reviews.freebsd.org/D9308


Revision 312770 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 25 19:04:08 2017 UTC (7 years, 5 months ago) by loos
File length: 66621 byte(s)
Diff to previous 306829
After the in_control() changes in r257692, an existing address is
(intentionally) deleted first and then completely added again (so all the
events, announces and hooks are given a chance to run).

This cause an issue with CARP where the existing CARP data structure is
removed together with the last address for a given VHID, which will cause
a subsequent fail when the address is later re-added.

This change fixes this issue by adding a new flag to keep the CARP data
structure when an address is not being removed.

There was an additional issue with IPv6 CARP addresses, where the CARP data
structure would never be removed after a change and lead to VHIDs which
cannot be destroyed.

Reviewed by:	glebius
Obtained from:	pfSense
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)


Revision 306829 - (view) (download) (annotate) - [select for diffs]
Modified Fri Oct 7 21:10:53 2016 UTC (7 years, 8 months ago) by markj
File length: 66532 byte(s)
Diff to previous 306285
Lock the ND prefix list and add refcounting for prefixes.

This change extends the nd6 lock to protect the ND prefix list as well
as the list of advertising routers associated with each prefix. To handle
cases where the nd6 lock must be dropped while iterating over either the
prefix or default router lists, a generation counter is used to track
modifications to the lists. Additionally, a new mutex is used to serialize
prefix on-link/off-link transitions. This mutex must be acquired before
the nd6 lock and is held while updating the routing table in
nd6_prefix_onlink() and nd6_prefix_offlink().

Reviewed by:	ae, tuexen (SCTP bits)
Tested by:	Jason Wolfe <jason@llnw.com>,
		Larry Rosenman <ler@lerctr.org>
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D8125


Revision 306285 - (view) (download) (annotate) - [select for diffs]
Modified Sat Sep 24 01:14:25 2016 UTC (7 years, 9 months ago) by markj
File length: 66429 byte(s)
Diff to previous 302081
Rename ndpr_refcnt to ndpr_addrcnt.

This field counts derived addresses and is not a true refcount for prefix
objects, so the previous name was misleading.

MFC after:	1 week


Revision 302081 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 22 11:29:21 2016 UTC (8 years ago) by ae
File length: 66423 byte(s)
Diff to previous 302054
Fix the NULL pointer dereference for unresolved link layer entries in
the netinet6 code. Copy link layer address only when corresponding entry
has LLE_VALID flag.

PR:		210379
Approved by:	re (kib)


Revision 302054 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jun 21 13:48:49 2016 UTC (8 years ago) by bz
File length: 66281 byte(s)
Diff to previous 301875
Get closer to a VIMAGE network stack teardown from top to bottom rather
than removing the network interfaces first. This change is rather larger
and convoluted as the ordering requirements cannot be separated.

Move the pfil(9) framework to SI_SUB_PROTO_PFIL, move Firewalls and
related modules to their own SI_SUB_PROTO_FIREWALL.
Move initialization of "physical" interfaces to SI_SUB_DRIVERS,
move virtual (cloned) interfaces to SI_SUB_PSEUDO.
Move Multicast to SI_SUB_PROTO_MC.

Re-work parts of multicast initialisation and teardown, not taking the
huge amount of memory into account if used as a module yet.

For interface teardown we try to do as many of them as we can on
SI_SUB_INIT_IF, but for some this makes no sense, e.g., when tunnelling
over a higher layer protocol such as IP. In that case the interface
has to go along (or before) the higher layer protocol is shutdown.

Kernel hhooks need to go last on teardown as they may be used at various
higher layers and we cannot remove them before we cleaned up the higher
layers.

For interface teardown there are multiple paths:
(a) a cloned interface is destroyed (inside a VIMAGE or in the base system),
(b) any interface is moved from a virtual network stack to a different
network stack ("vmove"), or (c) a virtual network stack is being shut down.
All code paths go through if_detach_internal() where we, depending on the
vmove flag or the vnet state, make a decision on how much to shut down;
in case we are destroying a VNET the individual protocol layers will
cleanup their own parts thus we cannot do so again for each interface as
we end up with, e.g., double-frees, destroying locks twice or acquiring
already destroyed locks.
When calling into protocol cleanups we equally have to tell them
whether they need to detach upper layer protocols ("ulp") or not
(e.g., in6_ifdetach()).

Provide or enahnce helper functions to do proper cleanup at a protocol
rather than at an interface level.

Approved by:		re (hrs)
Obtained from:		projects/vnet
Reviewed by:		gnn, jhb
Sponsored by:		The FreeBSD Foundation
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D6747


Revision 301875 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jun 13 22:31:16 2016 UTC (8 years ago) by pfg
File length: 66276 byte(s)
Diff to previous 299824
Remove the SIOCSIFALIFETIME_IN6 ioctl.

The SIOCSIFALIFETIME_IN6 provided by the kame project is unused,
it can't really be used safely and has been completely removed from
NetBSD and OpenBSD.

Obtained from:	NetBSD (kern/35897)
PR:		210148 (exp-run)
Reviewed by:	ae, hrs
Relnotes:	yes
Approved by:	re (glebius)
Differential Revision:	https://reviews.freebsd.org/D5491


Revision 299824 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 15 03:01:40 2016 UTC (8 years, 1 month ago) by markj
File length: 67411 byte(s)
Diff to previous 299213
Remove an always-false error check in the AIFADDR_IN6 handler.

CID:		1250792
MFC after:	1 week


Revision 299213 - (view) (download) (annotate) - [select for diffs]
Modified Sat May 7 03:41:29 2016 UTC (8 years, 1 month ago) by markj
File length: 67452 byte(s)
Diff to previous 298995
Clean up callers of nd6_prelist_add().

nd6_prelist_add() sets *newp if and only if it is successful, so there's no
need for code that handles the case where the return value is 0 and
*newp == NULL. Fix some style bugs in nd6_prelist_add() while here.

MFC after:	1 week


Revision 298995 - (view) (download) (annotate) - [select for diffs]
Modified Tue May 3 18:05:43 2016 UTC (8 years, 2 months ago) by pfg
File length: 67645 byte(s)
Diff to previous 298675
sys/net*: minor spelling fixes.

No functional change.


Revision 298675 - (view) (download) (annotate) - [select for diffs]
Modified Tue Apr 26 23:13:48 2016 UTC (8 years, 2 months ago) by cem
File length: 67644 byte(s)
Diff to previous 298075
in_lltable_alloc and in6 copy: Don't leak LLE in error path

Fix a memory leak in error conditions introduced in r292978.

Reported by:	Coverity
CIDs:		1347009, 1347010
Sponsored by:	EMC / Isilon Storage Division


Revision 298075 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 15 17:30:33 2016 UTC (8 years, 2 months ago) by pfg
File length: 67477 byte(s)
Diff to previous 297403
sys/net* : for pointers replace 0 with NULL.

Mostly cosmetical, no functional change.

Found with devel/coccinelle.


Revision 297403 - (view) (download) (annotate) - [select for diffs]
Modified Wed Mar 30 00:03:59 2016 UTC (8 years, 3 months ago) by markj
File length: 67474 byte(s)
Diff to previous 295720
Fix the lladdr copy in in6_lltable_dump_entry() after r292978.

This bug caused "ndp -a" to show the wrong link layer address for neighbour
cache entries.

PR:	208067


Revision 295720 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 17 21:17:14 2016 UTC (8 years, 4 months ago) by glebius
File length: 67475 byte(s)
Diff to previous 292978
Ternary operator has lower priority than OR.

Found by:	PVS-Studio


Revision 292978 - (view) (download) (annotate) - [select for diffs]
Modified Thu Dec 31 05:03:27 2015 UTC (8 years, 6 months ago) by melifaro
File length: 67475 byte(s)
Diff to previous 292953
Implement interface link header precomputation API.

Add if_requestencap() interface method which is capable of calculating
  various link headers for given interface. Right now there is support
  for INET/INET6/ARP llheader calculation (IFENCAP_LL type request).
  Other types are planned to support more complex calculation
  (L2 multipath lagg nexthops, tunnel encap nexthops, etc..).

Reshape 'struct route' to be able to pass additional data (with is length)
  to prepend to mbuf.

These two changes permits routing code to pass pre-calculated nexthop data
  (like L2 header for route w/gateway) down to the stack eliminating the
  need for other lookups. It also brings us closer to more complex scenarios
  like transparently handling MPLS nexthops and tunnel interfaces.
  Last, but not least, it removes layering violation introduced by flowtable
  code (ro_lle) and simplifies handling of existing if_output consumers.

ARP/ND changes:
Make arp/ndp stack pre-calculate link header upon installing/updating lle
  record. Interface link address change are handled by re-calculating
  headers for all lles based on if_lladdr event. After these changes,
  arpresolve()/nd6_resolve() returns full pre-calculated header for
  supported interfaces thus simplifying if_output().
Move these lookups to separate ether_resolve_addr() function which ether
  returs error or fully-prepared link header. Add <arp|nd6_>resolve_addr()
  compat versions to return link addresses instead of pre-calculated data.

BPF changes:
Raw bpf writes occupied _two_ cases: AF_UNSPEC and pseudo_AF_HDRCMPLT.
Despite the naming, both of there have ther header "complete". The only
  difference is that interface source mac has to be filled by OS for
  AF_UNSPEC (controlled via BIOCGHDRCMPLT). This logic has to stay inside
  BPF and not pollute if_output() routines. Convert BPF to pass prepend data
  via new 'struct route' mechanism. Note that it does not change
  non-optimized if_output(): ro_prepend handling is purely optional.
Side note: hackish pseudo_AF_HDRCMPLT is supported for ethernet and FDDI.
  It is not needed for ethernet anymore. The only remaining FDDI user is
  dev/pdq mostly untouched since 2007. FDDI support was eliminated from
  OpenBSD in 2013 (sys/net/if_fddisubr.c rev 1.65).

Flowtable changes:
  Flowtable violates layering by saving (and not correctly managing)
  rtes/lles. Instead of passing lle pointer, pass pointer to pre-calculated
  header data from that lle.

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


Revision 292953 - (view) (download) (annotate) - [select for diffs]
Modified Wed Dec 30 17:10:03 2015 UTC (8 years, 6 months ago) by bz
File length: 67223 byte(s)
Diff to previous 292836
This code is not in modules that need KPI stability so no need to use
the wrapper functions as used in r252511.  We can directly use the
locking macros.

Reviewed by:		jtl, rwatson
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D4731


Revision 292836 - (view) (download) (annotate) - [select for diffs]
Modified Mon Dec 28 18:29:47 2015 UTC (8 years, 6 months ago) by wollman
File length: 67223 byte(s)
Diff to previous 292402
in6_if2idlen: treat bridge(4) interfaces like other Ethernet interfaces

bridge(4) interfaces have an if_type of IFT_BRIDGE, rather than
IFT_ETHER, even though they only support Ethernet-style links.  This
caused in6_if2idlen to emit an "unknown link type (209)" warning to
the console every time it was called.  Add IFT_BRIDGE to the case
statement in the appropriate place, indicating that it uses the same
IPv6 address format as other Ethernet-like interfaces.

MFC after:	1 week


Revision 292402 - (view) (download) (annotate) - [select for diffs]
Modified Thu Dec 17 14:41:30 2015 UTC (8 years, 6 months ago) by smh
File length: 67159 byte(s)
Diff to previous 292333
Revert r292275 & r292379

glebius has concerns about these changes so reverting those can be discussed
and addressed.

Sponsored by:	Multiplay


Revision 292333 - (view) (download) (annotate) - [select for diffs]
Modified Wed Dec 16 10:14:16 2015 UTC (8 years, 6 months ago) by melifaro
File length: 67160 byte(s)
Diff to previous 292275
Provide additional lle data in IPv6 lltable dump used by ndp(8).

Before the change, things like lle state were queried via
  SIOCGNBRINFO_IN6 by ndp(8) for _each_ lle entry in dump.
This ioctl was added in 1999, probably to avoid touching rtsock code.

This change maps SIOCGNBRINFO_IN6 data to standard rtsock dump the
 following way:
  expire (already) maps to rtm_rmx.rmx_expire
  isrouter -> rtm_flags & RTF_GATEWAY
  asked -> rtm_rmx.rmx_pksent
  state -> rtm_rmx.rmx_state (maps to rmx_weight via define)

Reviewed by:	ae


Revision 292275 - (view) (download) (annotate) - [select for diffs]
Modified Tue Dec 15 16:02:11 2015 UTC (8 years, 6 months ago) by smh
File length: 66891 byte(s)
Diff to previous 292219
Fix lagg failover due to missing notifications

When using lagg failover mode neither Gratuitous ARP (IPv4) or Unsolicited
Neighbour Advertisements (IPv6) are sent to notify other nodes that the
address may have moved.

This results is slow failover, dropped packets and network outages for the
lagg interface when the primary link goes down.

We now use the new if_link_state_change_cond with the force param set to
allow lagg to force through link state changes and hence fire a
ifnet_link_event which are now monitored by rip and nd6.

Upon receiving these events each protocol trigger the relevant
notifications:
* inet4 => Gratuitous ARP
* inet6 => Unsolicited Neighbour Announce

This also fixes the carp IPv6 NA's that stopped working after r251584 which
added the ipv6_route__llma route.

The new behavour can be controlled using the sysctls:
* net.link.ether.inet.arp_on_link
* net.inet6.icmp6.nd6_on_link

Also removed unused param from lagg_port_state and added descriptions for the
sysctls while here.

PR:		156226
MFC after:	1 month
Sponsored by:	Multiplay
Differential Revision:	https://reviews.freebsd.org/D4111


Revision 292219 - (view) (download) (annotate) - [select for diffs]
Modified Mon Dec 14 19:44:49 2015 UTC (8 years, 6 months ago) by kp
File length: 66890 byte(s)
Diff to previous 292155
inet6: Do not assume every interface has ip6 enabled.

Certain interfaces (e.g. pfsync0) do not have ip6 addresses (in other words,
ifp->if_afdata[AF_INET6] is NULL). Ensure we don't panic when the MTU is
updated.

pfsync interfaces will never have ip6 support, because it's explicitly disabled
in in6_domifattach().

PR:		205194
Reviewed by:	melifaro, hrs
Differential Revision:	https://reviews.freebsd.org/D4522


Revision 292155 - (view) (download) (annotate) - [select for diffs]
Modified Sun Dec 13 07:39:49 2015 UTC (8 years, 6 months ago) by melifaro
File length: 66829 byte(s)
Diff to previous 292015
Remove LLE read lock from IPv6 fast path.

LLE structure is mostly unchanged during its lifecycle: there are only 2
things relevant for fast path lookup code:
1) link-level address change. Since r286722, these updates are performed
  under AFDATA WLOCK.
2) Some sort of feedback indicating that this particular entry is used so
  we send NS to perform reachability verification instead of expiring entry.
  The only signal that is needed from fast path is something like binary
  yes/no.
The latter is solved by the following changes:

Special r_skip_req (introduced in D3688) value is used for fast path feedback.
  It is read lockless by fast path, but updated under req_mutex mutex. If this
  field is non-zero, then fast path will acquire lock and set it back to 0.

After transitioning to STALE state, callout timer is armed to run each
  V_nd6_delay seconds to make sure that if packet was transmitted at the start
  of given interval, we would be able to switch to PROBE state in V_nd6_delay
  seconds as user expects.
(in STALE state) timer is rescheduled until original V_nd6_gctimer expires
  keeping lle in STALE state (remaining timer value stored in lle_remtime).
(in STALE state) timer is rescheduled if packet was transmitted less that
  V_nd6_delay seconds ago to make sure we transition to PROBE state exactly
  after V_n6_delay seconds.

As a result, all packets towards lle in REACHABLE/STALE/PROBE states are handled
  by fast path without acquiring lle read lock.

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


Revision 292015 - (view) (download) (annotate) - [select for diffs]
Modified Wed Dec 9 11:14:27 2015 UTC (8 years, 6 months ago) by melifaro
File length: 66610 byte(s)
Diff to previous 290805
Make in_arpinput(), inp_lookup_mcast_ifp(), icmp_reflect(),
  ip_dooptions(), icmp6_redirect_input(), in6_lltable_rtcheck(),
  in6p_lookup_mcast_ifp() and in6_selecthlim() use new routing api.

Eliminate now-unused ip_rtaddr().
Fix lookup key fib6_lookup_nh_basic() which was lost diring merge.
Make fib6_lookup_nh_basic() and fib6_lookup_nh_extended() always
  return IPv6 destination address with embedded scope. Currently
  rw_gateway has it scope embedded, do the same for non-gatewayed
  destinations.

Sponsored by:	Yandex LLC


Revision 290805 - (view) (download) (annotate) - [select for diffs]
Modified Fri Nov 13 22:51:35 2015 UTC (8 years, 7 months ago) by rrs
File length: 66584 byte(s)
Diff to previous 290486
This fixes several places where callout_stops return is examined. The
new return codes of -1 were mistakenly being considered "true". Callout_stop
now returns -1 to indicate the callout had either already completed or
was not running and 0 to indicate it could not be stopped.  Also update
the manual page to make it more consistent no non-zero in the callout_stop
or callout_reset descriptions.

MFC after:	1 Month with associated callout change.


Revision 290486 - (view) (download) (annotate) - [select for diffs]
Modified Sat Nov 7 11:12:00 2015 UTC (8 years, 7 months ago) by melifaro
File length: 66580 byte(s)
Diff to previous 288297
Unify setting lladdr for AF_INET[6].


Revision 288297 - (view) (download) (annotate) - [select for diffs]
Modified Sun Sep 27 04:54:29 2015 UTC (8 years, 9 months ago) by melifaro
File length: 66599 byte(s)
Diff to previous 287789
rtsock requests for deleting interface address lles started to return EPERM
  instead of old "ignore-and-return 0" in r287789. This broke arp -da /
  ndp -cn behavior (they exit on rtsock command failure). Fix this by
  translating LLE_IFADDR to RTM_PINNED flag, passing it to userland and
  making arp/ndp ignore these entries in batched delete.

MFC after:	2 weeks


Revision 287789 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 14 16:48:19 2015 UTC (8 years, 9 months ago) by melifaro
File length: 66526 byte(s)
Diff to previous 287617
* Do more fine-grained locking: call eventhandlers/free_entry
  without holding afdata wlock
* convert per-af delete_address callback to global lltable_delete_entry() and
  more low-level "delete this lle" per-af callback
* fix some bugs/inconsistencies in IPv4/IPv6 ifscrub procedures

Sponsored by:		Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D3573


Revision 287617 - (view) (download) (annotate) - [select for diffs]
Modified Thu Sep 10 08:37:03 2015 UTC (8 years, 9 months ago) by hrs
File length: 66518 byte(s)
Diff to previous 287609
Remove SIOCGDRLST_IN6 and SIOCGPRLST_IN6 forgotten in the previous commit.

MFC after:	3 days


Revision 287609 - (view) (download) (annotate) - [select for diffs]
Modified Thu Sep 10 06:10:30 2015 UTC (8 years, 9 months ago) by hrs
File length: 66562 byte(s)
Diff to previous 287478
Do not add IN6_IFF_TENTATIVE when ND6_IFF_NO_DAD.

MFC after:	3 days


Revision 287478 - (view) (download) (annotate) - [select for diffs]
Modified Sat Sep 5 06:24:00 2015 UTC (8 years, 9 months ago) by melifaro
File length: 66548 byte(s)
Diff to previous 287477
Do not skip entries without LLE_VALID flag.
This one fixes showing incomplete entries in ndp -an.

MFC after:	2 weeks


Revision 287477 - (view) (download) (annotate) - [select for diffs]
Modified Sat Sep 5 05:54:09 2015 UTC (8 years, 9 months ago) by melifaro
File length: 66558 byte(s)
Diff to previous 287318
Make in6ifa_ifpwithaddr() take const param.
Remove unneded DECONST from in6_lltable_rtcheck().


Revision 287318 - (view) (download) (annotate) - [select for diffs]
Modified Mon Aug 31 05:03:36 2015 UTC (8 years, 10 months ago) by melifaro
File length: 66637 byte(s)
Diff to previous 287094
Simplify lla_rt_output()/nd6_add_ifa_lle() by setting lle state in
  alloc handler, based on flags.


Revision 287094 - (view) (download) (annotate) - [select for diffs]
Modified Mon Aug 24 05:21:49 2015 UTC (8 years, 10 months ago) by hrs
File length: 66556 byte(s)
Diff to previous 286955
- Deprecate IN6_IFF_NODAD.  It was used to prevent DAD on a loopback
  interface but in6if_do_dad() already had a check for IFF_LOOPBACK.

- Remove in6if_do_dad() check in in6_broadcast_ifa().  An address
  which needs DAD always has IN6_IFF_TENTATIVE there.

- in6if_do_dad() now returns EAGAIN when the interface is not ready
  since DAD callout handler ignores such an interface.

- In DAD callout handler, mark an address as IN6_IFF_TENTATIVE
  when the interface has ND6_IFF_IFDISABLED.  And Do IFF_UP and
  IFF_DRV_RUNNING check consistently when DAD is required.

- draft-ietf-6man-enhanced-dad is now published as RFC 7527.

- Fix some typos.


Revision 286955 - (view) (download) (annotate) - [select for diffs]
Modified Thu Aug 20 12:05:17 2015 UTC (8 years, 10 months ago) by melifaro
File length: 66703 byte(s)
Diff to previous 286629
* Split allocation and table linking for lle's.
  Before that, the logic besides lle_create() was the following:
  return existing if found, create if not. This behaviour was error-prone
  since we had to deal with 'sudden' static<>dynamic lle changes.
  This commit fixes bunch of different issues like:
  - refcount leak when lle is converted to static.
    Simple check case:
    console 1:
    while true;
      do for i in `arp -an|awk '$4~/incomp/{print$2}'|tr -d '()'`;
        do arp -s $i 00:22:44:66:88:00 ; arp -d $i;
      done;
    done
   console 2:
    ping -f any-dead-host-in-L2
   console 3:
    # watch for memory consumption:
    vmstat -m | awk '$1~/lltable/{print$2}'
  - possible problems in arptimer() / nd6_timer() when dropping/reacquiring
   lock.
  New logic explicitly handles use-or-create cases in every lla_create
  user. Basically, most of the changes are purely mechanical. However,
  we explicitly avoid using existing lle's for interface/static LLE records.
* While here, call lle_event handlers on all real table lle change.
* Create lltable_free_entry() calling existing per-lltable
  lle_free_t callback for entry deletion


Revision 286629 - (view) (download) (annotate) - [select for diffs]
Modified Tue Aug 11 12:38:54 2015 UTC (8 years, 10 months ago) by melifaro
File length: 66890 byte(s)
Diff to previous 286624
Use single 'lle_timer' callout in lltable instead of
  two different names of the same timer.


Revision 286624 - (view) (download) (annotate) - [select for diffs]
Modified Tue Aug 11 09:26:11 2015 UTC (8 years, 10 months ago) by melifaro
File length: 66891 byte(s)
Diff to previous 286616
Store addresses instead of sockaddrs inside llentry.
This permits us having all (not fully true yet) all the info
needed in lookup process in first 64 bytes of 'struct llentry'.

struct llentry layout:
BEFORE:
[rwlock .. state .. state .. MAC ] (lle+1) [sockaddr_in[6]]
AFTER
[ in[6]_addr MAC .. state .. rwlock ]

Currently, address part of struct llentry has only 16 bytes for the key.
However, lltable does not restrict any custom lltable consumers with long
keys use the previous approach (store key at (lle+1)).

Sponsored by:	Yandex LLC


Revision 286616 - (view) (download) (annotate) - [select for diffs]
Modified Tue Aug 11 05:51:00 2015 UTC (8 years, 10 months ago) by melifaro
File length: 67146 byte(s)
Diff to previous 286577
MFP r276712.

* Split lltable_init() into lltable_allocate_htbl() (alloc
  hash table with default callbacks) and lltable_link() (
  links any lltable to the list).
* Switch from LLTBL_HASHTBL_SIZE to per-lltable hash size field.
* Move lltable setup to separate functions in in[6]_domifattach.


Revision 286577 - (view) (download) (annotate) - [select for diffs]
Modified Mon Aug 10 12:03:59 2015 UTC (8 years, 10 months ago) by melifaro
File length: 67047 byte(s)
Diff to previous 286478
Partially merge r274887,r275334,r275577,r275578,r275586 to minimize
differences between projects/routing and HEAD.

This commit tries to keep code logic the same while changing underlying
code to use unified callbacks.

* Add llt_foreach_entry method to traverse all entries in given llt
* Add llt_dump_entry method to export particular lle entry in sysctl/rtsock
  format (code is not indented properly to minimize diff). Will be fixed
  in the next commits.
* Add llt_link_entry/llt_unlink_entry methods to link/unlink particular lle.
* Add llt_fill_sa_entry method to export address in the lle to sockaddr
  format.
* Add llt_hash method to use in generic hash table support code.
* Add llt_free_entry method which is used in llt_prefix_free code.

* Prepare for fine-grained locking by separating lle unlink and deletion in
  lltable_free() and lltable_prefix_free().

* Provide lltable_get<ifp|af>() functions to reduce direct 'struct lltable'
 access by external callers.

* Remove @llt agrument from lle_free() lle callback since it was unused.
* Temporarily add L3_CADDR() macro for 'const' sockaddr typecasting.
* Switch to per-af hashing code.
* Rename LLE_FREE_LOCKED() callback from in[6]_lltable_free() to
  in_[6]lltable_destroy() to avoid clashing with llt_free_entry() method.
  Update description from these functions.
* Use unified lltable_free_entry() function instead of per-af one.

Reviewed by:	ae


Revision 286478 - (view) (download) (annotate) - [select for diffs]
Modified Sat Aug 8 21:41:59 2015 UTC (8 years, 10 months ago) by marius
File length: 66614 byte(s)
Diff to previous 286457
Fix compilation after r286457 w/o INVARIANTS or INVARIANT_SUPPORT.


Revision 286457 - (view) (download) (annotate) - [select for diffs]
Modified Sat Aug 8 17:48:54 2015 UTC (8 years, 10 months ago) by melifaro
File length: 66666 byte(s)
Diff to previous 286001
MFP r274553:
* Move lle creation/deletion from lla_lookup to separate functions:
  lla_lookup(LLE_CREATE) -> lla_create
  lla_lookup(LLE_DELETE) -> lla_delete
lla_create now returns with LLE_EXCLUSIVE lock for lle.
* Provide typedefs for new/existing lltable callbacks.

Reviewed by:	ae


Revision 286001 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jul 29 08:12:05 2015 UTC (8 years, 11 months ago) by ae
File length: 65529 byte(s)
Diff to previous 285710
Convert in_ifaddr_lock and in6_ifaddr_lock to rmlock.

Both are used to protect access to IP addresses lists and they can be
acquired for reading several times per packet. To reduce lock contention
it is better to use rmlock here.

Reviewed by:	gnn (previous version)
Obtained from:	Yandex LLC
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D3149


Revision 285710 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 20 06:54:50 2015 UTC (8 years, 11 months ago) by ae
File length: 65147 byte(s)
Diff to previous 283696
Invoke LLE event handler when entry is deleted.

MFC after:	2 weeks
Sponsored by:	Yandex LLC


Revision 283696 - (view) (download) (annotate) - [select for diffs]
Modified Fri May 29 10:24:16 2015 UTC (9 years, 1 month ago) by ae
File length: 65090 byte(s)
Diff to previous 282354
Move RTM announces into generic code to be independent from Layer2 code.
This fixes bug introduced in 274988, when announces about new addresses
don't sent for tunneling interfaces.

Reported by:	tuexen@
MFC after:	1 week


Revision 282354 - (view) (download) (annotate) - [select for diffs]
Modified Sat May 2 20:31:27 2015 UTC (9 years, 2 months ago) by glebius
File length: 65027 byte(s)
Diff to previous 281656
Remove #ifdef IFT_FOO.

Submitted by:	Guy Yur <guyyur gmail.com>


Revision 281656 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 17 15:26:08 2015 UTC (9 years, 2 months ago) by glebius
File length: 65159 byte(s)
Diff to previous 281649
Fix r281649: don't call in6_clearscope() twice.

Submitted by:	ae


Revision 281649 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 17 11:57:06 2015 UTC (9 years, 2 months ago) by glebius
File length: 65183 byte(s)
Diff to previous 279676
Provide functions to determine presence of a given address
configured on a given interface.

Discussed with:	np
Sponsored by:	Nginx, Inc.


Revision 279676 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 5 21:27:49 2015 UTC (9 years, 4 months ago) by hrs
File length: 64557 byte(s)
Diff to previous 278472
- Implement loopback probing state in enhanced DAD algorithm.

- Add no_dad and ignoreloop per-IF knob.  no_dad disables DAD completely,
  and ignoreloop is to prevent infinite loop in loopback probing state when
  loopback is permanently expected.


Revision 278472 - (view) (download) (annotate) - [select for diffs]
Modified Mon Feb 9 19:28:11 2015 UTC (9 years, 4 months ago) by rrs
File length: 64506 byte(s)
Diff to previous 278268
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.

Commented upon by hiren and sbruno
See Phabricator D1777 for more details.

Commented upon by hiren and sbruno
Reviewed by:	adrian, jhb and bz
Sponsored by:	Netflix Inc.


Revision 278268 - (view) (download) (annotate) - [select for diffs]
Modified Thu Feb 5 16:29:26 2015 UTC (9 years, 4 months ago) by ae
File length: 64556 byte(s)
Diff to previous 274346
Print IPv6 address in log message instead of address of pointer.

MFC after:	1 week


Revision 274346 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 10 16:01:31 2014 UTC (9 years, 7 months ago) by ae
File length: 64494 byte(s)
Diff to previous 274345
Remove link-local multicast routes remnants from in6_purgeaddr.
Also merge in6_purgeaddr_mc with in6_purgeaddr.

Sponsored by:	Yandex LLC


Revision 274345 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 10 15:56:30 2014 UTC (9 years, 7 months ago) by glebius
File length: 65237 byte(s)
Diff to previous 274331
Consistently use if_link.

Reviewed by:	ae, melifaro


Revision 274331 - (view) (download) (annotate) - [select for diffs]
Modified Sun Nov 9 21:33:01 2014 UTC (9 years, 7 months ago) by melifaro
File length: 65237 byte(s)
Diff to previous 274175
Renove faith(4) and faithd(8) from base. It looks like industry
have chosen different (and more traditional) stateless/statuful
NAT64 as translation mechanism. Last non-trivial commits to both
faith(4) and faithd(8) happened more than 12 years ago, so I assume
it is time to drop RFC3142 in FreeBSD.

No objections from:	net@


Revision 274175 - (view) (download) (annotate) - [select for diffs]
Modified Thu Nov 6 13:13:09 2014 UTC (9 years, 7 months ago) by melifaro
File length: 65635 byte(s)
Diff to previous 273992
Make checks for rt_mtu generic:

Some virtual if drivers has (ab)used ifa ifa_rtrequest hook to enforce
route MTU to be not bigger that interface MTU. While ifa_rtrequest hooking
might be an option in some situation, it is not feasible to do MTU checks
there: generic (or per-domain) routing code is perfectly capable of doing
this.

We currrently have 3 places where MTU is altered:

1) route addition.
 In this case domain overrides radix _addroute callback (in[6]_addroute)
 and all necessary checks/fixes are/can be done there.

2) route change (especially, GW change).
 In this case, there are no explicit per-domain calls, but one can
 override rte by setting ifa_rtrequest hook to domain handler
 (inet6 does this).

3) ifconfig ifaceX mtu YYYY
 In this case, we have no callbacks, but ip[6]_output performes runtime
 checks and decreases rt_mtu if necessary.

Generally, the goals are to be able to handle all MTU changes in
 control plane, not in runtime part, and properly deal with increased
 interface MTU.

This commit changes the following:
* removes hooks setting MTU from drivers side
* adds proper per-doman MTU checks for case 1)
* adds generic MTU check for case 2)

* The latter is done by using new dom_ifmtu callback since
 if_mtu denotes L3 interface MTU, e.g. maximum trasmitted _packet_ size.
 However, IPv6 mtu might be different from if_mtu one (e.g. default 1280)
 for some cases, so we need an abstract way to know maximum MTU size
 for given interface and domain.
* moves rt_setmetrics() before MTU/ifa_rtrequest hooks since it copies
  user-supplied data which must be checked.
* removes RT_LOCK_ASSERT() from other ifa_rtrequest hooks to be able to
  use this functions on new non-inserted rte.

More changes will follow soon.

MFC after:	1 month
Sponsored by:	Yandex LLC


Revision 273992 - (view) (download) (annotate) - [select for diffs]
Modified Sun Nov 2 21:58:31 2014 UTC (9 years, 8 months ago) by hrs
File length: 65565 byte(s)
Diff to previous 273742
Fix a bug which prevented ND6_IFF_IFDISABLED flag from clearing when
the newly-added IPv6 address was /128.

PR:	188032


Revision 273742 - (view) (download) (annotate) - [select for diffs]
Modified Mon Oct 27 16:15:15 2014 UTC (9 years, 8 months ago) by ae
File length: 65579 byte(s)
Diff to previous 273732
Do not automatically install routes to link-local and interface-local multicast
addresses.

Obtained from:	Yandex LLC
Sponsored by:	Yandex LLC


Revision 273732 - (view) (download) (annotate) - [select for diffs]
Modified Mon Oct 27 10:34:09 2014 UTC (9 years, 8 months ago) by ae
File length: 70779 byte(s)
Diff to previous 271427
Remove unused function.

Sponsored by:	Yandex LLC


Revision 271427 - (view) (download) (annotate) - [select for diffs]
Modified Thu Sep 11 13:18:41 2014 UTC (9 years, 9 months ago) by ae
File length: 71014 byte(s)
Diff to previous 270348
Add const qualifier to in6_addrhash() function.
Add in6ifa_ifwithaddr() function. It is similar to ifa_ifwithaddr,
but does fast lookup in the hash of inet6 addresses.

Obtained from:	Yandex LLC
Sponsored by:	Yandex LLC


Revision 270348 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 22 19:21:08 2014 UTC (9 years, 10 months ago) by markj
File length: 70519 byte(s)
Diff to previous 269243
Add some missing checks for unsupported interfaces (e.g. pflog(4)) when
handling ioctls. While here, remove duplicated checks for a NULL ifp in
in6_control(): this check is already done near the beginning of the
function.

PR:		189117
Reviewed by:	hrs
MFC after:	2 weeks


Revision 269243 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jul 29 15:01:29 2014 UTC (9 years, 11 months ago) by glebius
File length: 70684 byte(s)
Diff to previous 260882
Garbage collect couple of unused fields from struct ifaddr:
- ifa_claim_addr() unused since removal of NetAtalk
- ifa_metric seems to be never utilized, always a copy of if_metric


Revision 260882 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jan 19 16:07:27 2014 UTC (10 years, 5 months ago) by melifaro
File length: 70747 byte(s)
Diff to previous 260860
Further rework netinet6 address handling code:
* Set ia address/mask values BEFORE attaching to address lists.
Inet6 address assignment is not atomic, so the simplest way to
do this atomically is to fill in ia before attach.
* Validate irfa->ia_addr field before use (we permit ANY sockaddr in old code).
* Do some renamings:
  in6_ifinit -> in6_notify_ifa (interaction with other subsystems is here)
  in6_setup_ifa -> in6_broadcast_ifa (LLE/Multicast/DaD code)
  in6_ifaddloop -> nd6_add_ifa_lle
  in6_ifremloop -> nd6_rem_ifa_lle
* Split working with LLE and route announce code for last two.
Add temporary in6_newaddrmsg() function to mimic current rtsock behaviour.
* Call device SIOCSIFADDR handler IFF we're adding first address.
In IPv4 we have to call it on every address change since ARP record
is installed by arp_ifinit() which is called by given handler.
IPv6 stack, on the opposite is responsible to call nd6_add_ifa_lle() so
there is no reason to call SIOCSIFADDR often.


Revision 260860 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 18 20:32:59 2014 UTC (10 years, 5 months ago) by melifaro
File length: 71504 byte(s)
Diff to previous 260852
Add in6_prepare_ifra() function to ease preparing in-kernel IPv6
address requests.

MFC after:	2 weeks


Revision 260852 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 18 15:57:43 2014 UTC (10 years, 5 months ago) by melifaro
File length: 70962 byte(s)
Diff to previous 260851
Do some style(9) not done in r260851 to improve readability.

MFC after:	2 weeks


Revision 260851 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 18 15:52:52 2014 UTC (10 years, 5 months ago) by melifaro
File length: 71136 byte(s)
Diff to previous 260458
Split in6_update_ifa() into smaller pieces leaving functionality intact.

Discussed with:	ae
MFC after:	2 weeks


Revision 260458 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jan 8 22:13:32 2014 UTC (10 years, 5 months ago) by melifaro
File length: 69845 byte(s)
Diff to previous 260217
Introduce IN6_MASK_ADDR() macro to unify various hand-rolled code
to do IPv6 addr & mask in different places.

MFC after:	2 weeks


Revision 260217 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jan 3 02:32:05 2014 UTC (10 years, 6 months ago) by ae
File length: 69898 byte(s)
Diff to previous 257943
Add IF_AFDATA_WLOCK_ASSERT() in case lla_lookup() is called with
LLE_CREATE flag.

MFC after:	1 week


Revision 257943 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 11 05:39:42 2013 UTC (10 years, 7 months ago) by glebius
File length: 69867 byte(s)
Diff to previous 257241
Remove never used ioctls that originate from KAME. The proof
of their zero usage was exp-run from misc/183538.


Revision 257241 - (view) (download) (annotate) - [select for diffs]
Added Mon Oct 28 07:29:16 2013 UTC (10 years, 8 months ago) by glebius
File length: 77874 byte(s)
Diff to previous 256519
Include necessary headers that now are available due to pollution
via if_var.h.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.



This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

  ViewVC Help
Powered by ViewVC 1.1.27