summaryrefslogtreecommitdiffstats
path: root/sys/net/bridge.c
Commit message (Collapse)AuthorAgeFilesLines
* Replace IF_HANDOFF with new IFQ_HANDOFF to enqueue with ALTQ once enabled onmlaier2004-06-151-2/+5
| | | | the respective drivers.
* add missing #include <sys/module.h>phk2004-05-301-0/+1
|
* arpcom untangling:luigi2004-04-241-5/+6
| | | | do not use struct arpcom directly, rather use IFP2AC(ifp).
* Re-remove MT_TAGs. The problems with dummynet have been fixed now.mlaier2004-02-251-9/+4
| | | | | Tested by: -current, bms(mentor), me Approved by: bms(mentor), sam
* Backout MT_TAG removal (i.e. bring back MT_TAGs) for now, as dummynet ismlaier2004-02-181-5/+9
| | | | | | not working properly with the patch in place. Approved by: bms(mentor)
* This set of changes eliminates the use of MT_TAG "pseudo mbufs", replacingmlaier2004-02-131-9/+5
| | | | | | | | | | | them mostly with packet tags (one case is handled by using an mbuf flag since the linkage between "caller" and "callee" is direct and there's no need to incur the overhead of a packet tag). This is (mostly) work from: sam Silence from: -arch Approved by: bms(mentor), sam, rwatson
* correct bridge_version: replace unexpanded RCS keywords by a fixed stringsam2003-12-241-1/+1
| | | | PR: kern/60251
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-21/+17
| | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
* Correct pfil_run_hooks return handling: if the return value is non-zerosam2003-09-301-5/+3
| | | | | | | | | then the mbuf has been consumed by a hook; otherwise beware of a null mbuf return (gack). In particular the bridge was doing the wrong thing. While in the ipv6 code make it's handling of pfil_run_hooks identical to netbsd. Pointed out by: Pyun YongHyeon <yongari@kt-is.co.kr>
* o update PFIL_HOOKS support to current API used by netbsdsam2003-09-231-23/+19
| | | | | | | | | | | o revamp IPv4+IPv6+bridge usage to match API changes o remove pfil_head instances from protosw entries (no longer used) o add locking o bump FreeBSD version for 3rd party modules Heavy lifting by: "Max Laier" <max@love2party.net> Supported by: FreeBSD Foundation Obtained from: NetBSD (bits of pfil.h and pfil.c)
* fix build on 64-bit platformssam2003-09-171-1/+1
|
* Minor overhaul and add locking.sam2003-09-171-305/+409
| | | | | | | | | | | | | | | o replace magic constants with #defines (e.g. ETHER_ADDR_LEN) o move mib variables to net.link.ether.bridge with backwards compatible entries for well-known items maintained under BURN_BRIDGES o revamp debugging support so it is conditioanlly compiled with BRIDGE_DEBUG (on currently) and runtime controlled by net.link.ether.bridge.debug o change timeout to MPSAFE callout o optimize lookup for common case of two interfaces o optimize forwarding path to take IFNET lock only when needed o make boot-time printf dependent on bootverbose o sundry style changes (ANSI decls, extraneous spaces, etc.) Sponsored by: FreeBSD Foundation
* Back out M_* changes, per decision of the TRB.imp2003-02-191-6/+6
| | | | Approved by: trb
* Do not do an assignment in a truth test (previous commit) or gcc gives apeter2003-02-121-1/+1
| | | | | | | | | warning which breaks builds. cc1: warnings being treated as errors src/sys/net/bridge.c: In function `bdg_forward': sys/net/bridge.c:931: warning: suggest parentheses around assignment used as truth value *** Error code 1
* PFIL_HOOKS optimization: check if at least one hook is present beforesam2003-02-111-2/+3
| | | | munging the IP header to pass to the hooks
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-6/+6
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Oops, I misread the purpose of the NULL check in EH_RESTORE() iniedowse2002-12-271-2/+3
| | | | | | | | revision 1.62. It was checking for M_PREPEND() failing, not for the case of a NULL mbuf pointer being supplied to the macro. Back out that revision, and fix the NULL dereference by not calling EH_RESTORE() in the case where the mbuf pointer is NULL because the firewall rejected the packet.
* Fix a bug introduced by revision 1.59 that would cause an immediateiedowse2002-12-271-1/+1
| | | | NULL dereference if a bridged packet was rejected by ipfw.
* SMP locking for ifnet list.hsu2002-12-221-10/+22
|
* o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} andbmilekic2002-12-191-2/+2
| | | | | | | | | | the mbuf allocator flags {M_TRYWAIT, M_DONTWAIT}. o Fix a bpf_compat issue where malloc() was defined to just call bpf_alloc() and pass the 'canwait' flag(s) along. It's been changed to call bpf_alloc() but pass the corresponding M_TRYWAIT or M_DONTWAIT flag (and only one of those two). Submitted by: Hiten Pandya <hiten@unixdaemons.com> (hiten->commit_count++)
* track changes to ethernet input handling to no longer strip the Ethernet headersam2002-11-141-48/+55
| | | | | Reviewed by: many Approved by: re
* FIx misindentation.phk2002-10-161-10/+10
| | | | Spotted by: FlexeLint.
* Replace aux mbufs with packet tags:sam2002-10-161-1/+1
| | | | | | | | | | | | | | | | | | | o instead of a list of mbufs use a list of m_tag structures a la openbsd o for netgraph et. al. extend the stock openbsd m_tag to include a 32-bit ABI/module number cookie o for openbsd compatibility define a well-known cookie MTAG_ABI_COMPAT and use this in defining openbsd-compatible m_tag_find and m_tag_get routines o rewrite KAME use of aux mbufs in terms of packet tags o eliminate the most heavily used aux mbufs by adding an additional struct inpcb parameter to ip_output and ip6_output to allow the IPsec code to locate the security policy to apply to outbound packets o bump __FreeBSD_version so code can be conditionalized o fixup ipfilter's call to ip_output based on __FreeBSD_version Reviewed by: julian, luigi (silent), -arch, -net, darren Approved by: julian, silence from everyone else Obtained from: openbsd (mostly) MFC after: 1 month
* When reusing a pointer as a number, at least cast itmux2002-10-061-1/+1
| | | | | to uintptr_t rather than u_int to avoid warnings on 64 bits architectures.
* Make bridging and layer2-ipfw obey net.inet.ip.fw.one_pass.luigi2002-09-121-2/+2
| | | | | | | | | | | | I should have committed this ages ago. The MFC for if_ethersubr.c could be done in the usual few days (only ipfw2 uses it), the one for bridge.c should probably wait until after 4.7 because it changes an existing though mostly undocumented behaviour (on which i hope nobody relies). All in all, i'll wait for both things unless there is demand. MFC after: 35 days
* Remove 0 initializers for global/static variables, so they end up inluigi2002-07-071-4/+4
| | | | | BSS instead of DATA. This marginally reduces the kernel image size, though the difference is almost irrelevant for compressed kernels.
* Remove trailing whitespaces.maxim2002-07-031-2/+2
| | | | Approved by: luigi
* o Strict interface names comparison. The old code assumed "fxp1" == "fxp11".maxim2002-07-031-3/+3
| | | | | | | | o Use an appropriate constant for interface name buffer. Reviewed by: luigi Approved by: luigi MFC after: 1 month
* fix indentation, whitespace and a few comments.luigi2002-06-231-3/+3
|
* Remove (almost all) global variables that were used to holdluigi2002-06-221-35/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | packet forwarding state ("annotations") during ip processing. The code is considerably cleaner now. The variables removed by this change are: ip_divert_cookie used by divert sockets ip_fw_fwd_addr used for transparent ip redirection last_pkt used by dynamic pipes in dummynet Removal of the first two has been done by carrying the annotations into volatile structs prepended to the mbuf chains, and adding appropriate code to add/remove annotations in the routines which make use of them, i.e. ip_input(), ip_output(), tcp_input(), bdg_forward(), ether_demux(), ether_output_frame(), div_output(). On passing, remove a bug in divert handling of fragmented packet. Now it is the fragment at offset 0 which sets the divert status of the whole packet, whereas formerly it was the last incoming fragment to decide. Removal of last_pkt required a change in the interface of ip_fw_chk() and dummynet_io(). On passing, use the same mechanism for dummynet annotations and for divert/forward annotations. option IPFIREWALL_FORWARD is effectively useless, the code to implement it is very small and is now in by default to avoid the obfuscation of conditionally compiled code. NOTES: * there is at least one global variable left, sro_fwd, in ip_output(). I am not sure if/how this can be removed. * I have deliberately avoided gratuitous style changes in this commit to avoid cluttering the diffs. Minor stule cleanup will likely be necessary * this commit only focused on the IP layer. I am sure there is a number of global variables used in the TCP and maybe UDP stack. * despite the number of files touched, there are absolutely no API's or data structures changed by this commit (except the interfaces of ip_fw_chk() and dummynet_io(), which are internal anyways), so an MFC is quite safe and unintrusive (and desirable, given the improved readability of the code). MFC after: 10 days
* Cleanup the interface to ip_fw_chk, two of the input argumentsluigi2002-05-091-36/+34
| | | | | | | | | | | | | | | were totally useless and have been removed. ip_input.c, ip_output.c: Properly initialize the "ip" pointer in case the firewall does an m_pullup() on the packet. Remove some debugging code forgotten long ago. ip_fw.[ch], bridge.c: Prepare the grounds for matching MAC header fields in bridged packets, so we can have 'etherfw' functionality without a lot of kernel and userland bloat.
* Add hooks for very basic IPFilter support in bridging. Set,cjc2002-03-181-5/+42
| | | | | | | | | | | | | # sysctl net.link.ether.bdg_ipf=1 To enable. Just like ipfw(8) bridging, only input packets are filtered in the bridge. Filtering works just like in the IP layer, ipf(8) first, then ipfw(8). And just like in the IP layer, both are independent, one need not be run to use the other. (Note: This will not work in, but doesn't break, the bridge.ko module. The ipl.ko module would need to be fixed before that is worth worrying about.) Reviewed by: luigi
* Unbreak bridge.ko. Replace an unresolved symbol with the actions itcjc2002-03-051-1/+3
| | | | | | | | was meant to take. Submitted by: luigi Approved by: luigi MFC after: 3 days
* o Move NTOHL() and associated macros into <sys/param.h>. These aremike2002-02-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | deprecated in favor of the POSIX-defined lowercase variants. o Change all occurrences of NTOHL() and associated marcros in the source tree to use the lowercase function variants. o Add missing license bits to sparc64's <machine/endian.h>. Approved by: jake o Clean up <machine/endian.h> files. o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>. o Remove prototypes for non-existent bswapXX() functions. o Include <machine/endian.h> in <arpa/inet.h> to define the POSIX-required ntohl() family of functions. o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>, and <sys/param.h>. o Prepend underscores to the ntohl() family to help deal with complexities associated with having MD (asm and inline) versions, and having to prevent exposure of these functions in other headers that happen to make use of endian-specific defines. o Create weak aliases to the canonical function name to help deal with third-party software forgetting to include an appropriate header. o Remove some now unneeded pollution from <sys/types.h>. o Add missing <arpa/inet.h> includes in userland. Tested on: alpha, i386 Reviewed by: bde, jake, tmm
* Lots of improvement to the bridging code.luigi2002-02-151-242/+378
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order of importance: + each cluster now uses private data structures (filtering and local address tables) so you can treat them as fully independent switches. This part of the work was supported by: Cisco Systems, Inc. - NSITE lab, RTP, NC. + cleaned up the handling of configuration, so the system will behave much better when real or pseudo devices are dynamically attached or detached. It should also not panic anymore on systems with large number of devices, closing a few existings PRs on the topic. + while at it, add support for VLAN. This means that a FreeBSD box can now work as a real VLAN switch, with trunk interfaces etc. As an example: ifconfig vlan0 vlan 3 vlandev dc0 ifconfig vlan1 vlan 4 vlandev dc0 net.link.ether.bridge_cfg="vlan0:3,dc1:3,vlan1:4,dc1:4" uses dc0 as a trunk interface, and dc1 and dc3 as ports on vlans 3 and 4 You get the idea... NOTA BENE: by default bridge_cfg is initialised to "" so even if you enable bridging, no packets will be bridged until you set the list of interfaces on which you want this to happen. + large restructuring of the code, moving private vars and types from bridge.h to bridge.c. + added a lot of comments to the code to explain how to use it.
* Whitespace change - replace leading spaces with tabs.luigi2001-11-241-6/+6
|
* MFS: sync the ipfw/dummynet/bridge code with the one recently mergedluigi2001-11-041-88/+173
| | | | into stable (mostly , but not only, formatting and comments changes).
* Remove an extra splimp() call.luigi2001-11-011-1/+0
| | | | Spotted-by: diff(1)
* Fix this so it compiles cleanly for alpha. Tried to do some minimal testing.mjacob2001-10-191-8/+8
| | | | Reviewed by: freebsd-net
* Traverse the list of network interfaces rather than use if_index- if_index ismjacob2001-10-121-3/+1
| | | | not guaranteed to be dense with respect to the actual list of interfaces.
* Make it so dummynet and bridge can be loaded as modules.ps2001-10-051-27/+55
| | | | Submitted by: billf
* Two main changes here:luigi2001-09-271-2/+2
| | | | | | | | | | | | | | | + implement "limit" rules, which permit to limit the number of sessions between certain host pairs (according to masks). These are a special type of stateful rules, which might be of interest in some cases. See the ipfw manpage for details. + merge the list pointers and ipfw rule descriptors in the kernel, so the code is smaller, faster and more readable. This patch basically consists in replacing "foo->rule->bar" with "rule->bar" all over the place. I have been willing to do this for ages! MFC after: 1 week
* Remove unused variablepeter2001-06-151-1/+0
|
* Sync with the bridge/dummynet/ipfw code already tested in stable.luigi2001-02-101-67/+60
| | | | | In ip_fw.[ch] change a couple of variable and field names to avoid having types, variables and fields with the same name.
* Mechanical change to use <sys/queue.h> macro API instead ofphk2001-02-041-2/+2
| | | | | | | fondling implementation details. Created with: sed(1) Reviewed by: md5(1)
* Use <sys/queue.h> macro api rather than fondle its implementation detals.phk2001-02-031-6/+6
| | | | | Created with: /usr/bin/sed Reviewed by: /sbin/md5
* MFS: bridge/ipfw/dummynet fixesluigi2001-02-021-170/+115
|
* Minor cleanups after yesterday's patch.luigi2001-01-261-19/+10
| | | | The code (bridging and dummynet) actually worked fine!
* Bring bridging code in line with the one which works on -STABLE.luigi2001-01-261-49/+97
| | | | It compiles on -CURRENT, but I can not test functionality yet.
* Assorted bugfixes:luigi2001-01-221-14/+23
| | | | | | | | | | | | | | | | | | | | | | | | + configuration: make sure that the NUL at the end of the config string is properly detected and handled, and the stats passed up via sysctl properly reflect which interfaces do bridging. (The whole config support might make good use of some cleanup in the future). + fixed some bugs related to the corruption of multicast and broadcast packets: make sure that for those packets the entire IP + ethernet header is in the mbuf, not in a cluster, so that writes performed in that area by the upper layers do not affect us. + performance: when calling m_pullup, make room for the ethernet header as well, we are going to add it in right after. Also, change an m_dup back to m_copypacket. The former is not necessary anymore now, and it did not help, anyways. I will do a fast MFC because 95% of this patch is fixing bad bugs and i doubt anyone would test the fix in CURRENT. Plus the last two items mostly bring back some code which was already there in 4.0 times.
OpenPOWER on IntegriCloud