Commit Graph

106 Commits

Author SHA1 Message Date
Denis Kenzior d271216112 ppp: Don't crash if the interface wasn't created 2010-04-28 17:27:36 -05:00
Denis Kenzior ed15727b98 ppp: Add getter for HDLC object 2010-04-28 17:27:36 -05:00
Denis Kenzior 4cdf49f0de ppp: Initial port of PPP to use GAtHDLC 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 fce78feb54 ppp: discard non-LCP packets in ESTABLISHMENT phase 2010-04-26 12:38:31 -05:00
Kristen Carlson Accardi e98fb9a6bd ppp: change MTU on TUN device when MRU option received 2010-04-22 17:56:31 -05:00
Denis Kenzior 226865272c ppp: Shut off IPCP when entering TERMINATING phase 2010-04-22 15:05:18 -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
Denis Kenzior c8aa645973 ppp: Refing the channel is actually not necessary
The read_watch and write_watches both take a ref
2010-04-13 15:57:07 -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
Denis Kenzior 0aaf98a354 ppp: Get rid of net_open and net_close
There really isn't a need for these now
2010-04-13 15:14:40 -05:00
Denis Kenzior 1d939052fc ppp: Introduce ppp_net_down_notify 2010-04-13 14:59:13 -05:00
Denis Kenzior d1d73a75fc ppp: Introduce ppp_net_up_notify and use it
This is slightly cleaner way than defining a weird callback function.
2010-04-13 14:55:10 -05:00
Denis Kenzior 6525826455 ppp: Hide ppp_net definition in ppp_net.c 2010-04-13 14:42:59 -05:00
Denis Kenzior 71ddfca269 ppp: Use chap functions directly, instead of auth 2010-04-13 14:21:16 -05:00
Denis Kenzior 42f6e8ec6e ppp: introduce ppp_auth_notify
This function will be notified whenever authentication has succeeded /
failed.  This can happen in the authentication phase or during the
network phase.  If auth fails, then we should proceed to the terminate
phase.
2010-04-13 14:21:16 -05:00
Denis Kenzior e21bb72df0 ppp: Add set / get password & username
Also refactor the set credentials function, we will be removing the auth
object shortly
2010-04-13 14:21:16 -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 843db6f9a5 ppp: unref should mean a hard shutdown
This can happen when e.g. the modem is physically removed from the
system and it is not feasible to wait for the nice shutdown state to be
reached.
2010-04-13 12:03:32 -05:00
Denis Kenzior b916f189f5 ppp: Signal Down & Close when socket is closed 2010-04-13 12:03:32 -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 36d15b4366 ppp: Keep track when read watcher dies 2010-04-13 12:03:32 -05:00
Denis Kenzior 79d81af431 ppp: Remove unused define 2010-04-13 12:03:32 -05:00
Marcel Holtmann 143d6db7c3 Remove useless debug in PPP transmit destroy callback 2010-04-12 17:53:29 -07:00
Marcel Holtmann 0e178517ce Fix file descriptor leakage when closing PPP recording 2010-04-12 17:34:24 -07:00
Marcel Holtmann df9723db02 Move CRC-CCITT table and helper into separate file 2010-04-09 17:08:30 +02:00
Denis Kenzior b803ea8616 ppp: Fix make some functions const correct 2010-04-08 16:47:04 -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 1149210e16 ppp: Use auth->proto, not ppp->proto
Otherwise we move on to NCP stage prematurely
2010-04-06 23:11:26 -05:00
Denis Kenzior 97ff3d56f4 Fix: Allow setting of tx ACCM
Specification is explicit that ACCM defaults to ~0
2010-04-06 22:49:47 -05:00
Denis Kenzior f6d23e153e ppp: Implement receive ACCM 2010-04-06 22:49:44 -05:00
Marcel Holtmann 12ffb2c772 Make pppcp_event_type enum a private structure 2010-04-05 11:05:08 -07: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
Marcel Holtmann 4733ddaffa Move frame NULL checks into the unstuffing function 2010-04-02 19:06:31 -07:00
Marcel Holtmann ffa99a1ebb Also the default case should have a break statement 2010-04-02 13:48:44 -07: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 3c39543cd6 Fix tabs vs. whitespace coding style violation 2010-04-02 13:34:10 -07:00
Marcel Holtmann 76200165bb Add more missing break statements 2010-04-02 13:33:35 -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
Denis Kenzior 1ed6966cb4 Split out ipcp protocol into ppp_ipcp.c 2010-04-02 12:53:45 -05: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 a845dc8da7 Remove obfuscation for some of the event handling 2010-04-01 20:40:39 -07:00
Marcel Holtmann 6607b5985e Move functions from ppp.c into gatppp.c 2010-04-01 20:33:03 -07:00
Marcel Holtmann 7d6649680f Remove PPP event_queue handling and process events directly 2010-04-01 20:26:24 -07:00
Marcel Holtmann dabac98cb4 Remove PPP recv_queue handling and process frames directly 2010-04-01 20:11:43 -07:00
Marcel Holtmann 544c02da49 Add support for recording PPP sessions in pppdump format 2010-04-01 13:47:25 -07:00
Marcel Holtmann ef82241deb Implement g_at_ppp_set_debug support 2010-04-01 13:11:11 -07:00
Denis Kenzior cc1bb46ffa Refactor: Use GAtDisconnectFunc for ppp disconnect
The ppp argument to the current disconnect callback is useless as the
ppp structure is most likely stored in user data anyway.
2010-03-31 18:47:30 -05:00
Denis Kenzior d6093b819f Refactor: GAtPPP connect callback
The connect callback was not giving enough information and the
information it was providing was not in a convenient form.

- Provide the ppp interface name (e.g. tun0)
- Provide ip, dns1 & dns2 as strings
- Do not send the ppp structure in the callback, it is most likely
  present in the user data anyway
2010-03-31 18:45:17 -05:00
Kristen Carlson Accardi f720a27a1f separate memory cleanup from PPP shutdown
don't free memory at PPP shutdown, because we need to be able to
send terminate traffic.  Free memory when we have reached the
PPP_DEAD phase instead.
2010-03-25 06:50:10 -07:00
Kristen Carlson Accardi a84fc350b4 IP support for PPP
Adds IPCP support, and creates a TUN interface for sending/receiving IP
packets.
2010-03-22 17:28:23 -07:00
Kristen Carlson Accardi 6cb22fe096 CHAP with MD5 authentication support
Authentication support with CHAP and MD5
2010-03-22 17:28:23 -07:00
Kristen Carlson Accardi cd5ddc2bee PPP LCP support
Implement LCP support for the PPP protocol.
2010-03-22 17:28:23 -07:00
Kristen Carlson Accardi d38443482f Basic PPP protocol support
This patch implements the basic PPP protocol.  LCP, NCP etc. are handled in
a different patch.
2010-03-22 17:28:23 -07:00