summaryrefslogtreecommitdiff
path: root/sys/netinet/libalias/alias_proxy.c
AgeCommit message (Collapse)Author
2024-11-29tcp: extend the use of the th_flags accessor functionRichard Scheffenegger
Formally, there are 12 bits for TCP header flags. Use the accessor functions in more (kernel) places. No functional change. Reviewed By: cc, #transport, cy, glebius, #iflib, kbowling Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D47063
2023-08-16sys: Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
2022-11-09ipfw: Have NAT steal the TH_RES1 bit, instead of the TH_AE bitRichard Scheffenegger
The NAT module use of the tcphdr.th_x2 field now collides with the use of this TCP header flag as AccECN (AE) bit. Use the topmost bit instead to allow negotiation of AccECN across a NAT device. Event: IETF 115 Hackathon Reviewed By: #transport, tuexen MFC after: 3 days Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D37300
2022-04-09libalias(3): Fix two typos in source code commentsGordon Bergling
- s/modfied/modified/ MFC after: 3 days
2021-05-15libalias: Style cleanupLutz Donnerhacke
libalias is a convolut of various coding styles modified by a series of different editors enforcing interesting convetions on spacing and comments. This patch is a baseline to start with a perfomance rework of libalias. Upcoming patches should be focus on the code, not on the style. That's why most annoying style errors should be fixed beforehand. Reviewed by: hselasky Discussed by: emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30259
2021-01-19libalias: Fix -Wcast-align compiler warningsAlex Richardson
This fixes -Wcast-align warnings caused by the underaligned `struct ip`. This also silences them in the public functions by changing the function signature from char * to void *. This is source and binary compatible and avoids the -Wcast-align warning. Reviewed By: ae, gbe (manpages) Differential Revision: https://reviews.freebsd.org/D27882
2020-09-01net: clean up empty lines in .c and .h filesMateusz Guzik
Notes: svn path=/head/; revision=365071
2017-11-27sys: general adoption of SPDX licensing ID tags.Pedro F. Giffuni
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. 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. No functional change intended. Notes: svn path=/head/; revision=326272
2017-03-13alias_proxy.c: Fix accidental error quashingConrad Meyer
This was introduced on accident in r165243, when return sites were unified to add a lock around LibAliasProxyRule(). PR: 217749 Submitted by: Svyatoslav <razmyslov at viva64.com> Sponsored by: Viva64 (PVS-Studio) Notes: svn path=/head/; revision=315207
2017-02-16Use inet_ntoa_r() instead of inet_ntoa() throughout the kernelEric van Gyzen
inet_ntoa() cannot be used safely in a multithreaded environment because it uses a static local buffer. Instead, use inet_ntoa_r() with a buffer on the caller's stack. Suggested by: glebius, emaste Reviewed by: gnn MFC after: 2 weeks Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D9625 Notes: svn path=/head/; revision=313821
2012-10-17Avoid potential bad pointer dereference.Ed Maste
Previously RuleAdd would leave entry->la unset for the first entry in the proxyList. Sponsored by: ADARA Networks MFC After: 1 week Notes: svn path=/head/; revision=241648
2009-11-12Move inet_aton() (specular to inet_ntoa(), already present in libkern)Attilio Rao
into libkern in order to made it usable by other modules than alias_proxy. Obtained from: Sandvine Incorporated Sponsored by: Sandvine Incorporated MFC: 1 week Notes: svn path=/head/; revision=199208
2008-03-06MFP4:Paolo Pisati
restrict the utilization of direct pointers to the content of ip packet. These modifications are functionally nop()s thus can be merged with no side effects. Notes: svn path=/head/; revision=176884
2007-04-30o Kill EOLWS while I'm here.Maxim Konovalov
Notes: svn path=/head/; revision=169149
2007-04-30o Fix strtoul() error conditions check.Maxim Konovalov
PR: kern/108211 Submitted by: Yong Tang MFC after: 2 weeks Notes: svn path=/head/; revision=169148
2007-04-04Do not assign result of (char *) cast to u_char * variable.Alexander Kabaev
Notes: svn path=/head/; revision=168342
2006-12-15o made in kernel libalias mpsafePaolo Pisati
o fixed a comment o made in kernel libalias a bit less verbose (disabled automatic logging everytime a new link is added or deleted) Approved by: glebius (mentor) Notes: svn path=/head/; revision=165243
2006-09-26Summer of Code 2005: improve libalias - part 1 of 2Paolo Pisati
With the first part of my previous Summer of Code work, we get: -made libalias modular: -support for 'particular' protocols (like ftp/irc/etcetc) is no more hardcoded inside libalias, but it's available through external modules loadable at runtime -modules are available both in kernel (/boot/kernel/alias_*.ko) and user land (/lib/libalias_*) -protocols/applications modularized are: cuseeme, ftp, irc, nbt, pptp, skinny and smedia -added logging support for kernel side -cleanup After a buildworld, do a 'mergemaster -i' to install the file libalias.conf in /etc or manually copy it. During startup (and after every HUP signal) user land applications running the new libalias will try to read a file in /etc called libalias.conf: that file contains the list of modules to load. User land applications affected by this commit are ppp and natd: if libalias.conf is present in /etc you won't notice any difference. The only kernel land bit affected by this commit is ng_nat: if you are using ng_nat, and it doesn't correctly handle ftp/irc/etcetc sessions anymore, remember to kldload the correspondent module (i.e. kldload alias_ftp). General information and details about the inner working are available in the libalias man page under the section 'MODULAR ARCHITECTURE (AND ipfw(4) SUPPORT)'. NOTA BENE: this commit affects _ONLY_ libalias, ipfw in-kernel nat support will be part of the next libalias-related commit. Approved by: glebius Reviewed by: glebius, ru Notes: svn path=/head/; revision=162674
2005-06-27Disable checksum processing in LibAlias, when it works as aGleb Smirnoff
kernel module. LibAlias is not aware about checksum offloading, so the caller should provide checksum calculation. (The only current consumer is ng_nat(4)). When TCP packet internals has been changed and it requires checksum recalculation, a cookie is set in th_x2 field of TCP packet, to inform caller that it needs to recalculate checksum. This ugly hack would be removed when LibAlias is made more kernel friendly. Incremental checksum updates are left as is, since they don't conflict with offloading. Approved by: re (scottl) Notes: svn path=/head/; revision=147623
2005-05-06Add a workaround for 64-bit archs: store unsigned long return value inGleb Smirnoff
temporary variable, check it and then cast to in_addr_t. Notes: svn path=/head/; revision=145963
2005-05-06s/DEBUG/LIBALIAS_DEBUG/, since DEBUG is defined in LINT andGleb Smirnoff
not supported for kernel build. Notes: svn path=/head/; revision=145961
2005-05-05More bits for kernel version:Gleb Smirnoff
- copy inet_aton() from libc - disable getservbyname() lookup and accept only numeric port Notes: svn path=/head/; revision=145933
2005-05-05Always include alias.h before alias_local.hGleb Smirnoff
Notes: svn path=/head/; revision=145932
2005-05-05Fix argument order for bcopy() in last commit.Gleb Smirnoff
Noticed by: njl Pointy hat to: glebius Notes: svn path=/head/; revision=145930
2005-05-05Use bcopy() instead of memmove().Gleb Smirnoff
Notes: svn path=/head/; revision=145929
2005-05-05Play with includes so that libalias can be compiled both as userlandGleb Smirnoff
library and kernel module. Notes: svn path=/head/; revision=145921
2004-07-06Introduce inline {ip,udp,tcp}_next() functions which take a pointer to anDag-Erling Smørgrav
{ip,udp,tcp} header and return a void * pointing to the payload (i.e. the first byte past the end of the header and any required padding). Use them consistently throughout libalias to a) reduce code duplication, b) improve code legibility, c) get rid of a bunch of alignment warnings. Notes: svn path=/head/; revision=131699
2004-07-05Make libalias WARNS?=6-clean. This mostly involves renaming variablesDag-Erling Smørgrav
named link, foo_link or link_foo to lnk, foo_lnk or lnk_foo, fixing signed / unsigned comparisons, and shoving unused function arguments under the carpet. I was hoping WARNS?=6 might reveal more serious problems, and perhaps the source of the -O2 breakage, but found no smoking gun. Notes: svn path=/head/; revision=131614
2004-07-05Parenthesize return values.Dag-Erling Smørgrav
Notes: svn path=/head/; revision=131613
2004-07-05Mechanical whitespace cleanup.Dag-Erling Smørgrav
Notes: svn path=/head/; revision=131612
2004-03-16Run through indent(1) so I can read the code without getting a headache.Dag-Erling Smørgrav
The result isn't quite knf, but it's knfer than the original, and far more consistent. Notes: svn path=/head/; revision=127094
2004-01-17Mostly mechanical rework of libalias:Poul-Henning Kamp
Makes it possible to have multiple packet aliasing instances in a single process by moving all static and global variables into an instance structure called "struct libalias". Redefine a new API based on s/PacketAlias/LibAlias/g Add new "instance" argument to all functions in the new API. Implement old API in terms of the new API. Notes: svn path=/head/; revision=124621
2003-01-01Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,Jens Schweikhardt
especially in troff files. Notes: svn path=/head/; revision=108533
2002-07-01Remove trailing whitespaceBrian Somers
Notes: svn path=/head/; revision=99207
2001-11-03cmott@scientech.com -> cm@linktel.netBrian Somers
Requested by: Charles Mott <cmott@scientech.com> Notes: svn path=/head/; revision=85964
2001-09-30Add __FBSDID's to libaliasMatthew Dillon
Notes: svn path=/head/; revision=84195
2001-06-04Add BSD-style copyright headersBrian Somers
Approved by: Charles Mott <cmott@scientech.com> Notes: svn path=/head/; revision=77701
2001-03-25Remove an extraneous declaration.Brian Somers
Notes: svn path=/head/; revision=74768
2001-01-29Ignore leading witespace in the string given to PacketAliasProxyRule().Brian Somers
Notes: svn path=/head/; revision=71763
2000-08-29strtok -> strsep (no strtok allowed in libraries)Andrey A. Chernov
add unsigned char cast to ctype macro Notes: svn path=/head/; revision=65221
1999-08-29Add $FreeBSD$ and spell Eklund properly.Bill Fumerola
Approved by: brian (well, he approved adding $Id$) Notes: svn path=/head/; revision=50597
1999-03-24Add a ``const'' and remove some inconsistent prototype args.Brian Somers
Notes: svn path=/head/; revision=45008
1999-03-09Remove all diagnostics to stdout/stderr with #ifdef DEBUGBrian Somers
Statify functions in alias_nbt.c Notes: svn path=/head/; revision=44616
1999-02-27Version 3.0: January 1, 1999Brian Somers
- Transparent proxying support added. - PPTP redirecting support added based on patches contributed by Dru Nelson <dnelson@redwoodsoft.com>. Submitted by: Charles Mott <cmott@srv.net> Notes: svn path=/head/; revision=44307