Commit Graph

55 Commits

Author SHA1 Message Date
Sergei Golubtsov c8ed7162d5 ppp: using RX ACCM = 0 by default
Some modems such as Quectel EC200T do not honor the default value for
the Async-Control-Character-Map (ACCM) configuration option defined in
RFC 1548 6.2 as 0xffffffff. This patch suggests to use RX ACCM = 0 for
Ofono by default as pppd does for instance. This will reduce PPP data
overhead as well.
2021-01-07 23:17:45 -06:00
Giacinto Cifelli 6fc119d9ea gatchat: support for auth NONE
Added authentication method G_AT_PPP_AUTH_METHOD_NONE and its handling.
2018-10-03 11:44:03 -05:00
Philip Paeps a88662d23c gatchat: implement PAP authentication
Make the authentication method configurable, CHAP or PAP, defaulting to
CHAP (i.e.: previous behaviour).

Implementation details:

 o If PAP is configured, we NAK the CHAP authentication protocol option
   in LCP configuration requests and suggest PAP instead.  This works
   around the amusing requirement of 3GPP TS 29.061 that modems must
   send a forced positive acknowledgement of the authentication method
   tried (i.e.: the modem will successfully accept any CHAP handshake,
   but if the network only supports PAP, the modem will hang up
   when it tries and fails to activate the PDP context)

 o The PAP Authenticate-Request is resent a hard-coded three times at
   ten-second intervals.  This may be a bit too persistent.  Chances
   are if it doesn't work the first time, it'll never work, but the
   RFC insists that we MUST retry.
2014-06-21 11:50:34 -05:00
Marcel Holtmann 21f9da9916 gatchat: Update copyright information 2011-10-10 13:39:25 -07:00
Denis Kenzior 078d621033 ppp: Don't regenerate options when unchanged 2011-06-29 04:03:25 -05:00
Guillaume Zajac fed838f79f GAtPPP: Add PFC option support 2011-06-29 00:33:42 -05:00
Guillaume Zajac 84ccc874da GAtPPP: Add ACFC option support 2011-06-29 00:22:25 -05:00
Denis Kenzior 57f32ff899 ppp: Remove some g_prints 2011-02-28 16:13:56 -06:00
Martin Xu 694589f51d PPP: Use default ACCM (0xffffffff) to trasmit
Using my Huawei EM770W modem, if set ACCM as 0x00000000, RXJ-
event breaks PPP link, after IP package transmit for a while.
Using default ACCM, the issue can be fixed.
I tested it at China Unicom networks.
2011-02-16 12:01:39 -06:00
Martin Xu ad16e81aff PPP: Fix transmit ACCM and receive ACCM mixup
According to RFC1662 Section 7.1, ACCM Configuration Option is
used to inform the peer which control characters MUST remain
mapped when the peer sends them.
2011-02-14 14:22:32 -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
Denis Kenzior 9ae0dcb47d ppp: get rid of ppp_enter_phase
This function simply didn't have the context of why the phase was being
entered.  Instead have each protocol notify GAtPPP as to what is
happening.  We already had this more or less for IPCP and AUTH events,
this just now formalizes it for LCP as well.
2010-04-30 14:37:17 -05:00
Denis Kenzior fde23f113a ppp: Request MRU if we ever get NAKed with it
Huawei E160G hardware seems to NAK our configure request and suggest
that it will never send packets bigger than 1440 bytes.  Since we don't
particularly care (our receive ring buffer is 4K, so it can handle 2048
byte packets), we just re-send the Configure Request with the preferred
value.
2010-04-22 15:08:05 -05:00
Denis Kenzior 07280e1bff ppp: Fix trivial copy paste error 2010-04-22 15:07:42 -05:00
Kristen Carlson Accardi 71775550fe ppp: implement MRU option
If the peer requests a MRU option, set the mtu for the network
phase.  When we are in link establishment phase, we should
continue to behave as if no option has been set and the peer
should use the default MRU.

This option is required for the Huawei E160G modem.
2010-04-22 07:00:40 +02:00
Kristen Carlson Accardi 60643ee287 ppp: nak unknown auth protocol
If we are sent a Config-Request for an auth proto other than
CHAP with MD5, send a NAK.
2010-04-14 17:16:03 -05:00
Kristen Carlson Accardi b74a9342d2 ppp: remove pfc and acfc
We will not support pfc or acfc
2010-04-13 15:32:35 -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 fed99b9265 ppp: Transition the phase directly
Use of the generate event function, while more 'pure' with regard to how
the spec views transitions, actually makes code more difficult to read.

Instead use phase transitions directly inside gatppp.  This still bleeds
through a little into lcp code, and probably should be fixed in a better
way eventually.
2010-04-13 14:21:12 -05:00
Denis Kenzior 9116b7e8f8 ppp: Let the upper layer handle open / up events
This removes the need for the layer_started functions in lcp and ipcp.
For LCP the link is always up unless the socket has been closed, and for
IPCP the link should be opened as soon as LCP is ready anyway.
2010-04-13 13:58:12 -05:00
Denis Kenzior 87939c2fcf Merge: make link 2010-04-13 13:57:03 -05:00
Denis Kenzior dbbaa3c416 ppp: Reset the options whenever the layer is down
So we can re-negotiate the options if the layer is opened again.
2010-04-13 13:34:12 -05:00
Denis Kenzior f5270cc9bd ppp: Use pppcp_signal functions directly
No real need to wrap them behind lcp_ functions
2010-04-13 12:03:32 -05:00
Denis Kenzior c26447d922 ppp: Use flags instead of booleans for lcp options 2010-04-09 08:44:29 -05:00
Denis Kenzior cad3223a94 ppp: Rip out the now unused option string stuff
Using wireshark is much easier
2010-04-08 16:47:05 -05:00
Denis Kenzior 4f31b6c3b2 ppp: Port LCP to the new option framework 2010-04-08 16:47:05 -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 4a6a381a1d ppp: Remove lcp_protocol_reject
Use pppcp_send_reject_protocol
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 e0c8704705 ppp: Verify magic number is not zero 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 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
Marcel Holtmann 9d8e55d489 Fix coding style with callback structures 2010-04-02 19:01:38 -07:00
Denis Kenzior ebc6e3b9dc Refactor: Get rid of (now) pointless comments 2010-04-02 19:03:56 -05:00
Denis Kenzior 2c466c8baf Refactor: Get rid of packet handler registrations
There are only about 4 protocols that the current ppp code handles and
it is doubtful that it will grow much more.  There's no point in having
an extensive packet handler registration framework.
2010-04-02 15:11:48 -05:00
Marcel Holtmann 76200165bb Add more missing break statements 2010-04-02 13:33:35 -07:00
Kristen Carlson Accardi c2a589e732 ppp: fix event generation on close
Prevents too early transition to PPP_DEAD
2010-04-02 12:53:45 -05:00
Marcel Holtmann 4f99859d37 Remove useless pppcp_protocol_data structure 2010-04-01 09:13:44 -07:00