History log of /freebsd-10.1-release/sys/netgraph/ng_pppoe.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 253564 23-Jul-2013 glebius

Add constant for PPP-Max-PayLoad tag.

Submitted by: Dmitry Luhtionov <dmitryluhtionov gmail.com>


# 243882 05-Dec-2012 glebius

Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags within sys.

Exceptions:

- sys/contrib not touched
- sys/mbuf.h edited manually


# 227293 07-Nov-2011 ed

Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.

This means that their use is restricted to a single C file.


# 220768 18-Apr-2011 glebius

Node constructor methods are supposed to be called in syscall
context always. Convert nodes to consistently use M_WAITOK flag
for memory allocation.

Reviewed by: julian


# 208824 05-Jun-2010 mav

Remove some dead and incorrect code.

Found with: Coverity Prevent(tm)
CID: 4562


# 189315 03-Mar-2009 ed

Make Netgraph compile with Clang.

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


# 176775 03-Mar-2008 mav

Use more compact LIST instead of TAILQ for session hash.
Add all listening hooks into LIST to simplify searches.
Use ng_findhook() instead of own equal implementation.


# 176753 02-Mar-2008 mav

Make session ID generator to use session ID hash.
Make session ID generator thread-safe.


# 176057 06-Feb-2008 mav

Do not use bcmp() to compare two bytes with constants.


# 175867 01-Feb-2008 mav

Tune the message for better informativity.
Print the hook pointer as other functions do.


# 175866 01-Feb-2008 benno

Band-aid recent commit by mav by replacing a variable in a CTR statement with
the variable that appears as if it should've been there.

Pointy hat to: mav
Not tested either by: benno


# 175865 31-Jan-2008 mav

Implement Session-ID hashing to improve receive performance scalability
for big number of concurrent sessions.


# 174981 29-Dec-2007 mav

Add support for optional "AC-Name\Service-Name" syntax at NGM_PPPOE_CONNECT
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>


# 174931 26-Dec-2007 mav

Fix incorrectly placed bracket in pppoe_find_svc().


# 172629 14-Oct-2007 mav

Split ng_pppoe_rcvdata() function into three hook-specific ones
to simplify code and reduce stack usage.


# 172628 14-Oct-2007 mav

Remove ng_pppoe_sendpacket() function to simplify code as it is called
as much times as it has cases inside of it.


# 172271 21-Sep-2007 mav

Dead code removal.

Approved by: re (kensmith), glebius (mentor)


# 172270 21-Sep-2007 mav

This is optimization of ether and debug hooks determination. It
simplifies code and should speedup pppoe_findsession() function which is
called for every incoming packet.

Approved by: re (kensmith), glebius (mentor)


# 172269 21-Sep-2007 mav

This patch fixes thread unsafe usage of global pkt_hdr
variable. Second part is not so important, but IMO is also good.

Approved by: re (kensmith), glebius (mentor)


# 161181 10-Aug-2006 glebius

Some perfectionizm against last revision.

Submitted by: ru


# 161117 09-Aug-2006 glebius

Fix ng_pppoe(4) after turning off "autosrc feature" on ng_ether(4).

- 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.


# 161034 07-Aug-2006 glebius

- Use log(9) instead of printf(9).
- 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>


# 154901 27-Jan-2006 glebius

o Introduce D-Link compat mode, that is default to off and can be set
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.


# 154862 26-Jan-2006 glebius

From the RFC2516 it is not clear, what is the correct behavior for a
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


# 154604 21-Jan-2006 glebius

- Remove debugging printfs.
- Add some ktr(4) debugging.
- Whitespaces at eols.
- Tidy up comments.
- u_intXX -> uintXX


# 150319 19-Sep-2005 glebius

Dej'a vu of revision 1.35

PR: kern/86258
Submitted by: Hiroshi Oota <ghelp excite.co.jp>


# 147778 05-Jul-2005 glebius

Remove obsoleted sysctl interface for switching between standard and 3Com
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)


# 143607 14-Mar-2005 glebius

Remove ng_connect_t where it is unused. Probably it remained from ng_source.c.


# 141778 12-Feb-2005 ru

Drop mythical module dependency on ng_ether.


# 139823 06-Jan-2005 imp

/* -> /*- for license, minor formatting changes


# 138562 08-Dec-2004 glebius

- Use ng_callout() instead of timeout()
- remove spl(9) calls

Tested by: Ilya Pizik
Approved by: julian (mentor)


# 137100 31-Oct-2004 glebius

Since last change moved ';' from macro to code, we need to embrace
macros with 'do {} while (0)' to avoid error in case macro is
not defined.

Prodded by: julian, archie
Pointy hat to: glebius


# 137022 28-Oct-2004 glebius

Rename debug macro to DBG and indent it properly.

Requested by: maxim
Approved by: julian (mentor)


# 132975 01-Aug-2004 glebius

Another stupid error from my side. PPPOE_NONSTANDARD was first defined
in enum {}, and then redefined with #define.
No warnings from compiler, though.

Submitted by: bz
Pointy hat to: glebius


# 132703 27-Jul-2004 glebius

When node is server serve both standard RFC2516 and non-standard 3Com
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


# 132164 14-Jul-2004 rwatson

Add a note indicating that the eh_prototype field used to construct
ethernet headers is unsynchronized.


# 131155 26-Jun-2004 julian

Having moved metadata usage to mbuf tags, remove code that supports
the old way of doing it.

Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>


# 129823 28-May-2004 julian

Switch to using C99 sparse initialisers for the type methods array.
Should make no binary difference.

Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
Reviewed by: Harti Brandt <harti@freebsd.org>
MFC after: 1 week


# 125028 26-Jan-2004 harti

Get rid of the deprecated *LEN constants in favour of the new
*SIZ constants that include the trailing \0 byte.


# 123671 19-Dec-2003 yar

The default value of net.graph.nonstandard_pppoe is changed to -1,
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


# 123658 19-Dec-2003 ru

Fixed compilation on 64-bit platforms.


# 123640 18-Dec-2003 yar

There are two modes of ng_pppoe operation, standard and
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


# 111119 19-Feb-2003 imp

Back out M_* changes, per decision of the TRB.

Approved by: trb


# 109623 21-Jan-2003 alfred

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


# 106624 08-Nov-2002 jhb

Use %z to print a size_t value.


# 103870 23-Sep-2002 alfred

use __packed.


# 102244 21-Aug-2002 archie

Don't use "NULL" when "0" is really meant.


# 98636 22-Jun-2002 brian

NUL terminate the ACNAME passed to userland.


# 97897 05-Jun-2002 archie

Const'ify variables to make it clear we're not writing to the mbuf data.

Reviewed by: julian, brian
MFC after: 1 week


# 97685 31-May-2002 archie

Fix GCC warnings caused by initializing a zero length array. In the process,
simply things a bit by getting rid of 'struct ng_parse_struct_info' which
was useless because it only contained one field.

MFC after: 2 weeks


# 96578 14-May-2002 brian

Add a NGM_PPPOE_SESSIONID message to the ng_pppoe node.
This message is sent to the control socket when the SessionID
is established.

Approved by: archie (after a very cursory glance)


# 90973 20-Feb-2002 brian

Send a NGM_PPPOE_ACNAME message to userland when a node is connected.

Submitted by: Andre Albsmeier <andre@albsmeier.net>
Shuffled about by: brian
Approved by: julian


# 87599 10-Dec-2001 obrien

Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.


# 82933 04-Sep-2001 julian

MFS: change name of sysctl to something more diplomatic.


# 81032 02-Aug-2001 brian

Pack struct uniqtag declarations to stop our data field from being pushed
4 bytes to the right on the alpha.

Tested by: Thomas Pornin <Thomas.Pornin@ens.fr>
MFC after: 1 week


# 80311 25-Jul-2001 brian

If an attempt is made to LISTEN for a service tag that's already being
LISTENed for, return EEXISTS.

Only match the magic "*" service tag if no other LISTEN service tags
match.

Require an explicit LISTEN for an empty service tag in order to match
empty service requests.

Approved by: julian
MFC after: 3 days


# 72946 23-Feb-2001 julian

Shuffle sysctls a bit (thankyou whoever made them dynamic for modules)
and add a sysctl to pppoe to activate non standard ethertypes
so that idiot ISPs (apparently in France) who use
equipment from idiot suppliers (rumour says 3com)
who use nonstandard ethertypes can still connect.

"yep, sure we do pppoe, we use a different identifier to that dictated in
the standard, but sure it's pppoe!"

sysctl -w net.graph.stupid_isp=1 enables the changeover.


# 71849 30-Jan-2001 julian

Implement direct support for semipersistant nodes.
(e.g. ethernet nodes are persistent until you rip out the hardware)
Use this support in the ethernet and sample nodes.
Add some more abstraction on the 'item's so that node and
hook reference counting can be checked easier.
Slight man page correction.
Make pppoe type dependent on ethernet type.
Clean up node shutdown a little.
Move a mutex from MTX_SPIN to MTX_DEF (oops)
Fix small ref-counting bug.
remove warning on one2many type.


# 70935 11-Jan-2001 julian

Add an exported function ng_rmhook_self() that removes a hook
from a node, but does it via the locking queue, thus ensuring that the
node is locked when it's hook is removed.

Add 'deadnode' and 'deadhook' structures for when a node or hook is
invalidated but not yet freed. (not yet freed)


# 70931 11-Jan-2001 julian

Fix uninitialised pointer.

Found by: Brian Sommers


# 70914 10-Jan-2001 julian

Only free items that are not already free or passed to other nodes.
Clever work by: Brian Sommers (Brian@freeBSD.org)


# 70870 10-Jan-2001 julian

Fix some memory leaks
Add memory leak detection assitance.


# 70784 08-Jan-2001 julian

Part 2 of the netgraph rewrite.
This is mostly cosmetic changes, (though I caught a bug or two while
makeing them)
Reviewed by: archie@freebsd.org


# 70700 05-Jan-2001 julian

Rewrite of netgraph to start getting ready for SMP.
This version is functional and is aproaching solid..
notice I said APROACHING. There are many node types I cannot test
I have tested: echo hole ppp socket vjc iface tee bpf async tty
The rest compile and "Look" right. More changes to follow.
DEBUGGING is enabled in this code to help if people have problems.


# 70159 18-Dec-2000 julian

Divorce the kernel binary ABI version number from the message
format version number. (userland programs should not need to be
recompiled when the netgraph kernel internal ABI is changed.

Also fix modules that don;t handle the fact that a caller may not supply
a return message pointer. (benign at the moment because the calling code
checks, but that will change)


# 70148 18-Dec-2000 julian

Impossible to see typo.. |= instead of !=


# 69922 12-Dec-2000 julian

Reviewed by: Archie@freebsd.org
This clears out my outstanding netgraph changes.
There is a netgraph change of design in the offing and this is to some
extent a superset of soem of the new functionality and some of the old
functionality that may be removed.

This code works as before, but allows some new features that I want to
work with and evaluate. It is the basis for a version of netgraph
with integral locking for SMP use.

This is running on my test machine with no new problems :-)


# 68876 18-Nov-2000 dwmalone

Add the use of M_ZERO to netgraph.

Submitted by: josh@zipperup.org
Submitted by: Robert Drehmel <robd@gmx.net>
Submitted by: archie
Approved by: archie


# 68845 16-Nov-2000 brian

Go back to using data_len in struct ngpppoe_init_data after discussions
with Julian and Archie.

Implement a new ``sizedstring'' parse type for dealing with field pairs
consisting of a uint16_t followed by a data field of that size, and use
this to deal with the data_len and data fields.

Written by: Archie with some input by me
Agreed in principle by: julian


# 68079 31-Oct-2000 julian

Swap the order of two tags in the pppoe PADI and PADS packets
as there are apparently some buggy switches that need them in that order.
(I hope there aren't any that require them in the old order!)


# 68031 31-Oct-2000 brian

Change the format of ngpppoe_init_data so that the provider is NUL
terminated and the data_len field is no longer necessary.

Add ASCII2BINARY and BINARY2ASCII capabilities.

The old format is still understood and dealt with, but can't do
the ASCII2BINARY and BINARY2ASCII stuff.

Approved by: archie


# 67506 24-Oct-2000 julian

Since neither archie nor I work at Whistle any more, change our email
addresses to be the more usefu @freebsd.org ones
so we can keep getting bug-reports.
- man pages to follow..


# 66182 21-Sep-2000 archie

Allocate all memory (including within node constructors) with M_NOWAIT
instead of M_WAITOK, to allow for maximum flexibility.


# 66052 19-Sep-2000 archie

Rename "struct session" to "struct sess_con" to avoid conflict with
upcoming "struct session" in proc.h.

Requested by: jasone


# 64502 10-Aug-2000 archie

RFC 1661 requires that all LCP packets are sent with no address and
control field compression. The ng_ppp(4) node correctly follows this
rule. However, PPPoE is an exception: when doing PPPoE *all* frames
are sent with address and control field compression.

Alter this node's behavior so that when an outgoing frame is received,
any leading address and control field bytes are removed. This makes
this node compatible with ng_ppp(4).


# 63138 14-Jul-2000 asmodai

Fix typo, teh -> the.


# 59728 28-Apr-2000 julian

Two simple changes to the kernel internal API for netgraph modules,
to support future work in flow-control and 'packet reject/replace'
processing modes.

reviewed by: phk, archie


# 54249 07-Dec-1999 julian

Remove a bunch of un-needed includes.
Submitted by: phk@freebsd.org


# 53979 01-Dec-1999 julian

change intial timeout for session negotiation from 1 to 2 seconds.
One second was being hit too many times in normal situations.


# 53913 30-Nov-1999 archie

Add two new generic control messages, NGM_ASCII2BINARY and
NGM_BINARY2ASCII, which convert control messages to ASCII and back.
This allows control messages to be sent and received in ASCII form
using ngctl(8), which makes ngctl a lot more useful.

This also allows all the type-specific debugging code in libnetgraph
to go away -- instead, we just ask the node itself to do the ASCII
translation for us.

Currently, all generic control messages are supported, as well as
messages associated with the following node types: async, cisco,
ksocket, and ppp.

See /usr/share/examples/netgraph/ngctl for an example of using this.

Also give ngctl(8) the ability to print out incoming data and
control messages at any time. Eventually nghook(8) may be subsumed.

Several other misc. bug fixes.

Reviewed by: julian


# 53498 21-Nov-1999 julian

Fixes from brian. With some changes from me.
Allows FreeBSD to run as a PPPOE server
One patch still not included.


# 53405 19-Nov-1999 archie

Move misplaced #define.


# 53172 15-Nov-1999 julian

Small fixes from Brian for the Server side of PPPoE.


# 53154 14-Nov-1999 julian

Rework some tag handling, prompted by Brian Somers.


# 53145 14-Nov-1999 julian

Try handle missing packet tags better.
Inspired by changes suggested by brian Somers.


# 53042 08-Nov-1999 julian

Remove a null pointer reference

Submitted by: Brian Somers (brian@freebsd.org)


# 52752 01-Nov-1999 julian

Add typedefs for node methods
Suggested by phk.


# 52614 29-Oct-1999 julian

When the session is running, don't include the ethernet header in the length of the payload.


# 52564 27-Oct-1999 julian

fix typo


# 52563 27-Oct-1999 julian

The node goes away when last session disconnects or when disconnected from
the ethernet node.


# 52562 27-Oct-1999 julian

change PPPoE occurences to pppoe. Not JUST a cosmeting change.
some occurrances needed to be the same as the filenmnae which was pppoe
not PPPoE.


# 52539 26-Oct-1999 julian

cleanups regarding misused m_pullup() and similar.


# 52524 26-Oct-1999 julian

Send the negotiated session ID on our packets (DUH!).


# 52523 26-Oct-1999 julian

Send a PADT message to the peer when a session is closed down.


# 52522 26-Oct-1999 julian

This one actually gets session data to the waiting ppp daemon
(well, my test program at least).


# 52510 26-Oct-1999 julian

This one actually negotiated it's way into a session.
still tuning to be done.


# 52448 23-Oct-1999 julian

more fixes, braino's, typo's, etc.


# 52443 23-Oct-1999 julian

A version of the pppoe code ellicits a response from the ISP end
(but still not quite right)


# 52441 23-Oct-1999 julian

Now that Netgraph is in the system there are some cleanups we can do.
Also save a slightly closer to completion version of the PPPOE code.

Submitted by: Archie Cobbs <archie@freebsd.org>


# 52419 21-Oct-1999 julian

Whistle's Netgraph link-layer (sometimes more) networking infrastructure.
Been in production for 3 years now. Gives Instant Frame relay to if_sr
and if_ar drivers, and PPPOE support soon. See:
ftp://ftp.whistle.com/pub/archie/netgraph/index.html
for on-line manual pages.

Reviewed by: Doug Rabson (dfr@freebsd.org)
Obtained from: Whistle CVS tree