Commit Graph

3105 Commits

Author SHA1 Message Date
knakahara 29209776f3 missing if_extflags of l2tp(4). l2tp(4) is already MP-safe. 2017-04-20 09:11:58 +00:00
christos 62446aa148 Redo the statistics through an indirection array and put the definitions
of the arrays in pfkeyv2.h so that they are next to the index definitions.
Remove "bogus" comment about compressing the statistics which is now fixed.
2017-04-13 16:38:31 +00:00
maya 48b3001c8d if MGETHDR fails, don't try to copy to single mbuf and deref null.
reduce ifdefs.
2017-04-13 00:47:33 +00:00
knakahara d5d260eb06 l2tp(4) support when hashinit() cannot allocate requried hash size.
pointed out by s-yamaguchi@IIJ
2017-04-13 00:12:10 +00:00
roy 5135ab1948 Add RO_MSGFILTER socket option to PF_ROUTE to filter out
un-wanted route(4) messages.

Inspired by the ROUTE_MSGFILTER equivalent in OpenBSD,
but with an API which allows the full range of potential message types.
2017-04-11 13:55:54 +00:00
ozaki-r 80d40a78b4 Prepare netipsec for rump-ification
- Include "opt_*.h" only if _KERNEL_OPT is defined
- Allow encapinit to be called twice (by ifinit and ipe4_attach)
  - ifinit didn't call encapinit if IPSEC is enabled (ipe4_attach called
    it instead), however, on a rump kernel ipe4_attach may not be called
    even if IPSEC is enabled. So we need to allow ifinit to call it anyway
- Setup sysctls in ipsec_attach explicitly instead of using SYSCTL_SETUP
- Call ip6flow_invalidate_all in key_spdadd only if in6_present
  - It's possible that a rump kernel loads the ipsec library but not
    the inet6 library
2017-04-06 09:20:07 +00:00
ozaki-r 31d0775c4c Revert "Make sure to hold if_ioctl_lock when calling ifp->if_ioctl"
As per pgoyette@ and riastradh@ requests; we shouldn't decide to
hold a lock based on if the lock is held or not.
2017-04-06 03:54:59 +00:00
ozaki-r bd2b5ee8eb Make sure to hold if_ioctl_lock when calling ifp->if_ioctl
Unfortunately callers of ifp->if_ioctl (if_addr_init, if_flags_set
and if_mcast_op) may or may not hold if_ioctl_lock, so we have to
hold the lock only if it's not held.
2017-04-05 03:47:51 +00:00
knakahara 685eeb51f1 fix module build 2017-04-04 23:49:17 +00:00
sevan cb2085f041 Revert change to allow builds to continue until the missing vlan.h file is committed.
https://mail-index.netbsd.org/source-changes/2017/04/04/msg083283.html
2017-04-04 16:49:15 +00:00
knakahara 6f4f1b05e1 remove unnecessary if_vlanvar.h. add missing include "vlan.h".
pointed out by s-yamaguchi@IIJ, thanks.
2017-04-04 10:25:38 +00:00
knakahara 87a1dfd1ed fix atf failed. 2017-04-04 04:34:43 +00:00
knakahara bafe7eeef8 fix missing mutex_destroy when modunload.
pointed out by s-yamaguchi@IIJ, thanks.
2017-04-03 10:17:17 +00:00
knakahara 0715c4c5fb fix potentially use after free between "ifconfig l2tpX destroy" and l2tp Tx.
It is protected by KERNEL_LOCK in soo_ioctl() between "ioctl destory" and
other ioctls. And, it is protected by encap_lock() between "ioctl destroy"
and Rx. However, it was not protected between "ioctl destroy" and Tx.
That is,
    + CPU#A
      - do "ifconfig l2tpX destroy"
        - call l2tp_clone_destroy()
        - done l2tp_delete_tunnel()
    + CPU#B
      - begin l2tp output processing
        - call l2tp_transmit()
        - done l2tp_getref_variant()
    + CPU#A
        - done kmem_free(sc->l2tp_var, )
    + CPU#B
        - access to sc->l2tp_var after free

pointed out by s-yamaguchi@IIJ, thanks.
2017-04-03 10:08:24 +00:00
knakahara 90af23d20d KNF. pointed out by s-yamaguchi@IIJ 2017-03-30 06:42:05 +00:00
ozaki-r 68574f659e Avoid touching a mbuf after enqueuing it 2017-03-28 08:47:19 +00:00
ozaki-r 249d5a1a99 Use sp->pp_framebytes instead of the constant value "3"
It seems that it was forgotten to be converted in v1.22.
2017-03-28 07:32:16 +00:00
ozaki-r f467d81a46 Remove extra semicolon 2017-03-24 11:15:25 +00:00
ozaki-r d3cc86362c Remove KERNEL_LOCK for arpresolve in ether_output
Because arpresolve should be already MP-safe.
2017-03-24 09:22:46 +00:00
ozaki-r f4510b11c6 Forbit installing a route which its gateway is unreachable
This change needs a tweak in route_output_change to unbreak route
change commands (e.g., route change -inet6 default -reject).

PR kern/52077 (s-yamaguchi@IIJ and ozaki-r@)
2017-03-24 03:45:02 +00:00
ozaki-r 2b5b2086c8 Tweak and KNF some functions 2017-03-22 07:14:18 +00:00
ozaki-r 15ca1985b9 Add missing NULL check
Fix PR kern/52083
2017-03-17 10:05:02 +00:00
ozaki-r 928e3031c1 Simplify ifunit, if_get and if_get_byindex by reusing other functions
Inspired by kre@'s comment
2017-03-16 09:40:48 +00:00
ozaki-r b0353835f4 Fix panic on ifconfig <number>
Pointed out by s-yamaguchi@IIJ
2017-03-16 08:11:47 +00:00
ozaki-r d2ff5d3975 Fix memory leak in vlan_start 2017-03-15 09:51:08 +00:00
ozaki-r 6e669021a2 Add missing pserialize_read_exit
Pointed out by riastradh@
2017-03-14 09:39:28 +00:00
ozaki-r 0eaf4e5356 Use if_acquire and if_release instead of using psref API directly
- Provide if_release for consistency to if_acquire
- Use if_acquire and if_release for ifp iterations
- Make ifnet_psref_class static
2017-03-14 09:03:08 +00:00
ozaki-r 2fe5debf56 Fix use of curlwp_bind
There was an error path that returned without curlwp_bindx.
2017-03-14 08:35:55 +00:00
ozaki-r f17c40f356 Fix race condition in sysctl_iflist
We need to use psref for the ifa iteration because iflist_addr can sleep.
2017-03-14 08:11:09 +00:00
ozaki-r 07a4b673ca Replace DIAGNOSTIC + panic with KASSERT 2017-03-14 04:25:10 +00:00
ozaki-r dfc3fd1ced Avoid debug printf just if DIAGNOSTIC 2017-03-14 04:23:15 +00:00
ryo fb766ff818 need to membar_producer() *before* switching.
pointed out by riastradh@, thanks
2017-03-10 07:35:58 +00:00
christos 027a0f2366 fix MIN/MAX confusion. 2017-03-10 02:21:37 +00:00
knakahara 1ec2dc1686 ifp->if_transmit() must free mbuf even if error occurred.
Add missing m_freem(m) to if_nulltransmit().
Below ifp->if_transmit() implementations are already added m_freem(m) properly.
    - wm(4)
    - ixg(4)
    - ixv(4)
    - pppoe(4)
    - gif(4)
    - l2tp(4)

pointed out by ozaki-r@n.o, thanks.
2017-03-09 09:57:36 +00:00
ozaki-r 355df0ff57 Remove unnecessary splnet 2017-03-09 04:37:23 +00:00
ozaki-r a1a702a9ef Remove unnecessary splnet for bridge_enqueue
bridge_enqueue now uses if_transmit_lock that does splnet for device
drivers, so splnet for bridge_enqueue isn't needed anymore.
2017-03-07 01:53:53 +00:00
ozaki-r 0d53029e9b Add missing splnet to if_deferred_start_common
if_start should run in splnet to avoid running interrupt handlers.
2017-03-07 01:32:03 +00:00
msaitoh f71865e18b Add missing opt_net_mpsafe.h. 2017-03-03 06:27:20 +00:00
ozaki-r 00a9cf741d Remove mkludge stuffs
For unknown reasons, IPv6 multicast addresses are linked to a first
IPv6 address assigned to an interface. Due to the design, when removing
a first address having multicast addresses, we need to save them to
somewhere and later restore them once a new IPv6 address is activated.
mkludge stuffs support the operations.

This change links multicast addresses to an interface directly and
throws the kludge away.

Note that as usual some obsolete member variables remain for kvm(3)
users. And also sysctl net.inet6.multicast_kludge remains to avoid
breaking old ifmcstat.

TODO: currently ifnet has a list of in6_multi but obviously the list
should be protocol independent. Provide a common structure (if_multi
or something) to handle in6_multi and in_multi together as well as
ifaddr does for in_ifaddr and in6_ifaddr.
2017-02-23 07:57:09 +00:00
ozaki-r 9bd7113070 Use kmem instead of malloc 2017-02-21 04:00:01 +00:00
ozaki-r 1f29833ec6 Sweep unnecessary malloc.h inclusions 2017-02-21 03:59:31 +00:00
ozaki-r 390b465f79 Make updating a rtentry in rtinit MP-safe 2017-02-20 04:23:11 +00:00
ozaki-r b7100b390b Reinit a pslist entry before inserting it to a pslist again
Fix PR kern/51984
Tested by nonaka@
2017-02-20 03:08:38 +00:00
christos b16498773e Don't reassemble ipv6 fragments, instead treat the first fragment as a regular
packet (subject to filtering rules), and pass subsequent fragments in the
same group unconditionally.
2017-02-19 20:27:22 +00:00
christos 290ad1f61f typo 2017-02-19 13:58:42 +00:00
christos 15b3afa8c3 forgot to commit this (new prototype) 2017-02-19 02:11:19 +00:00
christos a5d49e2a90 provide a copy function used for logging that does not lock, but can return
trash.
2017-02-18 23:27:32 +00:00
mlelstv c910290e61 npf_ifmap_getname requires the config to be locked. For now, just prevent the
crash.
2017-02-18 18:08:16 +00:00
ozaki-r 77a7c1c676 Make NOMPSAFE comments informative 2017-02-17 04:31:34 +00:00
ozaki-r c5696d3c25 Rename if_acquire_NOMPSAFE to if_acquire
It can be used in MP-safe ways. So let's remove the confusing postfix.
If it's used in a unsafe way, warn NOMPSAFE in a comment.
2017-02-17 03:57:17 +00:00