Commit Graph

3729 Commits

Author SHA1 Message Date
maxv
723dead3ea hardclock_ticks -> getticks() 2020-05-15 19:28:09 +00:00
jdolecek
ede9f9f8d5 adjust comment - sosetopt() path doesn't take IFNET_LOCK() 2020-05-05 09:26:29 +00:00
jdolecek
aa16e18724 add a NOMPSAFE comment for if_mcast_op(), it is called from context
which doesn't hold IFNET_LOCK() in some cases, and calls if_ioctl

this needs to be sorted out for NET_MPSAFE
2020-05-05 09:22:24 +00:00
jdolecek
454d69cd16 remove struct ifnet if_mcastop, it's not used by anything 2020-05-05 08:05:03 +00:00
jdolecek
6d5b25315e report no enabled capabilities when no interface is part of bridge 2020-05-01 22:27:42 +00:00
jdolecek
5b27ba3b79 add sc_capenable member, forgot to commit 2020-04-30 13:59:50 +00:00
jdolecek
f91b80053d for bridge(4), report the common enabled capabilities of the members
via SIOCGIFCAP for visibility
2020-04-30 10:04:54 +00:00
riastradh
f385d5ca9e Convert ether_input from rnd_initial_entropy to entropy_epoch(). 2020-04-30 03:29:55 +00:00
nat
6852d50ff3 Remove inappropriate place for __predict_false.
Ok mrg@ maya@.
2020-04-27 23:35:40 +00:00
nat
2629057997 Skip pfil_run_hooks if no packet filter configured in kernel. 2020-04-27 23:05:31 +00:00
jdolecek
b1e0f9eefc if MTU of the added interface doesn't match the bridge, modify the MTU
of the interface to that of the bridge instead of just refusing the
addition with EINVAL

this is a convenience feature to simplify bridge setup with non-standard
MTU, the useful behaviour observed with Linux xenbr
2020-04-27 20:46:01 +00:00
thorpej
81b0afaa64 In _if_down(), release the link state change lock before calling
workqueue_wait().  Add a comment explaining how the locking here
works.

PR kern/55018.
2020-04-18 15:56:26 +00:00
knakahara
9672f51c5f Fix typo in comment 2020-04-08 03:37:14 +00:00
is
f6bfb0c4d8 Multilink fragment protocol type. 2020-04-04 19:46:01 +00:00
is
5dd3aa2241 Multilink PPP: sanity check of option values, storage of remote MRRU. 2020-04-04 17:12:33 +00:00
is
bc99bd15e1 Define a few more LCP options. Recognize, sanity-check and report (but
still reject for the moment) multilink PPP configuration options received.
2020-04-01 20:24:50 +00:00
knakahara
6277d3d977 Fix typo in comment. 2020-04-01 02:38:17 +00:00
christos
c3bbf81d67 On detach, destroy the mutex attach created, otherwise we crash with LOCKDEBUG.
XXX: other interface drivers have this issue.
2020-03-30 11:57:50 +00:00
jdolecek
1a69d50bf1 replace the conditional m_pullup() on start of ether_sw_offload_tx()
with a KASSERT(), to make it clear no mbuf manipulation is ever done here
2020-03-27 17:18:15 +00:00
jdolecek
1a475b3cd9 replace the conditional m_pullup() on start of bridge_output() with
a KASSERT(), to make it clear no mbuf manipulation is ever done here

the condition should never trigger, this always runs after ether_output()
M_PREPEND()s ether_header
2020-03-27 16:47:00 +00:00
jdolecek
9d8cab4066 reset the csum_flags in bridge_brodcast() also for bmcast path
for destination interfaces with real hardware offloading this fixes
multicast packet corruption; for xvif(4) this fix stops treating them
as having no csum

may fix PR kern/42386
2020-03-24 13:30:54 +00:00
pgoyette
9120d4511b Use the module subsystem's ability to process SYSCTL_SETUP() entries to
automate installation of sysctl nodes.

Note that there are still a number of device and pseudo-device modules
that create entries tied to individual device units, rather than to the
module itself.  These are not changed.
2020-03-16 21:20:09 +00:00
thorpej
83ce4c20bb Add and use a new function, mowner_init_owner(), that initializes an
MBUFTRACE mowner structure (so that providers of it don't have to
grovel the internals).
2020-03-15 23:14:41 +00:00
thorpej
7a9a30c5e7 Define and implement a locking protocol for the ifmedia / mii layers:
- MP-safe drivers provide a mutex to ifmedia that is used to serialize
  access to media-related structures / hardware regsiters.  Converted
  drivers use the new ifmedia_init_with_lock() function for this.  The
  new name is provided to ease the transition.
- Un-converted drivers continue to call ifmedia_init(), which will supply
  a compatibility lock to be used instead.  Several media-related entry
  points must be aware of this compatibility lock, and are able to acquire
  it recursively a limited number of times, if needed.  This is a SPIN
  mutex with priority IPL_NET.
- This same lock is used to serialize access to PHY registers and other
  MII-related data structures.

The PHY drivers are modified to acquire and release the lock, as needed,
and assert the lock is held as a diagnostic aid.

The "usbnet" framework has had an overhaul of its internal locking
protocols to fit in with the media / mii changes, and the drivers adapted.

USB wifi drivers have been changed to provide their own adaptive mutex
to the ifmedia later via a new ieee80211_media_init_with_lock() function.
This is required because the USB drivers need an adaptive mutex.

Besised "usbnet", a few other drivers are converted: vmx, wm, ixgbe / ixv.

mcx also now calls ifmedia_init_with_lock() because it needs to also use
an adaptive mutex.  The mcx driver still needs to be fully converted to
NET_MPSAFE.
2020-03-15 23:04:50 +00:00
christos
8aaa9ad4fd Use the socket credentials that are established during the socket creation
instead of the current process credentials (which can change via
set{e,}{u,g}id(2)) and by passing the fd to a different process. This makes
the routing socket behave like other file descriptors. Proposed in tech-kern.
2020-03-13 16:37:12 +00:00
knakahara
e8a0215c37 reduce unnecessary reqid of NAT-T ipsecif(4), suggested by ohishi@IIJ. 2020-03-13 02:43:31 +00:00
christos
e3f8cbd510 move debugging code after the NULL check. 2020-03-12 19:36:33 +00:00
knakahara
258ba86eac Fix ipsecif(4) SPDADD pfkey message has garbage. Pointed out by ohishi@IIJ.
"setkey -x" output is the following.

========== before ==========
sadb_msg{ version=2 type=14 errno=0 satype=0
  len=15 reserved=0 seq=0 pid=0
sadb_ext{ len=56 type=18 }
sadb_x_policy{ type=2 dir=1 id=9 }
 { len=40 proto=50 mode=1 level=3 reqid=16393
sockaddr{ len=0 family=0  }
sockaddr{ len=0 family=0  }
 }
========== before ==========

========== after ==========
sadb_msg{ version=2 type=14 errno=0 satype=0
  len=11 reserved=0 seq=0 pid=0
sadb_ext{ len=24 type=18 }
sadb_x_policy{ type=2 dir=1 id=9 }
 { len=8 proto=50 mode=1 level=3 reqid=16393
 }
========== after ==========
2020-03-10 10:35:14 +00:00
roy
5ff17943ef route: RTM_MISS now puts the message source address in RTA_AUTHOR
route(8) also reports this.
A userland app could use this to blacklist nodes who probe for machines
that doesn't exist on a subnet / prefix.
2020-03-09 21:20:55 +00:00
knakahara
e9c0a9dc7d remove unnecessary lock in sppp_mediastatus() as it doesn't touch struct sppp.
ok'ed by yamaguchi@n.o.
2020-03-06 10:26:59 +00:00
riastradh
e5ba6e4e61 Avoid duplicate definition of internal_state struct. 2020-03-05 07:46:49 +00:00
riastradh
434e200c00 Need opt_inet.h for #ifdef INET, INET6. 2020-03-05 07:46:36 +00:00
rin
7edbe5fb42 Remove debug printf I put into bridge_calc_csum_flags().
Sorry for noise.
2020-02-24 00:47:38 +00:00
jdolecek
97e9007d62 disable the DEBUG bridge_calc_csum_flags() printf 2020-02-23 21:50:21 +00:00
maxv
a4bb61b904 pass the address of the field, instead of relying on it being the first
field of the structure, no functional change
2020-02-22 09:30:42 +00:00
joerg
ce578dfc2b Explicitly cast pointers to uintptr_t before casting to enums. They are
not necessarily the same size. Don't cast pointers to bool, check for
NULL instead.
2020-02-21 00:26:21 +00:00
msaitoh
2adc4cf2a7 - Remove 50GBASE-LR10.
- Add the following medias:
 - 25GBASE-ACC
 - 100GBASE-ACC
 - 100GBASE-AOC
 - 100GBASE-FR
 - 100GBASE-LR
 - 200GBASE-ER4
 - 400GBASE-ER8
 - 400GBASE-FR4
 - 400GBASE-LR4
 - 400GBASE-SR4.2
 - 400GBASE-SR8
2020-02-17 15:51:25 +00:00
thorpej
f5c34501a4 Remove the conditional __IF_STATS_PERCPU. 2020-02-14 22:04:12 +00:00
christos
457944128d PR/54950: Lloyd Parkes: Avoid NULL deref. 2020-02-12 01:34:55 +00:00
mlelstv
7c40e3b714 safely extract character sequences from packet for printing. 2020-02-10 22:38:10 +00:00
roy
3730c74003 route(4): dst addr could be in a different mbuf for RO_MISSFILTER
While here, the correct assertation is RTAX_DST == 0.
RTA_DST is just a flag.
2020-02-09 21:15:03 +00:00
roy
6847938ebe route(4): add RO_MISSFILTER socket option
This allows filtering of specific RTM_MISS destination sockaddrs.
2020-02-08 14:17:30 +00:00
thorpej
b578a8edb0 Use percpu_foreach_xcall() to gather volatile per-cpu counters. These
must be serialized against the interrupts / soft-interrupts in which
they're manipulated, as well as protected from non-atomic 64-bit memory
loads on 32-bit platforms.
2020-02-07 12:35:33 +00:00
thorpej
210125a7ef IPL_SOFTNET -> IPL_NET in previous. 2020-02-07 01:14:55 +00:00
thorpej
79aa1d4c98 Perform link state change processing on a work queue, rather than in a
softint.
2020-02-06 23:30:19 +00:00
thorpej
4947e861f2 Use ifmedia_fini(). 2020-02-04 05:44:14 +00:00
roy
5e6231cff4 rtsock: favour ifatoia and ifatoia6 over direct struct casts 2020-02-03 20:34:13 +00:00
thorpej
2e2b06fdb4 Make if_stats competely opaque to user-space. 2020-02-01 21:59:39 +00:00
thorpej
f76c553cad Flip the switch to the per-cpu implementation in <net/if_stats.h>. Leave
the conditional in place for a time in case serious problems are discovered,
so that the Old Way can be re-enabled quickly.  After some time, the Old
Way will be removed completely.
2020-02-01 21:11:10 +00:00
thorpej
a2249e70e6 - Add an ifmedia_fini() routine, to free resources assocated with
an ifmedia.  Currently calls ifmedia_removeall().  All drivers
  that call ifmedia_init() and support detach should call this
  routine.
- In ifmedia_delete_instance(), set ifm->ifm_cur to NULL and
  ifm->ifm_media to IFM_NONE when removing / freeing that entry,
  not simply when we've been asked to delete every media instance.
2020-02-01 20:56:16 +00:00