Commit Graph

2542 Commits

Author SHA1 Message Date
uebayasi
d13c4a3b07 Move net definitions. 2014-10-12 03:56:18 +00:00
ozaki-r
782d9eb22e Execute if_detach within splnet where vlan_unconfig is
With the fix, a ifnet data of vlan can avoid use after free
that results in a fatal page fault.

This problem was found when fixing PR 49264. See
http://mail-index.netbsd.org/netbsd-bugs/2014/10/10/msg038536.html
for more detail.
2014-10-11 10:27:31 +00:00
ozaki-r
d749d98901 Tweak vlan_unconfig
No functional change.
2014-10-11 10:18:36 +00:00
ozaki-r
7705c61fd4 Protect vlan_unconfig with a mutex
It is not thread-safe but is likely to be executed in concurrent.
See PR 49264 for more detail.
2014-10-11 10:16:49 +00:00
ozaki-r
a87495cc1c Do KASSERT(KERNEL_LOCKED_P()) only when NET_MPSAFE off
When NET_MPSAFE, bridge_enqueue calls vlan_start w/o KERNEL_LOCK.
2014-10-09 04:48:12 +00:00
skrll
7123045127 Remove unneeded #include 2014-10-03 06:46:02 +00:00
ozaki-r
cb96c403a1 Delete link local addresses of a vlan interface when detaching its parent
This fixes PR 49197.
2014-09-15 06:07:37 +00:00
ozaki-r
c6219f41c7 Leave promiscuous mode when detaching a parent (ifconfig -vlanif)
We have to call ifpromisc(ifp, 0) for both a VLAN interface
and its parent when they are in promiscuous mode.

PR 49196
2014-09-15 05:54:02 +00:00
rmind
b891d5cdc7 PR/49190: bpf_deliver: set scratch memory store in bpf_args_t. 2014-09-13 17:18:45 +00:00
ozaki-r
0e7abd5a0f Call if_input of vlan interface itself, not parent's one
And also we need to drop M_PROMISC before calling if_input;
it was originally at just before bridge_input in ether_input.

Then we can bridge vlan interfaces again.
2014-09-12 04:10:24 +00:00
ozaki-r
af918e150a Restore vlan_ioctl overwritten by ether_ifdetach in vlan_unconfig
This fixes PR 49112.
2014-09-12 03:44:27 +00:00
rmind
436f757159 Eliminate IFAREF() and IFAFREE() macros in favour of functions. 2014-09-09 20:16:12 +00:00
matt
45b1ec740d Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
2014-09-05 09:20:59 +00:00
matt
f0ca2677dd Cast return value of _NET_STAT_GETREF 2014-09-05 06:01:24 +00:00
matt
e15dacf209 Don't use C++ new keyword 2014-09-05 06:00:05 +00:00
matt
6a4c4a4291 Don't use class as a structure member. 2014-09-05 05:32:07 +00:00
rmind
b1889f11ee - npf_conn_import: add a missing stat counter increment.
- npf_nat_import: add a missing reference and make a comment.
2014-08-24 20:36:30 +00:00
riastradh
7bc9f99ca1 Don't leak in gre_clone_create error branch.
Noted by maxv@, compile-tested for amd64.
2014-08-18 04:28:55 +00:00
ozaki-r
a2a285fa68 bridge: reject non-IFF_SIMPLEX interfaces
bridge does not work with !IFF_SIMPLEX interfaces (PR/18035);
the bug is not yet fixed. Until it gets fixed, we should
reject non-IFF_SIMPLEX interfaces.

Discussed with pooka@
2014-08-15 15:32:24 +00:00
rmind
670c10ba87 - Add and use npf_alg_export().
- npf_conn_import: handle NAT metadata correctly.
- npf_nat_newpolicy: restore the policy ID.
- npfctl_load: fix error code handling for the limit cases.
- npf_config_import: fix the inverted logic.
- npfctl_load: improve error handling.
2014-08-11 23:48:01 +00:00
rmind
4f21ab8829 NPF: finish up the rework of npfctl_save() mechanism. 2014-08-11 01:54:12 +00:00
rmind
d0850273a2 - Add npf_ruleset_export(), npf_rule_export() and npf_nat_policyexport().
- Split off npf_conn_export().  Add npf_ifmap_getname() and use it to save
  the interface name; pick it up on npf_conn_import().
- Misc fixes.  Bump NPF_VERSION.
2014-08-10 19:09:43 +00:00
tls
ea6af427bd Merge tls-earlyentropy branch into HEAD. 2014-08-10 16:44:32 +00:00
rtr
8cf67cc6d5 split PRU_CONNECT2 & PRU_PURGEIF function out of pr_generic() usrreq
switches and put into separate functions

  - always KASSERT(solocked(so)) even if not implemented
    (for PRU_CONNECT2 only)

  - replace calls to pr_generic() with req = PRU_CONNECT2 with calls to
    pr_connect2()

  - replace calls to pr_generic() with req = PRU_PURGEIF with calls to
    pr_purgeif()

put common code from unp_connect2() (used by unp_connect() into
unp_connect1() and call out to it when needed

patch only briefly reviewed by rmind@
2014-08-09 05:33:00 +00:00
rtr
822872eada split PRU_RCVD function out of pr_generic() usrreq switches and put into
separate functions

  - always KASSERT(solocked(so)) even if not implemented

  - replace calls to pr_generic() with req = PRU_RCVD with calls to
    pr_rcvd()
2014-08-08 03:05:44 +00:00
ozaki-r
5b4238682e Use NULL instead of 0 for pointers 2014-08-07 03:40:21 +00:00
rtr
651e5bd3f8 split PRU_SEND function out of pr_generic() usrreq switches and put into
separate functions

   xxx_send(struct socket *, struct mbuf *, struct mbuf *,
       struct mbuf *, struct lwp *)

  - always KASSERT(solocked(so)) even if not implemented

  - replace calls to pr_generic() with req = PRU_SEND with calls to
    pr_send()

rename existing functions that operate on PCB for consistency (and to
free up their names for xxx_send() PRUs

  - l2cap_send() -> l2cap_send_pcb()
  - sco_send() -> sco_send_pcb()
  - rfcomm_send() -> rfcomm_send_pcb()

patch reviewed by rmind
2014-08-05 07:55:31 +00:00
rtr
ce6a5ff64f revert the removal of struct lwp * parameter from bind, listen and connect
user requests.

this should resolve the issue relating to nfs client hangs presented
recently by wiz on current-users@
2014-08-05 05:24:26 +00:00
rtr
833e041dec split PRU_CONNECT, PRU_RCVOOB and PRU_SENDOOB into separate functions
(all implemented as EOPNOTSUPP).
2014-07-31 13:21:33 +00:00
ozaki-r
a2084f3bc9 Define IFADDR_FOREACH_SAFE for on-the-fly element removal in a loop
We have to use it when we purge an address element in an ifaddr loop.

This change restores the original behavior that was accidentally degraded.
2014-07-31 06:35:47 +00:00
rtr
cdb54b43bf fix missed conversion to call to pr_connect() from pr_generic() when
PRU_CONNECT split was done.

-                       error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
-                           PRU_CONNECT, NULL, nam, NULL, l);
+                       error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam);

without this change KASSERT() would be triggered if raw send needs to
perform a connect.
2014-07-31 05:13:53 +00:00
rtr
892163b8e9 split PRU_DISCONNECT, PRU_SHUTDOWN and PRU_ABORT function out of
pr_generic() usrreq switches and put into separate functions

   xxx_disconnect(struct socket *)
   xxx_shutdown(struct socket *)
   xxx_abort(struct socket *)

   - always KASSERT(solocked(so)) even if not implemented
   - replace calls to pr_generic() with req =
PRU_{DISCONNECT,SHUTDOWN,ABORT}
     with calls to pr_{disconnect,shutdown,abort}() respectively

rename existing internal functions used to implement above functionality
to permit use of the names for xxx_{disconnect,shutdown,abort}().

   - {l2cap,sco,rfcomm}_disconnect() ->
{l2cap,sco,rfcomm}_disconnect_pcb()
   - {unp,rip,tcp}_disconnect() -> {unp,rip,tcp}_disconnect1()
   - unp_shutdown() -> unp_shutdown1()

patch reviewed by rmind
2014-07-31 03:39:35 +00:00
ozaki-r
f46609a687 Define IFNET_EMPTY() and replace !IFNET_FIRST() with it
No functional change.
2014-07-31 02:21:51 +00:00
ozaki-r
64d3f382b2 Call etherinit from ifinit1 only when it is required
This unbreaks the builds of kernels that don't build if_ethersubr.c.
2014-07-30 13:32:09 +00:00
rtr
ad6ae402db split PRU_CONNECT function out of pr_generic() usrreq switches and put
into seaparate functions

  xxx_listen(struct socket *, struct mbuf *)

  - always KASSERT(solocked(so)) and KASSERT(nam != NULL)
  - replace calls to pr_generic() with req = PRU_CONNECT with
    pr_connect()
  - rename existin {l2cap,sco,rfcomm}_connect() to
    {l2cap,sco,rfcomm}_connect_pcb() respectively to permit
    naming consistency with other protocols functions.
  - drop struct lwp * parameter from unp_connect() and at_pcbconnect()
    and use curlwp instead where appropriate.

patch reviewed by rmind
2014-07-30 10:04:25 +00:00
ozaki-r
57295d2a01 Use IFADDR_FOREACH 2014-07-29 05:56:58 +00:00
ozaki-r
b6f0a6fc3d Use if_free instead of free 2014-07-29 01:35:44 +00:00
ozaki-r
a2697bde55 Add a mutex for global variables of if_ethersubr.c
To initialize the mutex, we introduce etherinit that is called from ifinit1.
2014-07-28 14:24:48 +00:00
alnsn
b67137b2bd Enable net.bpf.jit only if MODULAR and BPFJIT. Tweak a warning about postponed
jit activation.
2014-07-28 07:32:46 +00:00
rmind
8865b1bf3d npf_conn_conkey: fix a comment. 2014-07-26 16:42:03 +00:00
alnsn
80a2991627 Don't use saved EREG registers because sljit 0.91 can generate
bogus code on amd64. The A and X registers are saved on the stack.

The most recent version of sljit fixes bogus code generation but
it's not backward compatible with sljit 0.91.
2014-07-26 11:23:46 +00:00
rmind
7e49c40b60 npf_conn_conkey: adjust to return the key length and add a comment
describing the key layout.
2014-07-25 23:21:46 +00:00
rmind
4fa1bf86dc npf_mk_connlist: destroy the connections on error path. 2014-07-25 23:07:21 +00:00
rmind
62ba230aa2 npf_tcp_inwindow: enable strict RST check by default. 2014-07-25 20:07:32 +00:00
dholland
f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
alnsn
9f32be6c56 For P[X+0] load, don't emit wrap around check and copy X intead of emitting X+0. 2014-07-24 22:54:38 +00:00
rtr
6dd8eef044 split PRU_BIND and PRU_LISTEN function out of pr_generic() usrreq
switches and put into separate functions
  xxx_bind(struct socket *, struct mbuf *)
  xxx_listen(struct socket *)

  - always KASSERT(solocked(so)) even if not implemented

  - replace calls to pr_generic() with req = PRU_BIND with call to
    pr_bind()

  - replace calls to pr_generic() with req = PRU_LISTEN with call to
    pr_listen()

  - drop struct lwp * parameter from at_pcbsetaddr(), in_pcbbind() and
    unp_bind() and always use curlwp.

rename existing functions that operate on PCB for consistency (and to
free up their names for xxx_{bind,listen}() PRUs

  - l2cap_{bind,listen}() -> l2cap_{bind,listen}_pcb()
  - sco_{bind,listen}() -> sco_{bind,listen}_pcb()
  - rfcomm_{bind,listen}() -> rfcomm_{bind,listen}_pcb()

patch reviewed by rmind

welcome to netbsd 6.99.48
2014-07-24 15:12:03 +00:00
rtr
35b22fa96a split PRU_SENDOOB and PRU_RCVOOB function out of pr_generic() usrreq
switches and put into separate functions
  xxx_sendoob(struct socket *, struct mbuf *, struct mbuf *)
  xxx_recvoob(struct socket *, struct mbuf *, int)

  - always KASSERT(solocked(so)) even if request is not implemented

  - replace calls to pr_generic() with req = PRU_{SEND,RCV}OOB with
    calls to pr_{send,recv}oob() respectively.

there is still some tweaking of m_freem(m) and m_freem(control) to come
for consistency.  not performed with this commit for clarity.

reviewed by rmind
2014-07-23 13:17:18 +00:00
ozaki-r
2e472fa1e3 Avoid calling copyout with holding mutex(IPL_NET)
Because copyout may lead a page fault that may sleep, we have to pull it
out from the critical section of mutex(IPL_NET) in bridge_ioctl_gifs.
2014-07-23 05:32:23 +00:00
ozaki-r
586f8509ba Add missing unlock 2014-07-23 04:09:48 +00:00