Commit Graph

75 Commits

Author SHA1 Message Date
Marcel Holtmann 21f9da9916 gatchat: Update copyright information 2011-10-10 13:39:25 -07:00
Denis Kenzior 2eb4611de8 ppp: Add basic length sanity checks 2011-06-29 05:00:56 -05:00
Caiwen Zhang 37d04bee15 gatppp: fix ppp protocol-reject constructing error
In PPP Protocol-Reject package the 'rejected data field' should be a copy
of the rejected package, the copy starts from the data field. besides,
Protocol-Reject package include a 'rejected protocol field', it is the
same as the protocol field of the rejected package.

Protocol-Reject package structure is:

	| PPP_header | rejected protocol | rejected data

The rejected package structure is:
	| Addr | Control | protocol | data

So the Protocol-Reject package data field is copied from the 3rd byte of
the rejected package.
2011-05-11 13:29:30 -05:00
Martin Xu 0dc3d69c54 gatppp: Fix crash related to not stopping timers
In case of offline modem when GPRS data connection is connected, if gprs
atom is removed before PPP termination process is complete, the terminate_timer
will not be stop. It will cause ofonod crash when the timer times out.
2011-04-26 14:47:11 -05:00
Denis Kenzior 75730bbaac ppp_cp: Replace some left over g_prints with DBG 2011-02-28 16:13:56 -06:00
Lucas De Marchi 521071a785 gatchat: explicitly compare pointers to NULL
This patch was generated by the following semantic patch
(http://coccinelle.lip6.fr/)

// <smpl>
@fix disable is_null,isnt_null1@
expression *E;
@@

- !E
+ E == NULL
// </smpl>
2010-11-29 12:05:29 -06:00
Zhenhua Zhang a72e092d19 ppp: Add MAX_IPCP_FAILURE to avoid timeout quickly
We use IPCP NAK response to stall the progress of acquiring the client
IP address from DHCP server. So we need to increase the max failure of
NAKs in IPCP handshaking.
2010-07-09 09:53:24 -03:00
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