Commit Graph

2805 Commits

Author SHA1 Message Date
ozaki-r 0c85f1e532 Optimize if_get_byindex by adding __predict_true 2016-05-31 04:05:01 +00:00
knakahara d60d8acaf7 modify some functions static. no functional change. 2016-05-31 03:52:40 +00:00
alnsn 44dbc048e9 Adapt to the new version of sljit@r313. 2016-05-29 17:20:22 +00:00
ozaki-r 9b5dfda043 Fix RT_IN_PRINT 2016-05-17 15:21:14 +00:00
ozaki-r cba53ba7a5 Tidy up route_output
Avoid jumping into the middle of a switch statement, use a function instead.
2016-05-17 12:58:21 +00:00
ozaki-r 2ccabb7fd7 Apply if_get and if_put to bridge(4) 2016-05-16 01:23:51 +00:00
ozaki-r fd97b511fe Replace ifnet_lock with if_get and if_put
ifnet_lock is a dedicated method to safely destroy an interface over running
ioctl operations. Replace it with a more generic mechanism using psref(9).
2016-05-16 01:16:24 +00:00
ozaki-r b59e9a736b Introduce if_get, if_get_byindex and if_put
The new API enables to obtain an ifnet object with protected by psref(9).
It is intended to be used where an obtained ifnet object is used over
sleepable operations.
2016-05-16 01:06:31 +00:00
ozaki-r 040205ae93 Protect ifnet list with psz and psref
The change ensures that ifnet objects in the ifnet list aren't freed during
list iterations by using pserialize(9) and psref(9).

Note that the change adds a pslist(9) for ifnet but doesn't remove the
original ifnet list (ifnet_list) to avoid breaking kvm(3) users. We
shouldn't use the original list in the kernel anymore.
2016-05-12 02:24:16 +00:00
christos d7ac614b0a Don't increment the reference count only when it was 0...
From Jean-Jacques.Puig
2016-05-09 15:05:15 +00:00
roy 88be616fa6 Allow multicast/broadcast packets from a bridge member to other members.
Note this should just call bridge_broadcast when more locking issues are
resolved.
2016-05-04 18:59:55 +00:00
skrll 18ee45f035 Typo in comment 2016-05-02 08:03:23 +00:00
ozaki-r a931ad2746 Constify remaining rtentry of if_output (fix build) 2016-04-28 14:40:09 +00:00
knakahara 9f3a294e64 introduce new ifnet MP-scalable sending interface "if_transmit". 2016-04-28 01:37:17 +00:00
ozaki-r 2cf7873b92 Constify rtentry of if_output
We no longer need to change rtentry below if_output.

The change makes it clear where rtentries are changed (or not)
and helps forthcoming locking (os psrefing) rtentries.
2016-04-28 00:16:56 +00:00
ozaki-r 3f11155830 Stop using rt_gwroute completely 2016-04-26 09:31:18 +00:00
ozaki-r 9e0f6c5e36 Stop using rt_gwroute on packet sending paths
rt_gwroute of rtentry is a reference to a rtentry of the gateway
for a rtentry with RTF_GATEWAY. That was used by L2 (arp and ndp)
to look up L2 addresses. By separating L2 nexthop caches, we don't
need a route for the purpose and we can stop using rt_gwroute.
By doing so, we can reduce referencing and modifying rtentries,
which makes it easy to apply a lock (and/or psref) to the
routing table and rtentries.

One issue to do this is to keep RTF_REJECT behavior. It seems it
was broken when we moved rtalloc1 things from L2 output routines
(e.g., ether_output) to ip_hresolv_output, but (fortunately?)
it works unexpectedly. What we mistook are:
- RTF_REJECT was checked for any routes in L2 output routines,
  but in ip_hresolv_output it is checked only when the route
  is RTF_GATEWAY
- The RTF_REJECT check wasn't copied to IPv6 (nd6_output)

It seems that rt_gwroute checks hid the mistakes and it looked
work (unexpectedly) and removing rt_gwroute checks unveil the
issue. So we need to fix RTF_REJECT checks in ip_hresolv_output
and also add them to nd6_output.

One more point we have to care is returning an errno; we need
to mimic looutput behavior. Originally RTF_REJECT check was
done either in L2 output routines or in looutput. The latter is
applied when a reject route directs to a loopback interface.
However, now RTF_REJECT check is done before looutput so to keep
the original behavior we need to return an errno which looutput
chooses. Added rt_check_reject_route does such tweaks.
2016-04-26 09:30:01 +00:00
roy 18c890be0c Set rtm_pid = curproc->p_pid for a few more messages. 2016-04-25 15:43:49 +00:00
ozaki-r 0c74cec625 Check error of rt_setgate and rt_settag 2016-04-25 14:38:08 +00:00
ozaki-r 156a79f975 Don't rt_setkey twice 2016-04-25 14:30:42 +00:00
ozaki-r c429bd747c Fix errno on rt_setgate error
I bet it's not EDQUOT (Disc quota exceeded).
2016-04-25 10:55:01 +00:00
christos 89a51b8a0a CID 1358673: dead code 2016-04-24 18:08:40 +00:00
christos 005582cf7d CID 1210544: Tainted scalar 2016-04-24 17:56:31 +00:00
christos e4c50db432 CID 980345: missing breaks 2016-04-24 17:32:06 +00:00
christos 107dc46d92 CID 980057, 980058, use strlcpy() 2016-04-24 16:59:15 +00:00
martin 2b65c0c0c6 Add missing breaks (cosmetic change only) 2016-04-23 12:15:38 +00:00
roy aabc63fcaa Change used from int to bool.
If used, abort the loop because we think we're already at the end.
2016-04-22 00:25:42 +00:00
christos a56964c222 /32 and /128 are valid netmasks. 2016-04-20 15:46:08 +00:00
knakahara b76ec0b083 IFQ_ENQUEUE refactor (3/3) : eliminate pktattr argument from IFQ_ENQUEUE caller 2016-04-20 09:01:03 +00:00
knakahara 40b1061c07 IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation 2016-04-20 08:58:48 +00:00
knakahara 6190bb13a7 IFQ_ENQUEUE refactor (1/3) : add altq_pktattr fields to m_pkthdr
Reviewed by joerg@n.o and tls@n.o, thanks.
2016-04-20 08:56:32 +00:00
ozaki-r cc3dd2e07b Apply psref(9) to bridge(4)
Note that there is an issue that ioctls for an interface and a destruction
of the interface can run in parallel and it causes race conditions on
bridge as well (it rarely happens). The issue will be addressed in the
interface common code (if.c).
2016-04-19 07:10:22 +00:00
ozaki-r d81e97fa58 Remove BRIDGE_MPSAFE switch and enable MP-safe code by default
We need to enable it by default because bridge_input now runs
in softint, but bridge_input w/o BRIDGE_MPSAFE was designed as
it runs in hardware interrupt.

Note that there remains a racy code in bridge_output; it will be
solved in the upcoming change (applying psref(9)).
2016-04-19 07:03:12 +00:00
ozaki-r c49e748c57 Hide PPPoE variables from if_ethersubr.c
This improves modularity of if_pppoe.

From s-yamaguchi@IIJ
2016-04-15 01:31:29 +00:00
ozaki-r 4f0eb37aac ddb: rename show arptab to show routes
show arptab command of ddb is now inappropriate because it actually dumps
routes but arp entries aren't routes anymore. So rename it to show routes
and move the code from if_arp.c to route.c.

ok christos@
2016-04-13 00:47:01 +00:00
ozaki-r 6a7ab186c9 Don't use radix tree API directly 2016-04-11 09:21:18 +00:00
ozaki-r 1fcfead163 Remove out-dated comments and unnecessary splsoftnet for pool_{get,put} 2016-04-11 08:26:33 +00:00
ozaki-r ba236d2e0a Fix usage of pslist(9)
Pointed out by riastradh@.
2016-04-11 05:40:47 +00:00
ozaki-r 9129220b60 Move #include <sys/pslist.h> inside #ifdef _KERNEL for building brconfig 2016-04-11 03:46:47 +00:00
ozaki-r 814cd05c8b Use pslist(9) in bridge(4)
This adds missing memory barriers to list operations for pserialize.
2016-04-11 02:04:14 +00:00
christos d5e7bf8bbf - remove printf
- fix indent
2016-04-08 12:01:22 +00:00
christos 5d7cee0467 Use sockaddr_dl_init 2016-04-07 21:41:02 +00:00
christos c586dc1f9c remove useless cast. 2016-04-07 04:04:47 +00:00
christos b988d754df - tidy up error messages
- add a length argument to arpresolve()
- add KASSERT for overflow
2016-04-07 03:22:15 +00:00
christos cba63d3064 Don't create an RTM_MISS message for every route allocation.
GC unused code and variables.
2016-04-07 03:09:56 +00:00
christos ee5f11c12c pretty-print link addresses. 2016-04-06 18:04:58 +00:00
christos d5ee3894c1 Don't interpret routing requests by interface index as arp entry additions! 2016-04-06 17:34:33 +00:00
ozaki-r 59c50f3fa9 Fill rtm_addrs properly
This fixes that arp(8) on some archs (only 32bit?) shows "(weird)"
for every entries unexpectedly.

Confirmed on evbarm by ryo@ and i386 by me.
2016-04-06 08:45:46 +00:00
ozaki-r 25d196eae4 Fill sdl with sockaddr_dl_init
And add an assertion of if_addrlen and ll_addr.

From christos@
2016-04-06 07:59:26 +00:00
pgoyette b05cba24c7 Add modular dependency on zlib module. 2016-04-05 23:44:05 +00:00