aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if_gif.c
Commit message (Collapse)AuthorAgeFilesLines
* Do pass removing some write-only variables from the kernel.Alexander Kabaev2017-12-251-2/+0
| | | | | | | | | | | | This reduces noise when kernel is compiled by newer GCC versions, such as one used by external toolchain ports. Reviewed by: kib, andrew(sys/arm and sys/arm64), emaste(partial), erj(partial) Reviewed by: jhb (sys/dev/pci/* sys/kern/vfs_aio.c and sys/kern/kern_synch.c) Differential Revision: https://reviews.freebsd.org/D10385 Notes: svn path=/head/; revision=327173
* sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326023
* Extract out the various local definitions of ETHER_IS_BROADCAST() andAdrian Chadd2016-08-071-8/+0
| | | | | | | | | | | | turn them into a shared definition. Set M_MCAST/M_BCAST appropriately upon packet reception in net80211, just before they are delivered up to the ethernet stack. Submitted by: rstone Notes: svn path=/head/; revision=303811
* Cleanup unnecessary semicolons from the kernel.Pedro F. Giffuni2016-04-101-1/+1
| | | | | | | Found with devel/coccinelle. Notes: svn path=/head/; revision=297793
* Clean up unused-but-set-variable spotted by gcc4.9.Marcelo Araujo2015-12-311-2/+0
| | | | | | | | | Reviewed by: ngie Approved by: rodrigc (mentor) Differential Revision: https://reviews.freebsd.org/D4719 Notes: svn path=/head/; revision=292980
* Add IFCAP_LINKSTATE support.Hiroki Sato2015-10-031-2/+8
| | | | Notes: svn path=/head/; revision=288575
* - Remove GIF_{SEND,ACCEPT}_REVETHIP.Hiroki Sato2015-09-101-52/+24
| | | | | | | | | - Simplify EADDRNOTAVAIL and EAFNOSUPPORT conditions. MFC after: 3 days Notes: svn path=/head/; revision=287607
* Eliminate the use of m_copydata() in gif_encapcheck().Andrey V. Elsukov2015-07-291-3/+4
| | | | | | | | | | | | | | | | | | ip_encap already has inspected mbuf's data, at least an IP header. And it is safe to use mtod() and do direct access to needed fields. Add M_ASSERTPKTHDR() to gif_encapcheck(), since the code expects that mbuf has a packet header. Move the code from gif_validate[46] into in[6]_gif_encapcheck(), also remove "martian filters" checks. According to RFC 4213 it is enough to verify that the source address is the address of the encapsulator, as configured on the decapsulator. Reviewed by: melifaro Obtained from: Yandex LLC Sponsored by: Yandex LLC Notes: svn path=/head/; revision=286013
* Add new socket ioctls SIOC[SG]TUNFIB to set FIB number of encapsulatedAndrey V. Elsukov2015-05-121-1/+11
| | | | | | | | | | | | | | packets on tunnel interfaces. Add support of these ioctls to gre(4), gif(4) and me(4) interfaces. For incoming packets M_SETFIB() should use if_fib value from ifnet structure, use proper value in gre(4) and me(4). Differential Revision: https://reviews.freebsd.org/D2462 No objection from: #network MFC after: 2 weeks Sponsored by: Yandex LLC Notes: svn path=/head/; revision=282809
* Restore Ethernet-within-IP Encapsulation support that was broken afterAndrey V. Elsukov2015-01-101-24/+18
| | | | | | | | | | | | | r273087. Move all checks from gif_output() into gif_transmit(). Previously they were checked always, because if_start always called gif_output. Now gif_transmit() can be called directly from if_bridge() code and we need do checks here. PR: 196646 MFC after: 1 week Notes: svn path=/head/; revision=276907
* Use if_name() macro instead of ifp->if_xname.Andrey V. Elsukov2015-01-101-1/+1
| | | | | | | MFH: 1 week Notes: svn path=/head/; revision=276903
* Move the recursion detection code into separate function gif_check_nesting().Andrey V. Elsukov2015-01-101-37/+39
| | | | | | | | | Also make MTAG_GIF definition private to if_gif.c. MFC after: 1 week Notes: svn path=/head/; revision=276901
* Extern declarations in C files loses compile-time checking thatAndrey V. Elsukov2014-12-251-10/+0
| | | | | | | | | the functions' calls match their definitions. Move them to header files. Reviewed by: jilles (previous version) Notes: svn path=/head/; revision=276215
* Remove in_gif.h and in6_gif.h files. They only contain functionAndrey V. Elsukov2014-12-231-2/+10
| | | | | | | | declarations used by gif(4). Instead declare these functions in C files. Also make some variables static. Notes: svn path=/head/; revision=276148
* Remove SYSCTL_VNET_* macros, and simply put CTLFLAG_VNET where needed.Gleb Smirnoff2014-11-071-3/+4
| | | | | | | Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=274225
* Remove redundant check and m_pullup() call.Andrey V. Elsukov2014-10-241-2/+0
| | | | Notes: svn path=/head/; revision=273587
* Add more ifdefs. SIOC*_IN6 are defined only with INET6.Andrey V. Elsukov2014-10-141-0/+6
| | | | | | | | MFC after: 1 month Reported by: bz Notes: svn path=/head/; revision=273091
* Move memset under ifdef INET6.Andrey V. Elsukov2014-10-141-1/+1
| | | | | | | | MFH: 1 month Reported by: bz Notes: svn path=/head/; revision=273090
* Overhaul if_gif(4):Andrey V. Elsukov2014-10-141-427/+472
| | | | | | | | | | | | | | | | | o convert to if_transmit; o use rmlock to protect access to gif_softc; o use sx lock to protect from concurrent ioctls; o remove a lot of unneeded and duplicated code; o remove cached route support (it won't work with concurrent io); o style fixes. Reviewed by: melifaro Obtained from: Yandex LLC MFC after: 1 month Sponsored by: Yandex LLC Notes: svn path=/head/; revision=273087
* When tunneling interface is going to insert mbuf into netisr queue after ↵Andrey V. Elsukov2014-10-081-0/+1
| | | | | | | | | | | | | | | | | stripping outer header, consider it as new packet and clear the protocols flags. This fixes problems when IPSEC traffic goes through various tunnels and router doesn't send ICMP/ICMPv6 errors. PR: 174602 Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Notes: svn path=/head/; revision=272770
* Virtualize interface cloner for gif(4). This fixes a panic when destroyingHiroki Sato2014-09-211-23/+37
| | | | | | | a vnet jail which has a gif(4) interface. Notes: svn path=/head/; revision=271917
* Mechanically convert to if_inc_counter().Gleb Smirnoff2014-09-191-10/+10
| | | | Notes: svn path=/head/; revision=271867
* ANSIfy function defintions.Andrey V. Elsukov2013-11-151-29/+8
| | | | Notes: svn path=/head/; revision=258167
* Remove never used ioctls that originate from KAME. The proofGleb Smirnoff2013-11-111-35/+0
| | | | | | | of their zero usage was exp-run from misc/183538. Notes: svn path=/head/; revision=257943
* The r48589 promised to remove implicit inclusion of if_var.h soon. PrepareGleb Smirnoff2013-10-261-0/+1
| | | | | | | | | | | to this event, adding if_var.h to files that do need it. Also, include all includes that now are included due to implicit pollution via if_var.h Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=257176
* Clean up SIOCSIFDSTADDR usage from ifnet drivers. The ioctl itself isGleb Smirnoff2013-09-111-3/+0
| | | | | | | | | | | extremely outdated, and I doubt that it was ever used for ifnet drivers. It was used for AF_INET sockets in pre-FreeBSD time. Approved by: re (hrs) Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=255471
* - Drop GIF_ACCEPT_REVETHIP flag by default.Hiroki Sato2013-07-121-1/+13
| | | | | | | - Add IFF_MONITOR support. Notes: svn path=/head/; revision=253261
* Add const qualifier to the dst parameter of the ifnet if_output method.Gleb Smirnoff2013-04-261-9/+5
| | | | Notes: svn path=/head/; revision=249925
* Make the "struct if_clone" opaque to users of the cloning API. UsersGleb Smirnoff2012-10-161-6/+6
| | | | | | | | | | | | | | | now use function calls: if_clone_simple() if_clone_advanced() to initialize a cloner, instead of macros that initialize if_clone structure. Discussed with: brooks, bz, 1 year ago Notes: svn path=/head/; revision=241610
* Revert previous commit...Kevin Lo2012-10-101-1/+1
| | | | | | | Pointyhat to: kevlo (myself) Notes: svn path=/head/; revision=241394
* Prefer NULL over 0 for pointersKevin Lo2012-10-091-1/+1
| | | | Notes: svn path=/head/; revision=241370
* Hold GIF_LOCK() for almost all of gif_start(). It is required to be heldJohn Baldwin2012-06-291-18/+0
| | | | | | | | | | | | across in_gif_output() and in6_gif_output() anyway, and once it is held across those it might as well be held for the entire loop. This simplifies the code and removes the need for the custom IFF_GIF_WANTED flag (which belonged in the softc and not as an IFF_* flag anyway). Tested by: Vincent Hoffman vince unsane co uk Notes: svn path=/head/; revision=237787
* Fix comment to better reflect how we areRandall Stewart2012-06-121-6/+11
| | | | | | | | cheating and using the csum_data. Also fix style issues with the comments. Notes: svn path=/head/; revision=236957
* Note to self. Have morning coffee *before* committing things.Randall Stewart2012-06-121-4/+6
| | | | | | | | | There is no mac_addr in the mbuf for BSD.. cheat like we are supposed to and use the csum field since our friend the gif tunnel itself will never use offload. Notes: svn path=/head/; revision=236955
* Allow a gif tunnel to be used with ALTq.Randall Stewart2012-06-121-46/+102
| | | | | | | Reviewed by: gnn Notes: svn path=/head/; revision=236951
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.Ed Schouten2011-11-071-1/+1
| | | | | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static. Notes: svn path=/head/; revision=227309
* Tag mbufs of all incoming frames or packets with the interface's FIBBjoern A. Zeeb2011-07-031-0/+1
| | | | | | | | | | | | setting (either default or if supported as set by SIOCSIFFIB, e.g. from ifconfig). Submitted by: Alexander V. Chernikov (melifaro ipfw.ru) Reviewed by: julian MFC after: 2 weeks Notes: svn path=/head/; revision=223741
* Hide the outer IP addresses of a tunnel interfaces (gif(4), gre(4))Bjoern A. Zeeb2011-03-021-0/+7
| | | | | | | | | | | | from processes inside jails if the addresses do not belong to the jail. Originally reported by: Pieter de Boer via remko PR: kern/151119 Tested by: Piotr KUCHARSKI (nospam 42.pl) [gif] MFC after: 1 week Notes: svn path=/head/; revision=219206
* After some off-list discussion, revert a number of changes to theDimitry Andric2010-11-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DPCPU_DEFINE and VNET_DEFINE macros, as these cause problems for various people working on the affected files. A better long-term solution is still being considered. This reversal may give some modules empty set_pcpu or set_vnet sections, but these are harmless. Changes reverted: ------------------------------------------------------------------------ r215318 | dim | 2010-11-14 21:40:55 +0100 (Sun, 14 Nov 2010) | 4 lines Instead of unconditionally emitting .globl's for the __start_set_xxx and __stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu sections are actually defined. ------------------------------------------------------------------------ r215317 | dim | 2010-11-14 21:38:11 +0100 (Sun, 14 Nov 2010) | 3 lines Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughout the tree. ------------------------------------------------------------------------ r215316 | dim | 2010-11-14 21:23:02 +0100 (Sun, 14 Nov 2010) | 2 lines Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE. Notes: svn path=/head/; revision=215701
* Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughoutDimitry Andric2010-11-141-4/+4
| | | | | | | the tree. Notes: svn path=/head/; revision=215317
* Add new tunable 'net.link.ifqmaxlen' to set default send interfaceMaxim Sobolev2010-05-031-1/+1
| | | | | | | | | | | | | queue length. The default value for this parameter is 50, which is quite low for many of today's uses and the only way to modify this parameter right now is to edit if_var.h file. Also add read-only sysctl with the same name, so that it's possible to retrieve the current value. MFC after: 1 month Notes: svn path=/head/; revision=207554
* MFP4: @176978-176982, 176984, 176990-176994, 177441Bjoern A. Zeeb2010-04-291-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Whitspace" churn after the VIMAGE/VNET whirls. Remove the need for some "init" functions within the network stack, like pim6_init(), icmp_init() or significantly shorten others like ip6_init() and nd6_init(), using static initialization again where possible and formerly missed. Move (most) variables back to the place they used to be before the container structs and VIMAGE_GLOABLS (before r185088) and try to reduce the diff to stable/7 and earlier as good as possible, to help out-of-tree consumers to update from 6.x or 7.x to 8 or 9. This also removes some header file pollution for putatively static global variables. Revert VIMAGE specific changes in ipfilter::ip_auth.c, that are no longer needed. Reviewed by: jhb Discussed with: rwatson Sponsored by: The FreeBSD Foundation Sponsored by: CK Software GmbH MFC after: 6 days Notes: svn path=/head/; revision=207369
* Check pointer for NULL before dereferencing it, not after.Christian Brueffer2009-10-221-2/+2
| | | | | | | | | PR: 138390 Submitted by: Patroklos Argyroudis <argp@census-labs.com> MFC after: 1 week Notes: svn path=/head/; revision=198357
* Merge the remainder of kern_vimage.c and vimage.h into vnet.c andRobert Watson2009-08-011-1/+1
| | | | | | | | | | | | | vnet.h, we now use jails (rather than vimages) as the abstraction for virtualization management, and what remained was specific to virtual network stacks. Minor cleanups are done in the process, and comments updated to reflect these changes. Reviewed by: bz Approved by: re (vimage blanket) Notes: svn path=/head/; revision=196019
* Introduce and use a sysinit-based initialization scheme for virtualRobert Watson2009-07-231-42/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | network stacks, VNET_SYSINIT: - Add VNET_SYSINIT and VNET_SYSUNINIT macros to declare events that will occur each time a network stack is instantiated and destroyed. In the !VIMAGE case, these are simply mapped into regular SYSINIT/SYSUNINIT. For the VIMAGE case, we instead use SYSINIT's to track their order and properties on registration, using them for each vnet when created/ destroyed, or immediately on module load for already-started vnets. - Remove vnet_modinfo mechanism that existed to serve this purpose previously, as well as its dependency scheme: we now just use the SYSINIT ordering scheme. - Implement VNET_DOMAIN_SET() to allow protocol domains to declare that they want init functions to be called for each virtual network stack rather than just once at boot, compiling down to DOMAIN_SET() in the non-VIMAGE case. - Walk all virtualized kernel subsystems and make use of these instead of modinfo or DOMAIN_SET() for init/uninit events. In some cases, convert modular components from using modevent to using sysinit (where appropriate). In some cases, do minor rejuggling of SYSINIT ordering to make room for or better manage events. Portions submitted by: jhb (VNET_SYSINIT), bz (cleanup) Discussed with: jhb, bz, julian, zec Reviewed by: bz Approved by: re (VIMAGE blanket) Notes: svn path=/head/; revision=195837
* Remove unused VNET_SET() and related macros; only VNET_GET() isRobert Watson2009-07-161-5/+5
| | | | | | | | | | | | ever actually used. Rename VNET_GET() to VNET() to shorten variable references. Discussed with: bz, julian Reviewed by: bz Approved by: re (kensmith, kib) Notes: svn path=/head/; revision=195727
* Build on Jeff Roberson's linker-set based dynamic per-CPU allocatorRobert Watson2009-07-141-25/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (DPCPU), as suggested by Peter Wemm, and implement a new per-virtual network stack memory allocator. Modify vnet to use the allocator instead of monolithic global container structures (vinet, ...). This change solves many binary compatibility problems associated with VIMAGE, and restores ELF symbols for virtualized global variables. Each virtualized global variable exists as a "reference copy", and also once per virtual network stack. Virtualized global variables are tagged at compile-time, placing the in a special linker set, which is loaded into a contiguous region of kernel memory. Virtualized global variables in the base kernel are linked as normal, but those in modules are copied and relocated to a reserved portion of the kernel's vnet region with the help of a the kernel linker. Virtualized global variables exist in per-vnet memory set up when the network stack instance is created, and are initialized statically from the reference copy. Run-time access occurs via an accessor macro, which converts from the current vnet and requested symbol to a per-vnet address. When "options VIMAGE" is not compiled into the kernel, normal global ELF symbols will be used instead and indirection is avoided. This change restores static initialization for network stack global variables, restores support for non-global symbols and types, eliminates the need for many subsystem constructors, eliminates large per-subsystem structures that caused many binary compatibility issues both for monitoring applications (netstat) and kernel modules, removes the per-function INIT_VNET_*() macros throughout the stack, eliminates the need for vnet_symmap ksym(2) munging, and eliminates duplicate definitions of virtualized globals under VIMAGE_GLOBALS. Bump __FreeBSD_version and update UPDATING. Portions submitted by: bz Reviewed by: bz, zec Discussed with: gnn, jamie, jeff, jhb, julian, sam Suggested by: peter Approved by: re (kensmith) Notes: svn path=/head/; revision=195699
* ip_gif_ttl/GIF_TTL are only used by the inet part in in_gif.c,Bjoern A. Zeeb2009-06-101-0/+2
| | | | | | | so put the initialization under #ifdef INET. Notes: svn path=/head/; revision=193913
* Style fix.Hiroki Sato2009-06-091-7/+7
| | | | | | | Submitted by: bz Notes: svn path=/head/; revision=193815
* - Fix sanity check of GIFSOPTS ioctl.Hiroki Sato2009-06-091-4/+4
| | | | | | | | | - Rename option mask s/GIF_FULLOPTS/GIF_OPTMASK/ Spotted by: Eygene Ryabinkin, delphij Notes: svn path=/head/; revision=193796