--- zzzz-none-000/linux-4.1.52/net/ipv4/ip_input.c 2018-05-28 02:26:45.000000000 +0000 +++ bcm63-7530ax-731/linux-4.1.52/net/ipv4/ip_input.c 2022-03-02 11:37:13.000000000 +0000 @@ -257,6 +257,9 @@ skb->dev, NULL, ip_local_deliver_finish); } +#if defined(CONFIG_BCM_KF_MAP) && (defined(CONFIG_BCM_MAP) || defined(CONFIG_BCM_MAP_MODULE)) +EXPORT_SYMBOL_GPL(ip_local_deliver); +#endif static inline bool ip_rcv_options(struct sk_buff *skb) { @@ -378,6 +381,9 @@ { const struct iphdr *iph; u32 len; +#if defined(CONFIG_MIPS_BCM963XX) && defined(CONFIG_BCM_KF_UNALIGNED_EXCEPTION) + __u8 iph_ihl, iph_version; +#endif /* When the interface is in promisc. mode, drop all the crap * that it receives, do not try to analyse it. @@ -409,8 +415,14 @@ * 3. Checksums correctly. [Speed optimisation for later, skip loopback checksums] * 4. Doesn't have a bogus length */ +#if defined(CONFIG_MIPS_BCM963XX) && defined(CONFIG_BCM_KF_UNALIGNED_EXCEPTION) + iph_ihl = *(__u8 *)iph & 0xf; + iph_version = *(__u8 *)iph >> 4; + if (iph_ihl < 5 || iph_version != 4) +#else if (iph->ihl < 5 || iph->version != 4) +#endif goto inhdr_error; BUILD_BUG_ON(IPSTATS_MIB_ECT1PKTS != IPSTATS_MIB_NOECTPKTS + INET_ECN_ECT_1); @@ -420,12 +432,20 @@ IPSTATS_MIB_NOECTPKTS + (iph->tos & INET_ECN_MASK), max_t(unsigned short, 1, skb_shinfo(skb)->gso_segs)); +#if defined(CONFIG_MIPS_BCM963XX) && defined(CONFIG_BCM_KF_UNALIGNED_EXCEPTION) + if (!pskb_may_pull(skb, iph_ihl*4)) +#else if (!pskb_may_pull(skb, iph->ihl*4)) +#endif goto inhdr_error; iph = ip_hdr(skb); +#if defined(CONFIG_MIPS_BCM963XX) && defined(CONFIG_BCM_KF_UNALIGNED_EXCEPTION) + if (unlikely(ip_fast_csum((u8 *)iph, iph_ihl))) +#else if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl))) +#endif goto csum_error; len = ntohs(iph->tot_len);