blob: 8b8400baa387cd9c3a6063413d30039e4512f3bb [file] [log] [blame]
developer0fb30d52023-12-04 09:51:36 +08001// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (c) 2023 MediaTek Inc. All Rights Reserved.
4 *
5 * Author: Frank-zj Lin <rank-zj.lin@mediatek.com>
6 * Ren-Ting Wang <ren-ting.wang@mediatek.com>
7 */
8
9#include "tops/protocol/mac/ppp.h"
10
11bool mtk_tops_ppp_valid(struct sk_buff *skb)
12{
13 struct ppp_hdr *ppp;
14 struct ppp_hdr ppph;
15
16 ppp = skb_header_pointer(skb, 0, sizeof(struct ppp_hdr), &ppph);
17
18 if (unlikely(!ppp))
19 return false;
20
21 return (ppp->addr == PPP_ALLSTATIONS &&
22 ppp->ctrl == PPP_UI && ntohs(ppp->proto) == PPP_IP);
23}