Commit Graph

68 Commits

Author SHA1 Message Date
Denis Kenzior 820b1f55c8 ppp: Refactor server-side API
The biggest update here is that the server needs to be in dormant mode
by default, so as not to send a Configure-Req to the peer until the peer
is ready.  This requires adding special constructor for LCP to
initialize it to Stopped state instead of initial state.

Along with this, we pass the server local IP directly to the ppp server
constructor.
2010-06-29 11:53:11 -05:00
Zhenhua Zhang 9f180fc27a ppp: Fix leak in pppcp_send_protocol_reject
Free the reject pppcp packet after ppp_transmit.
2010-06-21 09:19:55 -05:00
Kristen Carlson Accardi 3fff4c49c8 ppp: implement ppp_packet_new 2010-05-19 02:58:45 -05:00
Kristen Carlson Accardi 125fc62526 ppp: set address and control field
Before sending to hdlc, set the address and control field.
Fix hardcode of ppp header size.
2010-05-10 16:27:15 -05:00
Kristen Carlson Accardi 9d5eb5110f ppp: transition to dead when read io destroyed
remove call to signal_close for lcp object, it is redundent.  If
our io is destroyed we are dead, so transition the ppp phase to
DEAD so our disconnect callback can be called.
2010-04-29 14:24:47 -05:00
Denis Kenzior fa8614cc78 ppp: Make pppcp functions const correct 2010-04-28 17:27:35 -05:00
Kristen Carlson Accardi a9c0be7339 ppp: use default ACCM when sending LCP codes 1-7
According to the spec, you must transmit all Link Configuration,
Termination, and Code-Reject packets as if no options had been
negotiated.  This requires that when encoding we use the
default ACCM of 0xffffffff when sending these types of packets.
2010-04-26 15:31:17 -05:00
Kristen Carlson Accardi 9c3631f24e ppp: remove references to magic number
We will not support loopback detection.
2010-04-13 15:32:35 -05:00
Denis Kenzior 552db428ef ppp: Refactor how tls/tlu/tld/tlf are used
With the upper layer driving these, the special handling is no longer
required.
2010-04-13 14:00:01 -05:00
Denis Kenzior a661dd1583 ppp: Add pppcp_signal_down
For use when the link is abruptly terminated by the remote side
2010-04-13 12:03:32 -05:00
Marcel Holtmann f319e65b99 Use ppp_debug() for PPP CP event debug statements 2010-04-12 18:02:11 -07:00
Denis Kenzior a4921aef11 ppp: Trivial style fix
Be more explicit
2010-04-09 08:57:12 -05:00
Denis Kenzior 8f5459ffbc ppp: Stop the timer when re-starting
In case we receive NAK/REJ we should stop and re-start the timer,
otherwise we end up generating multiple Conf-Reqs
2010-04-08 19:47:58 -05:00
Denis Kenzior 06298becc1 ppp: Rip out the old option processing
Put in the new option processing
2010-04-08 16:47:05 -05:00
Denis Kenzior 9d118c4666 ppp: Make iterators work all the time 2010-04-08 16:46:45 -05:00
Denis Kenzior c5590d114e ppp: Move some one-time setters to the proto 2010-04-08 10:40:12 -05:00
Denis Kenzior 4e01f9921e ppp: Add rca callback
When the other side acks our options, then let us apply these options
locally and start using them
2010-04-07 16:41:49 -05:00
Denis Kenzior 5f361d7de9 ppp: Add pppcp option iterators 2010-04-07 16:41:49 -05:00
Denis Kenzior 892ee0a364 ppp: Move pppcp_timer_data private 2010-04-07 16:41:49 -05:00
Denis Kenzior 340013c6ef ppp: Hide away the magic_number in ppp_lcp.c 2010-04-07 16:41:40 -05:00
Denis Kenzior 5e67ee2ff5 ppp: Remove OPTION_ERR, treat errors as reject 2010-04-06 22:49:47 -05:00
Denis Kenzior 130ac43255 ppp: Move up the look up table definition 2010-04-06 22:49:47 -05:00
Denis Kenzior 8bff9b6541 Refactor: Make struct pppcp declaration private 2010-04-05 16:55:28 -05:00
Denis Kenzior 04cfa990e2 Refactor: add pppcp_set/get_magic_number 2010-04-05 16:55:07 -05:00
Denis Kenzior de83e99644 Refactor: add pppcp_set_prefix 2010-04-05 16:46:08 -05:00
Denis Kenzior 97b0aa590d Refactor: add pppcp_get_ppp 2010-04-05 16:44:00 -05:00
Denis Kenzior 7739af4a26 Refactor: add pppcp_set_option_strings 2010-04-05 16:42:17 -05:00
Denis Kenzior 7b447dd0e2 Refactor: Move valid code selection to ipcp/lcp
We already have a set_valid_codes function, let us use it
2010-04-05 16:16:14 -05:00
Denis Kenzior 4f5de3426e Refactor: Move packet_ops to a static look-up
No need to allocate space for this, as it is always the same for all
instances.
2010-04-05 16:14:39 -05:00
Denis Kenzior 48a012c810 Refactor: Make option_scan more type safe 2010-04-05 14:32:11 -05:00
Denis Kenzior 5e8a9c2941 Refactor: Make option_process more typesafe
option_process was declared with two gpointer arguments for the sole
reason of being used as a GFunc.  Casting to a GFunc or re-writing the
foreach as a loop is preferable.
2010-04-05 14:25:14 -05:00
Denis Kenzior 60d96505dc Refactor: Add pppcp_set_data & pppcp_get_data
Using these functions makes the code much cleaner than trying to pass
the priv pointer everywhere
2010-04-05 14:16:00 -05:00
Marcel Holtmann 331fcaea32 Make pppcp_code enum a private structure 2010-04-05 11:12:43 -07:00
Marcel Holtmann 12ffb2c772 Make pppcp_event_type enum a private structure 2010-04-05 11:05:08 -07:00
Denis Kenzior 64ffcf1cfa Refactor: Move to a transition state table
It is much more compact to re-implement the transition states as a table
as opposed to functions with switch/case statements.  The logic is made
much easier to follow and much of the code duplication is eliminated
2010-04-05 12:36:43 -05:00
Denis Kenzior e56710e1da Refactor: Move the state definition to ppp_cp.c 2010-04-05 10:12:39 -05:00
Kristen Carlson Accardi 9905245e79 ppp: implement Max-Failure counter
put a cap on the number of Configure-Nak packets we send.
2010-04-05 09:45:14 -05:00
Marcel Holtmann c2fb0a1630 Move PPP constants where they are used 2010-04-03 22:32:27 -07:00
Marcel Holtmann 5772ad5d8b Make GAtPPP fields really private 2010-04-03 22:25:09 -07:00
Kristen Carlson Accardi 0766a67832 ppp: fix missing breaks in switch statements 2010-04-02 13:19:14 -07:00
Marcel Holtmann 8097a1ed52 Add missing break or fall through comments to switch statements 2010-04-02 12:40:45 -07:00
Marcel Holtmann 0e8b2815a8 Always reset option_rval for every option 2010-04-02 11:43:20 -07:00
Kristen Carlson Accardi 74e1abd353 ppp: use queue to transmit
Since we are using non buffered I/O, use a queue to transmit when buffer
space is available.
2010-04-02 13:05:47 -05:00
Marcel Holtmann edba0296c5 Remove PPP CP event_queue handling and process events directly 2010-04-01 21:44:07 -07:00
Marcel Holtmann ef82241deb Implement g_at_ppp_set_debug support 2010-04-01 13:11:11 -07:00
Marcel Holtmann 4f99859d37 Remove useless pppcp_protocol_data structure 2010-04-01 09:13:44 -07:00
Marcel Holtmann eb9e7872a9 Add debugging for PPP LCP and IPCP options 2010-04-01 00:07:40 -07:00
Marcel Holtmann f87537644b Fix whitespace damage in PPP implementation 2010-03-31 10:30:54 -07:00
Kristen Carlson Accardi c31bee9fff ppp: handle Config-Reject
if our peer sends us a Config-Reject packet, we must delete that
config item and not request that it be negotiated when we send our
next Config-Request.
2010-03-26 19:19:46 -07:00
Kristen Carlson Accardi 8777e778f3 ppp: use common code to get options from pppcp packet data 2010-03-26 19:19:46 -07:00