aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/ng_pppoe.c
Commit message (Collapse)AuthorAgeFilesLines
* ng_ether: Enter NET_EPOCH where requiredKristof Provost2020-09-021-0/+8
| | | | | | | | | | | | | | | | | We must enter NET_EPOCH before calling ether_output_frame(). Several of the functions it calls (pfil_run_hooks, if_transmit) expect to be running in the NET_EPOCH. While here remove an unneeded EPOCH entry (which wasn't wide enough to cover BRIDGE_INPUT). PR: 248958 Reviewed by: glebius, bz (previous version), melifaro (previous version) Tested by: manu Differential Revision: https://reviews.freebsd.org/D26226 Notes: svn path=/head/; revision=365246
* net: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-3/+1
| | | | Notes: svn path=/head/; revision=365071
* ng_pppoe(8): add support for user-supplied Host-Uniq tag.Eugene Grosbein2018-02-141-39/+284
| | | | | | | | | | | | | | | | | | | | | A few ISP filter PADI requests based on such tag, to force the use of their own routers. The custom Host-Uniq tag is passed in the NGM_PPPOE_CONNECT control message, so it can be used with FreeBSD ppp(8) and mpd without any other change. Add support to send and receive PADM messages, HURL and MOTM, often used by service providers to provide ACS information and other configuration settings to the user CPE. Submitted by: ale Approved by: mav (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D9270 Notes: svn path=/head/; revision=329279
* sys/netgraph: spelling fixes in comments.Pedro F. Giffuni2016-04-291-2/+2
| | | | | | | No functional change. Notes: svn path=/head/; revision=298813
* Add support for PPP-Max-Payload PPPoE tag (RFC4638).Alexander Motin2015-09-111-0/+45
| | | | | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 2 weeks Notes: svn path=/head/; revision=287654
* Add constant for PPP-Max-PayLoad tag.Gleb Smirnoff2013-07-231-0/+1
| | | | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov gmail.com> Notes: svn path=/head/; revision=253564
* Mechanically substitute flags from historic mbuf allocator withGleb Smirnoff2012-12-051-10/+10
| | | | | | | | | | | | malloc(9) flags within sys. Exceptions: - sys/contrib not touched - sys/mbuf.h edited manually Notes: svn path=/head/; revision=243882
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.Ed Schouten2011-11-071-1/+1
| | | | | | | This means that their use is restricted to a single C file. Notes: svn path=/head/; revision=227293
* Node constructor methods are supposed to be called in syscallGleb Smirnoff2011-04-181-3/+1
| | | | | | | | | | context always. Convert nodes to consistently use M_WAITOK flag for memory allocation. Reviewed by: julian Notes: svn path=/head/; revision=220768
* Remove some dead and incorrect code.Alexander Motin2010-06-051-1/+1
| | | | | | | | Found with: Coverity Prevent(tm) CID: 4562 Notes: svn path=/head/; revision=208824
* Make Netgraph compile with Clang.Ed Schouten2009-03-031-11/+12
| | | | | | | | | | | | | | | | | | | Clang disallows structs with variable length arrays to be nested inside other structs, because this is in violation with ISO C99. Even though we can keep bugging the LLVM folks about this issue, we'd better just fix our code to not do this. This code seems to be the only code in the entire source tree that does this. I haven't tested this patch by using the kernel modules in question, but Diane Bruce and I have compared disassembled versions of these kernel modules. We would have expected them to be exactly the same, but due to randomness in the register allocator and reordering of instructions, there were some minor differences. Approved by: julian Notes: svn path=/head/; revision=189315
* Use more compact LIST instead of TAILQ for session hash.Alexander Motin2008-03-031-62/+32
| | | | | | | | Add all listening hooks into LIST to simplify searches. Use ng_findhook() instead of own equal implementation. Notes: svn path=/head/; revision=176775
* Make session ID generator to use session ID hash.Alexander Motin2008-03-021-40/+37
| | | | | | | Make session ID generator thread-safe. Notes: svn path=/head/; revision=176753
* Do not use bcmp() to compare two bytes with constants.Alexander Motin2008-02-061-3/+2
| | | | Notes: svn path=/head/; revision=176057
* Tune the message for better informativity.Alexander Motin2008-02-011-1/+2
| | | | | | | Print the hook pointer as other functions do. Notes: svn path=/head/; revision=175867
* Band-aid recent commit by mav by replacing a variable in a CTR statement withBenno Rice2008-02-011-1/+1
| | | | | | | | | | the variable that appears as if it should've been there. Pointy hat to: mav Not tested either by: benno Notes: svn path=/head/; revision=175866
* Implement Session-ID hashing to improve receive performance scalabilityAlexander Motin2008-01-311-31/+70
| | | | | | | for big number of concurrent sessions. Notes: svn path=/head/; revision=175865
* Add support for optional "AC-Name\Service-Name" syntax at NGM_PPPOE_CONNECTAlexander Motin2007-12-291-6/+37
| | | | | | | | | | argument. It allows ppp, mpd or any other node consumer to request connection to specified access concentrator. Proposed by: Alexander A. Burylov <burylov@mail.ru> Notes: svn path=/head/; revision=174981
* Fix incorrectly placed bracket in pppoe_find_svc().Alexander Motin2007-12-261-1/+1
| | | | Notes: svn path=/head/; revision=174931
* Split ng_pppoe_rcvdata() function into three hook-specific onesAlexander Motin2007-10-141-464/+465
| | | | | | | to simplify code and reduce stack usage. Notes: svn path=/head/; revision=172629
* Remove ng_pppoe_sendpacket() function to simplify code as it is calledAlexander Motin2007-10-141-79/+39
| | | | | | | as much times as it has cases inside of it. Notes: svn path=/head/; revision=172628
* Dead code removal.Alexander Motin2007-09-211-11/+0
| | | | | | | Approved by: re (kensmith), glebius (mentor) Notes: svn path=/head/; revision=172271
* This is optimization of ether and debug hooks determination. ItAlexander Motin2007-09-211-44/+27
| | | | | | | | | | simplifies code and should speedup pppoe_findsession() function which is called for every incoming packet. Approved by: re (kensmith), glebius (mentor) Notes: svn path=/head/; revision=172270
* This patch fixes thread unsafe usage of global pkt_hdrAlexander Motin2007-09-211-22/+20
| | | | | | | | | variable. Second part is not so important, but IMO is also good. Approved by: re (kensmith), glebius (mentor) Notes: svn path=/head/; revision=172269
* Some perfectionizm against last revision.Gleb Smirnoff2006-08-101-2/+2
| | | | | | | Submitted by: ru Notes: svn path=/head/; revision=161181
* Fix ng_pppoe(4) after turning off "autosrc feature" on ng_ether(4).Gleb Smirnoff2006-08-091-20/+72
| | | | | | | | | | | | | | | - Store the Ethernet header in node softc. - Initialize header with dst addr and ethertype in node constructor method. - In node connect method send NGM_ETHER_GET_ENADDR message downwards. - If received reply from ng_ether(4) store the src addr in softc. - Add NGM_PPPOE_SETENDADDR message that allows user to override the address with whatever he/she wants. Notes: svn path=/head/; revision=161117
* - Use log(9) instead of printf(9).Gleb Smirnoff2006-08-071-26/+44
| | | | | | | | | | | - Print node ID, where possible. - Prepend log messages with function name, or at least with "ng_pppoe". Reviewed by: julian Tested by: Joao Barros <joao.barros gmail.com> Notes: svn path=/head/; revision=161034
* o Introduce D-Link compat mode, that is default to off and can be setGleb Smirnoff2006-01-271-59/+80
| | | | | | | | | | | | | by NGM_PPPOE_SETMODE message. When D-Link compat mode is on, we will broadcast PADI with empty Service-Name to all listening hooks. o Rewrite the compatibility options. Before we had two modes - standard and non-standard (aka 3Com). Now we have standard mode and two compat flags, that can be combined. o Be consistent and do s/STUPID/3COM/g. I don't say that 3Com mode isn't stupid, just want to make code easier to read. Notes: svn path=/head/; revision=154901
* From the RFC2516 it is not clear, what is the correct behavior for aGleb Smirnoff2006-01-261-43/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PPPoE AC, servicing a specific Service-Name, when client sends a PADI with an empty Service-Name. Should it reply with all available service names or should it be silent? Our implementation had chosen the latter, while some other had chosen the former (they say Linux and Cisco). Now some PPPoE clients appear, that rely on the assumption that AC will send all names in a PADO reply to a PADI with wildcard Service-Name. These clients can't connect to FreeBSD AC. I have requested comments from authors of RFC2516 via email, but received no reply. This change makes FreeBSD AC compatible with D-Link DI-614+ and D-Link DI-624+ SOHO routers, and probably others. Big thanks to D-Link's Russian office, namely Victor Platov, for assistance and support in investigation and testing of this change. Details: o Split pppoe_match_svc() into three different functions serving different purposes: - pppoe_match_svc() - match non-empty Service-Name tag from PADI against all available hooks in listening state. - pppoe_find_svc() - check that given Service-Name is not yet registered. - pppoe_broadcast_padi() - send a copy of PADI packet with empty Service-Name tag to all listening hooks. o For NGM_PPPOE_LISTEN message use pppoe_find_svc(). o In ng_pppoe_rcvdata() in a PADI case use pppoe_match_svc() for a non-empty Service-Name tag, and pppoe_broadcast_padi() in either case. A side effect from the above changes is that now pppoed(8) and mpd will reply to a empty Service-Name PADI sending a PADO with two Service-Name tags - an empty one and correct one. This is not fatal, and will be corrected in pppoed(8) and mpd later. No need to update node interface version. Supported by: D-Link Notes: svn path=/head/; revision=154862
* - Remove debugging printfs.Gleb Smirnoff2006-01-211-240/+243
| | | | | | | | | | - Add some ktr(4) debugging. - Whitespaces at eols. - Tidy up comments. - u_intXX -> uintXX Notes: svn path=/head/; revision=154604
* Dej'a vu of revision 1.35Gleb Smirnoff2005-09-191-1/+1
| | | | | | | | PR: kern/86258 Submitted by: Hiroshi Oota <ghelp excite.co.jp> Notes: svn path=/head/; revision=150319
* Remove obsoleted sysctl interface for switching between standard and 3ComGleb Smirnoff2005-07-051-39/+1
| | | | | | | | | | | | | PPPoE modes. The interface was declared obsoleted before 5.3-RELEASE. When running as access concentrator ng_pppoe(4) supports both modes simultanously. When running as client mode can be swicthed in ppp(8) configuration. Approved by: re (scottl) Notes: svn path=/head/; revision=147778
* Remove ng_connect_t where it is unused. Probably it remained from ng_source.c.Gleb Smirnoff2005-03-141-13/+0
| | | | Notes: svn path=/head/; revision=143607
* Drop mythical module dependency on ng_ether.Ruslan Ermilov2005-02-131-2/+0
| | | | Notes: svn path=/head/; revision=141778
* /* -> /*- for license, minor formatting changesWarner Losh2005-01-071-2/+3
| | | | Notes: svn path=/head/; revision=139823
* - Use ng_callout() instead of timeout()Gleb Smirnoff2004-12-081-30/+23
| | | | | | | | | | - remove spl(9) calls Tested by: Ilya Pizik Approved by: julian (mentor) Notes: svn path=/head/; revision=138562
* Since last change moved ';' from macro to code, we need to embraceGleb Smirnoff2004-10-311-2/+2
| | | | | | | | | | | macros with 'do {} while (0)' to avoid error in case macro is not defined. Prodded by: julian, archie Pointy hat to: glebius Notes: svn path=/head/; revision=137100
* Rename debug macro to DBG and indent it properly.Gleb Smirnoff2004-10-281-23/+21
| | | | | | | | Requested by: maxim Approved by: julian (mentor) Notes: svn path=/head/; revision=137022
* Another stupid error from my side. PPPOE_NONSTANDARD was first definedGleb Smirnoff2004-08-011-9/+9
| | | | | | | | | | | in enum {}, and then redefined with #define. No warnings from compiler, though. Submitted by: bz Pointy hat to: glebius Notes: svn path=/head/; revision=132975
* When node is server serve both standard RFC2516 and non-standard 3ComGleb Smirnoff2004-07-271-42/+111
| | | | | | | | | | | | | clients simultaneously. When node is client its mode is configured with a control message. sysctl net.graph.nonstandard_pppoe is deprecated but kept for backward compatibility for some time. Approved by: julian Notes: svn path=/head/; revision=132703
* Add a note indicating that the eh_prototype field used to constructRobert Watson2004-07-141-0/+4
| | | | | | | ethernet headers is unsynchronized. Notes: svn path=/head/; revision=132164
* Having moved metadata usage to mbuf tags, remove code that supportsJulian Elischer2004-06-261-2/+2
| | | | | | | | | the old way of doing it. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru> Notes: svn path=/head/; revision=131155
* Switch to using C99 sparse initialisers for the type methods array.Julian Elischer2004-05-291-12/+10
| | | | | | | | | | | Should make no binary difference. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru> Reviewed by: Harti Brandt <harti@freebsd.org> MFC after: 1 week Notes: svn path=/head/; revision=129823
* Get rid of the deprecated *LEN constants in favour of the newHartmut Brandt2004-01-261-2/+2
| | | | | | | *SIZ constants that include the trailing \0 byte. Notes: svn path=/head/; revision=125028
* The default value of net.graph.nonstandard_pppoe is changed to -1,Yaroslav Tykhiy2003-12-191-2/+2
| | | | | | | | | | | | | | | | | | | which means "always stay in the standard mode of PPPoE operation regardless of any junk floating around." As the referenced PR stated clearly, the old default setting of 0 was extremely dangerous because it opened a possibility for a spurious frame not only to put down a single PPPoE node running FreeBSD, but to plague *every* FreeBSD node in a PPPoE network in such a way that those nodes would keep poisoning each other until rebooted simultaneously. PR: kern/47920 Reviewed by: Gleb Smirnoff <glebius <at> cell.sick.ru> MFC after: 1 week Notes: svn path=/head/; revision=123671
* Fixed compilation on 64-bit platforms.Ruslan Ermilov2003-12-191-2/+2
| | | | Notes: svn path=/head/; revision=123658
* There are two modes of ng_pppoe operation, standard andYaroslav Tykhiy2003-12-181-11/+38
| | | | | | | | | | | | | | | | | | | | | | nonstandard. They differ in the values of certain fields in the PPPoE frame. Previously, ng_pppoe would start in standard mode, yet switch to nonstandard one upon reception of a single nonstandard frame. After having done so, ng_pppoe would be unable to interact with standard PPPoE peers. Thus, a DoS condition existed that could be triggered by a buggy peer or malicious party. Since few people have expressed their displeasure WRT this problem, the default operation of ng_pppoe is left untouched for now. However, a new value for the sysctl net.graph.nonstandard_pppoe is introduced, -1, which will force ng_pppoe stay in standard mode regardless of any bogus frames floating around. PR: kern/47920 Submitted by: Gleb Smirnoff <glebius <at> cell.sick.ru> MFC after: 1 week Notes: svn path=/head/; revision=123640
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-9/+9
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-9/+9
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Use %z to print a size_t value.John Baldwin2002-11-081-1/+1
| | | | Notes: svn path=/head/; revision=106624