summaryrefslogtreecommitdiff
path: root/sys/netinet/libalias/alias.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r318150:Eugene Grosbein2017-05-191-1/+3
| | | | | | | | | | Fix translation of transit PPtP/GRE connections for ipfw nat/natd "global" case. PR: 218968 Approved by: ae, vsevolod (mentor) Notes: svn path=/stable/11/; revision=318518
* It'll be okay to use LibAliasDetachHandlers() here, relyingGleb Smirnoff2013-12-251-1/+1
| | | | | | | | on the fact that all handlers come from modules' bss and are followed by NODIR handler. Notes: svn path=/head/; revision=259865
* In m_megapullup() instead of reserving some space at the end of packet,Gleb Smirnoff2013-03-171-10/+6
| | | | | | | | | m_align() it, reserving space to prepend data. Reviewed by: mav Notes: svn path=/head/; revision=248416
* Functions m_getm2() and m_get2() have different order of arguments,Gleb Smirnoff2013-03-121-1/+1
| | | | | | | | | | and that can drive someone crazy. While m_get2() is young and not documented yet, change its order of arguments to match m_getm2(). Sorry for churn, but better now than later. Notes: svn path=/head/; revision=248207
* Utilize m_get2() to get mbuf of appropriate size.Gleb Smirnoff2013-01-301-15/+1
| | | | Notes: svn path=/head/; revision=246130
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-051-2/+2
| | | | | | | | | | | | malloc(9) flags within sys. Exceptions: - sys/contrib not touched - sys/mbuf.h edited manually Notes: svn path=/head/; revision=243882
* Don't spam the console with loaded modules during boot and/or duringNick Hibma2010-11-031-1/+0
| | | | | | | | | | startup of ppp. Note: This cannot be hidden behind bootverbose as this file is included from lib/libalias as well. Notes: svn path=/head/; revision=214754
* Close a stream file descriptor leak.Christian Brueffer2009-10-281-0/+1
| | | | | | | | | PR: 138130 Submitted by: Patroklos Argyroudis <argp@census-labs.com> MFC after: 1 week Notes: svn path=/head/; revision=198539
* What's the point of adjusting a checksum if we are going to toss thePaolo Pisati2009-04-111-7/+4
| | | | | | | packet? Anticipate the check/return code. Notes: svn path=/head/; revision=190941
* Plug two bugs introduced with modules conversion:Paolo Pisati2009-04-111-2/+2
| | | | | | | | | -UdpAliasIn(): correctly check return code after modules ran. -alias_nbt: in case of malformed packets (or some other unrecoverable error), toss the packet. Notes: svn path=/head/; revision=190938
* Remove stale comments.Paolo Pisati2009-04-111-3/+0
| | | | Notes: svn path=/head/; revision=190935
* Add SCTP NAT support.Paolo Pisati2009-02-071-2/+24
| | | | | | | Submitted by: CAIA (http://caia.swin.edu.au) Notes: svn path=/head/; revision=188294
* Implement UDP transparent proxy support.Alexander Motin2008-06-211-10/+76
| | | | | | | | PR: bin/54274 Submitted by: Nicolai Petri <nicolai@petri.cc> Notes: svn path=/head/; revision=179920
* Make m_megapullup() more intelligent:Alexander Motin2008-06-011-12/+32
| | | | | | | | | - to increase performance do not reallocate mbuf when possible, - to support up to 16K packets (was 2K max) use mbuf cluster of proper size. This change depends on recent ng_nat and ip_fw_nat changes. Notes: svn path=/head/; revision=179478
* Fix packet fragmentation support broken by copy/paste error in rev.1.60.Alexander Motin2008-06-011-2/+2
| | | | | | | ip_id should be u_short, but not u_char. Notes: svn path=/head/; revision=179472
* Fix build, together with a bit of style breakage.Dmitry Morozovsky2008-05-021-1/+1
| | | | Notes: svn path=/head/; revision=178730
* -Don't pass down the entire pkt to ProtoAliasIn, ProtoAliasOut, FragmentInPaolo Pisati2008-03-121-35/+43
| | | | | | | | and FragmentOut. -Axe the old PacketAlias API: it has been deprecated since 5.x. Notes: svn path=/head/; revision=177098
* MFP4:Paolo Pisati2008-03-061-30/+29
| | | | | | | | | 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
* o made in kernel libalias mpsafePaolo Pisati2006-12-151-30/+90
| | | | | | | | | | | 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
* Make libalias.conf parsing a bit smarter.Paolo Pisati2006-12-011-10/+18
| | | | | | | | | | | This closes PR kern/106112. While here, add mbuf's #includes i forgot in the previous commit. Approved by: gleb Notes: svn path=/head/; revision=164798
* Remove m_megapullup from ng_nat and put it under libalias.Paolo Pisati2006-12-011-0/+38
| | | | | | | Approved by: gleb Notes: svn path=/head/; revision=164797
* Summer of Code 2005: improve libalias - part 1 of 2Paolo Pisati2006-09-261-80/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Libalias incorrectly applies proxy rules to the global divertPoul-Henning Kamp2005-06-271-1/+5
| | | | | | | | | | socket: it should only look for existing translation entries, not create new ones (no matter how it got the idea). Approved by: re(scottl) Notes: svn path=/head/; revision=147636
* Always include alias.h before alias_local.hGleb Smirnoff2005-05-051-2/+2
| | | | Notes: svn path=/head/; revision=145932
* Play with includes so that libalias can be compiled both as userlandGleb Smirnoff2005-05-051-2/+10
| | | | | | | library and kernel module. Notes: svn path=/head/; revision=145921
* natd core dumps when -reverse switch is used because of a bug inPoul-Henning Kamp2005-04-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | libalias. In /usr/src/lib/libalias/alias.c, the functions LibAliasIn and LibAliasOutTry call the legacy PacketAliasIn/PacketAliasOut instead of LibAliasIn/LibAliasOut when the PKT_ALIAS_REVERSE option is set. In this case, the context variable "la" gets lost because the legacy compatibility routines expect "la" to be global. This was obviously an oversight when rewriting the PacketAlias* functions to the LibAlias* functions. The fix (as shown in the patch below) is to remove the legacy subroutine calls and replace with the new ones using the "la" struct as the first arg. Submitted by: Gil Kloepfer <fgil@kloepfer.org> Confirmed by: <nicolai@catpipe.net> PR: 76839 MFC after: 3 days Notes: svn path=/head/; revision=144666
* Fix outgoing ICMP on global instance.Poul-Henning Kamp2004-08-141-5/+5
| | | | Notes: svn path=/head/; revision=133719
* Introduce inline {ip,udp,tcp}_next() functions which take a pointer to anDag-Erling Smørgrav2004-07-061-22/+22
| | | | | | | | | | {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
* Rewrite twowords() to access its argument through a char pointer and notDag-Erling Smørgrav2004-07-061-2/+9
| | | | | | | | | a short pointer. The previous implementation seems to be in a gray zone of the C standard, and GCC generates incorrect code for it at -O2 or higher on some platforms. Notes: svn path=/head/; revision=131693
* Make libalias WARNS?=6-clean. This mostly involves renaming variablesDag-Erling Smørgrav2004-07-051-124/+129
| | | | | | | | | | | | 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
* Parenthesize return values.Dag-Erling Smørgrav2004-07-051-11/+11
| | | | Notes: svn path=/head/; revision=131613
* Mechanical whitespace cleanup.Dag-Erling Smørgrav2004-07-051-42/+42
| | | | Notes: svn path=/head/; revision=131612
* Add LibAliasOutTry() which checks a packet for a hit in the tables, butPoul-Henning Kamp2004-07-041-16/+28
| | | | | | | does not create a new entry if none is found. Notes: svn path=/head/; revision=131566
* Unbreak natd.Daniel Eischen2004-04-021-0/+1
| | | | | | | Reported and submitted by: Sean McNeil (sean at mcneil.com) Notes: svn path=/head/; revision=127757
* Deal with aliasing warnings.Dag-Erling Smørgrav2004-03-311-172/+57
| | | | | | | | Reviewed by: ru Approved by: silence on the lists Notes: svn path=/head/; revision=127689
* Run through indent(1) so I can read the code without getting a headache.Dag-Erling Smørgrav2004-03-161-964/+895
| | | | | | | | The result isn't quite knf, but it's knfer than the original, and far more consistent. Notes: svn path=/head/; revision=127094
* Mostly mechanical rework of libalias:Poul-Henning Kamp2004-01-171-121/+121
| | | | | | | | | | | | | | | 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
* Add Cisco Skinny Station protocol support to libalias, natd, and ppp.Joe Marcus Clarke2003-09-231-0/+6
| | | | | | | | | | | | | | | | | | Skinny is the protocol used by Cisco IP phones to talk to Cisco Call Managers. With this code, one can use a Cisco IP phone behind a FreeBSD NAT gateway. Currently, having the Call Manager behind the NAT gateway is not supported. More information on enabling Skinny support in libalias, natd, and ppp can be found in those applications' manpages. PR: 55843 Reviewed by: ru Approved by: ru MFC after: 30 days Notes: svn path=/head/; revision=120372
* In the PKT_ALIAS_PROXY_ONLY mode, make sure to preserve theRuslan Ermilov2003-06-131-0/+4
| | | | | | | | | original source IP address, as promised in the manual page. Spotted by: Vaclav Petricek Notes: svn path=/head/; revision=116315
* Don't forget to recalculate the IP checksum of the originalRuslan Ermilov2002-07-231-4/+12
| | | | | | | | | | IP datagram embedded into ICMP error message. Spotted by: tcpdump 3.7.1 (-vvv) MFC after: 3 days Notes: svn path=/head/; revision=100537
* Remove trailing whitespaceBrian Somers2002-07-011-23/+23
| | | | Notes: svn path=/head/; revision=99207
* Fixed the bug in transparent TCP proxying with the "encode_ip_hdr"Ruslan Ermilov2001-12-181-1/+3
| | | | | | | | | option -- TcpAliasOut() did not catch the IP header length change. Submitted by: Stepachev Andrey <aka50@mail.ru> Notes: svn path=/head/; revision=88132
* cmott@scientech.com -> cm@linktel.netBrian Somers2001-11-031-1/+1
| | | | | | | Requested by: Charles Mott <cmott@scientech.com> Notes: svn path=/head/; revision=85964
* Add __FBSDID's to libaliasMatthew Dillon2001-09-301-2/+3
| | | | Notes: svn path=/head/; revision=84195
* Added TFTP support.Ruslan Ermilov2001-08-211-0/+9
| | | | | | | | Submitted by: Joe Clarke <marcus@marcuscom.com> MFC after: 2 weeks Notes: svn path=/head/; revision=82069
* Make the copyright consistent.Brian Somers2001-08-201-3/+0
| | | | | | | Previously approved by: Charles Mott <cmott@scientech.com> Notes: svn path=/head/; revision=82001
* Add BSD-style copyright headersBrian Somers2001-06-041-2/+29
| | | | | | | Approved by: Charles Mott <cmott@scientech.com> Notes: svn path=/head/; revision=77701
* Make header files conform to style(9).Brian Somers2001-03-251-13/+15
| | | | | | | | | Reviewed by (*): bde (*) alias_local.h only got a cursory glance. Notes: svn path=/head/; revision=74778
* Added boolean argument to link searching functions, indicatingRuslan Ermilov2000-10-301-17/+18
| | | | | | | whether they should create a link if lookup has failed or not. Notes: svn path=/head/; revision=67980
* A significant rewrite of PPTP aliasing code.Ruslan Ermilov2000-10-301-39/+12
| | | | | | | | | | | | | | | | | PPTP links are no longer dropped by simple (and inappropriate in this case) "inactivity timeout" procedure, only when requested through the control connection. It is now possible to have multiple PPTP servers running behind NAT. Just redirect the incoming TCP traffic to port 1723, everything else is done transparently. Problems were reported and the fix was tested by: Michael Adler <Michael.Adler@compaq.com>, David Andersen <dga@lcs.mit.edu> Notes: svn path=/head/; revision=67966