summaryrefslogtreecommitdiffstats
path: root/gatchat/ppp_net.c
diff options
context:
space:
mode:
authorKristen Carlson Accardi <kristen@linux.intel.com>2010-04-21 15:26:30 -0700
committerMarcel Holtmann <marcel@holtmann.org>2010-04-22 07:00:40 +0200
commit71775550fe412f1c300cae093fc5a85ac5afdba9 (patch)
tree7899bc7b9fcef9fbaba8d615d0928c042fdd7bfb /gatchat/ppp_net.c
parente1daf206518c049927585d718f59e9a74c4a66c8 (diff)
downloadofono-71775550fe412f1c300cae093fc5a85ac5afdba9.tar.bz2
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.
Diffstat (limited to 'gatchat/ppp_net.c')
-rw-r--r--gatchat/ppp_net.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
index 325e859d..c1f2eb4c 100644
--- a/gatchat/ppp_net.c
+++ b/gatchat/ppp_net.c
@@ -38,7 +38,6 @@
#include "gatppp.h"
#include "ppp.h"
-/* XXX should be maximum IP Packet size */
#define MAX_PACKET 1500
struct ppp_net {
@@ -46,8 +45,17 @@ struct ppp_net {
char *if_name;
GIOChannel *channel;
gint watch;
+ gint mtu;
};
+void ppp_net_set_mtu(struct ppp_net *net, guint16 mtu)
+{
+ if (net == NULL)
+ return;
+
+ net->mtu = mtu;
+}
+
void ppp_net_process_packet(struct ppp_net *net, guint8 *packet)
{
GError *error = NULL;
@@ -80,7 +88,7 @@ static gboolean ppp_net_callback(GIOChannel *channel, GIOCondition cond,
if (cond & G_IO_IN) {
/* leave space to add PPP protocol field */
- status = g_io_channel_read_chars(channel, buf + 2, MAX_PACKET,
+ status = g_io_channel_read_chars(channel, buf + 2, net->mtu,
&bytes_read, &error);
if (bytes_read > 0) {
ppp->proto = htons(PPP_IP_PROTO);
@@ -140,6 +148,7 @@ struct ppp_net *ppp_net_new(GAtPPP *ppp)
ppp_net_callback, net);
net->ppp = ppp;
+ net->mtu = MAX_PACKET;
return net;
error: