udp.c (8dd06ef34b6e2f41b29fbf5fc1663780f2524285) udp.c (b51cd7c834dba0ec9300337e16e5aa5bf65bd04c)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * UDP over IPv6
4 * Linux INET6 implementation
5 *
6 * Authors:
7 * Pedro Roque <roque@di.fc.ul.pt>
8 *

--- 829 unchanged lines hidden (view full) ---

838
839int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
840 int proto)
841{
842 const struct in6_addr *saddr, *daddr;
843 struct net *net = dev_net(skb->dev);
844 struct udphdr *uh;
845 struct sock *sk;
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * UDP over IPv6
4 * Linux INET6 implementation
5 *
6 * Authors:
7 * Pedro Roque <roque@di.fc.ul.pt>
8 *

--- 829 unchanged lines hidden (view full) ---

838
839int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
840 int proto)
841{
842 const struct in6_addr *saddr, *daddr;
843 struct net *net = dev_net(skb->dev);
844 struct udphdr *uh;
845 struct sock *sk;
846 bool refcounted;
846 u32 ulen = 0;
847
848 if (!pskb_may_pull(skb, sizeof(struct udphdr)))
849 goto discard;
850
851 saddr = &ipv6_hdr(skb)->saddr;
852 daddr = &ipv6_hdr(skb)->daddr;
853 uh = udp_hdr(skb);

--- 20 unchanged lines hidden (view full) ---

874 uh = udp_hdr(skb);
875 }
876 }
877
878 if (udp6_csum_init(skb, uh, proto))
879 goto csum_error;
880
881 /* Check if the socket is already available, e.g. due to early demux */
847 u32 ulen = 0;
848
849 if (!pskb_may_pull(skb, sizeof(struct udphdr)))
850 goto discard;
851
852 saddr = &ipv6_hdr(skb)->saddr;
853 daddr = &ipv6_hdr(skb)->daddr;
854 uh = udp_hdr(skb);

--- 20 unchanged lines hidden (view full) ---

875 uh = udp_hdr(skb);
876 }
877 }
878
879 if (udp6_csum_init(skb, uh, proto))
880 goto csum_error;
881
882 /* Check if the socket is already available, e.g. due to early demux */
882 sk = skb_steal_sock(skb);
883 sk = skb_steal_sock(skb, &refcounted);
883 if (sk) {
884 struct dst_entry *dst = skb_dst(skb);
885 int ret;
886
887 if (unlikely(sk->sk_rx_dst != dst))
888 udp6_sk_rx_dst_set(sk, dst);
889
890 if (!uh->check && !udp_sk(sk)->no_check6_rx) {
884 if (sk) {
885 struct dst_entry *dst = skb_dst(skb);
886 int ret;
887
888 if (unlikely(sk->sk_rx_dst != dst))
889 udp6_sk_rx_dst_set(sk, dst);
890
891 if (!uh->check && !udp_sk(sk)->no_check6_rx) {
891 sock_put(sk);
892 if (refcounted)
893 sock_put(sk);
892 goto report_csum_error;
893 }
894
895 ret = udp6_unicast_rcv_skb(sk, skb, uh);
894 goto report_csum_error;
895 }
896
897 ret = udp6_unicast_rcv_skb(sk, skb, uh);
896 sock_put(sk);
898 if (refcounted)
899 sock_put(sk);
897 return ret;
898 }
899
900 /*
901 * Multicast receive code
902 */
903 if (ipv6_addr_is_multicast(daddr))
904 return __udp6_lib_mcast_deliver(net, skb,

--- 146 unchanged lines hidden (view full) ---

1051 return BPF_CGROUP_RUN_PROG_INET6_CONNECT_LOCK(sk, uaddr);
1052}
1053
1054/**
1055 * udp6_hwcsum_outgoing - handle outgoing HW checksumming
1056 * @sk: socket we are sending on
1057 * @skb: sk_buff containing the filled-in UDP header
1058 * (checksum field must be zeroed out)
900 return ret;
901 }
902
903 /*
904 * Multicast receive code
905 */
906 if (ipv6_addr_is_multicast(daddr))
907 return __udp6_lib_mcast_deliver(net, skb,

--- 146 unchanged lines hidden (view full) ---

1054 return BPF_CGROUP_RUN_PROG_INET6_CONNECT_LOCK(sk, uaddr);
1055}
1056
1057/**
1058 * udp6_hwcsum_outgoing - handle outgoing HW checksumming
1059 * @sk: socket we are sending on
1060 * @skb: sk_buff containing the filled-in UDP header
1061 * (checksum field must be zeroed out)
1062 * @saddr: source address
1063 * @daddr: destination address
1064 * @len: length of packet
1059 */
1060static void udp6_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,
1061 const struct in6_addr *saddr,
1062 const struct in6_addr *daddr, int len)
1063{
1064 unsigned int offset;
1065 struct udphdr *uh = udp_hdr(skb);
1066 struct sk_buff *frags = skb_shinfo(skb)->frag_list;

--- 650 unchanged lines hidden ---
1065 */
1066static void udp6_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,
1067 const struct in6_addr *saddr,
1068 const struct in6_addr *daddr, int len)
1069{
1070 unsigned int offset;
1071 struct udphdr *uh = udp_hdr(skb);
1072 struct sk_buff *frags = skb_shinfo(skb)->frag_list;

--- 650 unchanged lines hidden ---