developer | 0fb30d5 | 2023-12-04 09:51:36 +0800 | [diff] [blame^] | 1 | // 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 | |
| 11 | bool 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 | } |