From bc64df2d2abde6b4045231f6db31bc7976bd7772 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 29 Jun 2011 03:46:54 -0500 Subject: gatppp: Refactor tx path --- gatchat/gatppp.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'gatchat') diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c index 787f6a53..84b43388 100644 --- a/gatchat/gatppp.c +++ b/gatchat/gatppp.c @@ -329,23 +329,19 @@ void ppp_transmit(GAtPPP *ppp, guint8 *packet, guint infolen) { guint16 proto = ppp_proto(packet); - switch (proto) { - case LCP_PROTOCOL: + if (proto == LCP_PROTOCOL) { ppp_send_lcp_frame(ppp, packet, infolen); - break; - case CHAP_PROTOCOL: - case IPCP_PROTO: - /* - * We can't use PFC option because first byte of CHAP_PROTOCOL - * and IPCP_PROTO is not equal to 0x00 - */ - ppp_send_acfc_frame(ppp, packet, infolen); - break; - case PPP_IP_PROTO: - /* We can use both ACFC & PFC if they are negotiated */ - ppp_send_acfc_pfc_frame(ppp, packet, infolen); - break; + return; } + + /* + * If the upper 8 bits of the protocol are 0, then send + * with PFC if enabled + */ + if ((proto & 0xff00) == 0) + ppp_send_acfc_pfc_frame(ppp, packet, infolen); + else + ppp_send_acfc_frame(ppp, packet, infolen); } static inline void ppp_enter_phase(GAtPPP *ppp, enum ppp_phase phase) -- cgit v1.2.3