summaryrefslogtreecommitdiff
path: root/drivers/net/ppp/ppp_async.c
diff options
context:
space:
mode:
authorSam Protsenko <semen.protsenko@linaro.org>2018-12-20 20:29:20 +0200
committerDavid S. Miller <davem@davemloft.net>2018-12-20 16:49:30 -0800
commit7fb1b8ca8fa1ee34ffc328f17f78da68c7cc04e6 (patch)
tree0bfd98344d7e7880084591acdbc2e6ec0e7ba8f9 /drivers/net/ppp/ppp_async.c
parente69fbf31ca2cf6d6a2afedd0f8b30dcd10e76049 (diff)
downloadlwn-7fb1b8ca8fa1ee34ffc328f17f78da68c7cc04e6.tar.gz
lwn-7fb1b8ca8fa1ee34ffc328f17f78da68c7cc04e6.zip
ppp: Move PFC decompression to PPP generic layer
Extract "Protocol" field decompression code from transport protocols to PPP generic layer, where it actually belongs. As a consequence, this patch fixes incorrect place of PFC decompression in L2TP driver (when it's not PPPOX_BOUND) and also enables this decompression for other protocols, like PPPoE. Protocol field decompression also happens in PPP Multilink Protocol code and in PPP compression protocols implementations (bsd, deflate, mppe). It looks like there is no easy way to get rid of that, so it was decided to leave it as is, but provide those cases with appropriate comments instead. Changes in v2: - Fix the order of checking skb data room and proto decompression - Remove "inline" keyword from ppp_decompress_proto() - Don't split line before function name - Prefix ppp_decompress_proto() function with "__" - Add ppp_decompress_proto() function with skb data room checks - Add description for introduced functions - Fix comments (as per review on mailing list) Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Guillaume Nault <g.nault@alphalink.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ppp/ppp_async.c')
-rw-r--r--drivers/net/ppp/ppp_async.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/ppp/ppp_async.c b/drivers/net/ppp/ppp_async.c
index 288cf099876b..b287bb811875 100644
--- a/drivers/net/ppp/ppp_async.c
+++ b/drivers/net/ppp/ppp_async.c
@@ -770,7 +770,7 @@ process_input_packet(struct asyncppp *ap)
{
struct sk_buff *skb;
unsigned char *p;
- unsigned int len, fcs, proto;
+ unsigned int len, fcs;
skb = ap->rpkt;
if (ap->state & (SC_TOSS | SC_ESCAPE))
@@ -799,14 +799,14 @@ process_input_packet(struct asyncppp *ap)
goto err;
p = skb_pull(skb, 2);
}
- proto = p[0];
- if (proto & 1) {
- /* protocol is compressed */
- *(u8 *)skb_push(skb, 1) = 0;
- } else {
+
+ /* If protocol field is not compressed, it can be LCP packet */
+ if (!(p[0] & 0x01)) {
+ unsigned int proto;
+
if (skb->len < 2)
goto err;
- proto = (proto << 8) + p[1];
+ proto = (p[0] << 8) + p[1];
if (proto == PPP_LCP)
async_lcp_peek(ap, p, skb->len, 1);
}