summaryrefslogtreecommitdiff
path: root/sys/netinet/in.h
AgeCommit message (Collapse)Author
2024-02-13Merge struct route and struct route_in6.Alexander Bluhm
Use a common struct route for both inet and inet6. Unfortunately struct sockaddr is shorter than sockaddr_in6, so netinet/in.h has to be exposed from net/route.h. Struct route has to be bsd visible for userland as netstat kvm code inspects inp_route. Internet PCB and TCP SYN cache can use a plain struct route now. All specific sockaddr types for inet and inet6 are embeded there. OK claudio@
2024-02-09Route cache function returns hit or miss.Alexander Bluhm
The route_cache() function can easily return whether it was a cache hit or miss. Then the logic to perform a route lookup gets a bit simpler. Some more complicated if (ro->ro_rt == NULL) checks still exist elsewhere. Also use route cache in in_pcbselsrc() instead of filling struct route manually. OK claudio@
2024-02-05Move route_cache() declaration from net/route.h to netinet/in.h.Kenji Aoyama
This prevents gcc3's 'parameter has incomplete type' warning that causes kernel build failure. Suggested by claudio@, ok bluhm@
2023-11-10rtable_match() takes constant destination.Alexander Bluhm
For implementing MP safe route lookup, it helps to know which function parameters are constant. Add some const declarations, so that the compiler guarantees that sockaddr dst parameter of rtable_match() does not change. OK dlg@
2023-05-13Instead of implementing IPv4 header checksum creation everywhere,Alexander Bluhm
introduce in_hdr_cksum_out(). It is used like in_proto_cksum_out(). OK claudio@
2023-05-10Implement TCP send offloading, for now in software only. This isAlexander Bluhm
meant as a fallback if network hardware does not support TSO. Driver support is still work in progress. TCP output generates large packets. In IP output the packet is chopped to TCP maximum segment size. This reduces the CPU cycles used by pf. The regular output could be assisted by hardware later, but pf route-to and IPsec needs the software fallback in general. For performance comparison or to workaround possible bugs, sysctl net.inet.tcp.tso=0 disables the feature. netstat -s -p tcp shows TSO counter with chopped and generated packets. based on work from jan@ tested by jmc@ jan@ Hrvoje Popovski OK jan@ claudio@
2023-04-11fix double words in commentsJonathan Gray
feedback and ok jmc@ miod, ok millert@
2021-06-02factor out the code that does basic sanity checks on ipv4 headers.David Gwynne
this will allow these checks to be reused by bridge (where they're currently duplicated), veb, and tpmr. ok bluhm@ sashan@
2021-01-18add IPPROTO_SCTP, ok claudio@Stuart Henderson
2021-01-07Extend IP_ADD_MEMBERSHIP to also support struct ip_mreqn.Claudio Jeker
struct ip_mreqn allows to use the interface index to select the interface for multicast packets which makes it possible to use this with unnumbered interfaces. OK dlg@ robert@
2020-08-22Convert ip_sysctl to sysctl_bounded_argsgnezdo
2019-11-04remove mobileip(4)David Gwynne
noone seems to use it, and we should not encourage people to use it by having it available. it's been disabled for most of the last release and noones asked for it in 6.6, so i'm taking that as an ok for this removal.
2019-10-25make whitespace in the IPPROTO defines consistent. no functional change.David Gwynne
2019-10-25+#define IPPROTO_UDPLITE 136, as per RFC 3828 and the IANA allocationDavid Gwynne
please don't interpret this as an intention on my part to implement UDP-Lite.
2019-10-23Kernel is missing propper input validation when configuring addresses.Alexander Bluhm
Fix the SIOCAIFADDR and SIOCDIFADDR ioctl(2) by implementing in_sa2sin() to validate inet address family and address length. OK visa@
2018-10-13Expose net.inet.ip.arpq.drops to help debug what's going on when a lotFlorian Obser
of packets are being dropped but non of the other counters are increasing. From Daniel Hokka Zakrisson (daniel AT hozac DOT com), thanks! OK florian, phessler
2018-09-11Convert inetctlerrmap to u_char like inet6ctlerrmap. That is alsoAlexander Bluhm
what FreeBSD does. Remove old #if 0 version of inet6ctlerrmap. OK mpi@
2018-07-10Introduce new IPsec (per-CPU) statistics and refactor ESP inputMartin Pieuchot
callbacks to be able to count dropped packet. Having more generic statistics will help troubleshooting problems with specific tunnels. Per-TDB counters are coming once all the refactoring bits are in. ok markus@
2018-06-07The global zero addresses must not change, mark them constant.Alexander Bluhm
OK tb@ visa@
2018-03-02Revert all the bits of the autocreate 127.0.0.1 on lo(4) creation for now.Claudio Jeker
This needs to go back to the drawing board.
2018-02-10Similar to the IPv6 case create 127.0.0.1/8 on lo(4) interfaces which actClaudio Jeker
as loopback interfaces for each rdomain (including lo0). This is done when the interface is brought up. This is now also done by default (either on attach of lo0 or when creating the rdomain). OK mpi@
2017-11-20Sprinkle some NET_ASSERT_LOCKED(), const and co to prepare runningMartin Pieuchot
pr_input handlers without KERNEL_LOCK(). ok visa@
2017-11-14Introduce ipsec_sysctl() and move IPsec tunables where they belong.Martin Pieuchot
ok bluhm@, visa@
2017-10-06Kill the divert-packet socket option IP_DIVERTFL to filter packets.Alexander Bluhm
It used a loop over the global list divbtable that would be hard to make MP safe. The port net/dnsfilter does not work without this, it should be converted to divert-to. Neither other ports nor base use this filter feature. ports checked by sthen@; OK mpi@ benno@
2017-08-11Validate sockaddr from userland in central functions. This resultsAlexander Bluhm
in common checks for unix, inet, inet6 instead of partial checks here and there. Some checks are already done at a higher layer, but better be paranoid with user input. OK claudio@ millert@
2017-05-30Introduce ipv{4,6}_input(), two wrappers around IP queues.Martin Pieuchot
This will help transitionning to an un-KERNEL_LOCK()ed IP forwarding path. Disucssed with bluhm@, ok claudio@
2017-05-04Introduce sstosa() for converting sockaddr_storage with a type safeAlexander Bluhm
inline function instead of casting it to sockaddr. While there, use inline instead of __inline for all these conversions. Some struct sockaddr casts can be avoided completely. OK dhill@ mpi@
2017-02-04Move the typedefs for in_{addr,port}_t from <sys/types.h> toPhilip Guenther
<netinet/in.h> and <arpa/inet.h> ok and ports test naddy@ (thanks!) ok krw@ beck@ millert@
2016-12-22Remove PIM support from the multicast stack.Rafael Zalamena
ok mpi@
2016-09-04Implement a sockaddr_ntop() function that works like inet_ntop() but printsClaudio Jeker
sockaddrs. Works for all sockaddrs so can be used to print sockaddrs nicely. OK phessler@
2016-08-16Add IP_SENDSRCADDR cmsg for UDP sockets. As suggested by sthen@,Vincent Gross
IP_SENDSRCADDR == IP_RECVDSTADDR. OK sthen@ jca@ bluhm@
2016-06-28Add sysctl for arp timers: net.inet.ip.arptimeout (expire timer for resolvedChris Cappuccio
entries) and net.inet.ip.arpdown (expire timer for unresolved entries) ok mpi@
2016-06-15Add umb(4) - a driver for the Mobile Broadband Interface Model (MBIM)Gerhard Roth
The umb(4) driver provides support for USB MBIM devices. Those devices establish connections via celluar networks such as GPRS, UMTS, and LTE. ok mpi@ sthen@ additional feedback from deraadt@ jmc@ stsp@ kettenis@
2015-10-20add a new getsockopt option IP_IPDEFTTL to retrieve the default ttl.Sebastian Benoit
this can be used as an alternative to sysctl net.inet.ip.ttl, in programs that use pledge(). ok reyk@, "Like this" deraadt@
2015-04-14Remove support for storing credentials and auth information in the kernel.Mike Belopuhov
This code is largely unfinished and is not used for anything. The change leaves identities as only objects referenced by ipsec_ref structure and their handling requires some changes to support more advanced matching of IPsec connections. No objections from reyk and hshoexer, with and OK markus.
2015-04-10replace the use of ifqueues for most input queues serviced by netisrDavid Gwynne
with niqueues. this change is so big because there's a lot of code that takes pointers to different input queues (eg, ether_input picks between ipv4, ipv6, pppoe, arp, and mpls input queues) and falls through to code to enqueue packets against the pointer. if i changed only one of the input queues id have to add sepearate code paths, one for ifqueues and one for niqueues in each of these places by flipping all these input queues at once i can keep the currently common code common. testing by mpi@ sthen@ and rafael zalamena ok mpi@ sthen@ claudio@ henning@
2015-02-09Implement 2 sysctl to retrieve the multicast forwarding cache (mfc) and theClaudio Jeker
virtual interface table (vif). Will be used by netstat soon. Looked over by guenther@
2014-12-05Explicitly include <net/if_var.h> instead of pulling it in <net/if.h>.Martin Pieuchot
ok mikeb@, krw@, bluhm@, tedu@
2014-11-25Since in_broadcast() is now used to always iterate on all the interfacesMartin Pieuchot
of your system, put it on a diet and kill the superfluous logic. ok mikeb@
2014-07-12Tackle the endian.h mess. Make it so that:Philip Guenther
* you can #include <sys/endian.h> instead of <machine/endian.h>, and ditto <endian.h> (fixes code that pulls in <sys/endian.h> first) * those will always export the symbols that POSIX specified for <endian.h>, including the new {be,le}{16,32,64}toh() set. c.f. http://austingroupbugs.net/view.php?id=162 if __BSD_VISIBLE then you also get the symbols that our <machine/endian.h> currently exports (ntohs, NTOHS, dlg's bemtoh*, etc) * when doing POSIX compiles (not __BSD_VISIBLE), then <netinet/in.h> and <arpa/inet.h> will *stop* exporting the extra symbols like BYTE_ORDER and betoh* ok deraadt@
2014-04-25Kill in_localaddr(), one less usage of the global list of IPv4 addresses.Martin Pieuchot
This function is used only once in our tree to optimize the size of the MSS if the forward address correspond to a host on one of our subnets, but only if ip.mutdisc is disable, which is not the default! While here get rid of the "#ifdef RTV_MTU", it is here. ok henning@, mikeb@, bluhm@
2014-04-21remove a define in an #ifdef notyet - "not yet" for 19 years gotta beHenning Brauer
enough. remove a define in an #ifdef notdef /* obsolete */ - 14 years are enough
2014-04-21annotate all #endifs to make clear what #if(def) they endHenning Brauer
2014-04-21cosmetic changes regarding #ifdef to make things more obvious, ok reykHenning Brauer
2014-04-20move in_cksum_phdr from in.h (under #ifdef _KERNEL, at least) to ip_output.cHenning Brauer
nothing except in_proto_cksum_out() uses it any more, and that's a good thing. was on tech for 3 months, discussed with many
2014-04-20nuke in_cksum_addword()Henning Brauer
don't we all love functions implemented in header files? was under #ifdef _KERNEL at least. incremental checksum updates don't really make sense any more, this is incredibly hard to get right, and doesn't fit the way our kernel deals with the checksums these days. consequently, nothing uses in_cksum_addword any more. was on tech for 3 months, tested by & discussed with many.
2014-01-23put the in{,6}_delayed_cksum() and in{,6}_proto_cksum_out() prototypesChristian Weisgerber
into consistent locations; ok henning@
2013-11-11Replace most of our formating functions to convert IPv4/6 addresses fromMartin Pieuchot
network to presentation format to inet_ntop(). The few remaining functions will be soon converted. ok mikeb@, deraadt@ and moral support from henning@
2013-10-23Remove the number of in_var.h inclusions by moving some functions andMartin Pieuchot
global variables to in.h. ok mikeb@, deraadt@
2013-10-23No need to expose twice in_socktrim(), it is only used in one file.Martin Pieuchot