/* Must be called with table->hash2 initialized */ staticinlinevoid udp_table_hash4_init(struct udp_table *table)
{
table->hash4 = (void *)(table->hash2 + (table->mask + 1)); for (int i = 0; i <= table->mask; i++) {
table->hash2[i].hash4_cnt = 0;
int udp_lib_get_port(struct sock *sk, unsignedshort snum, unsignedint hash2_nulladdr);
u32 udp_flow_hashrnd(void);
staticinline __be16 udp_flow_src_port(struct net *net, struct sk_buff *skb, int min, int max, bool use_eth)
{
u32 hash;
if (min >= max) { /* Use default range */
inet_get_local_port_range(net, &min, &max);
}
hash = skb_get_hash(skb); if (unlikely(!hash)) { if (use_eth) { /* Can't find a normal hash, caller has indicated an *Ethernetpacketsousethattocomputeahash.
*/
hash = jhash(skb->data, 2 * ETH_ALEN,
(__force u32) skb->protocol);
} else { /* Can't derive any sort of hash for the packet, set *tosomeconsistentrandomvalue.
*/
hash = udp_flow_hashrnd();
}
}
/* Since this is being sent on the wire obfuscate hash a bit *tominimizepossibilitythatanyusefulinformationtoan *attackerisleaked.Onlyupper16bitsarerelevantinthe *computationfor16bitportvalue.
*/
hash ^= hash << 16;
staticinlinebool udp_sk_bound_dev_eq(conststruct net *net, int bound_dev_if, int dif, int sdif)
{ #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) return inet_bound_dev_eq(!!READ_ONCE(net->ipv4.sysctl_udp_l3mdev_accept),
bound_dev_if, dif, sdif); #else return inet_bound_dev_eq(true, bound_dev_if, dif, sdif); #endif
}
/* net/ipv4/udp.c */ void udp_destruct_common(struct sock *sk); void skb_consume_udp(struct sock *sk, struct sk_buff *skb, int len); int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb); void udp_skb_destructor(struct sock *sk, struct sk_buff *skb); struct sk_buff *__skb_recv_udp(struct sock *sk, unsignedint flags, int *off, int *err); staticinlinestruct sk_buff *skb_recv_udp(struct sock *sk, unsignedint flags, int *err)
{ int off = 0;
return __skb_recv_udp(sk, flags, &off, err);
}
int udp_v4_early_demux(struct sk_buff *skb); bool udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst); int udp_err(struct sk_buff *, u32); int udp_abort(struct sock *sk, int err); int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len); void udp_splice_eof(struct socket *sock); int udp_push_pending_frames(struct sock *sk); void udp_flush_pending_frames(struct sock *sk); int udp_cmsg_send(struct sock *sk, struct msghdr *msg, u16 *gso_size); void udp4_hwcsum(struct sk_buff *skb, __be32 src, __be32 dst); int udp_rcv(struct sk_buff *skb); int udp_ioctl(struct sock *sk, int cmd, int *karg); int udp_init_sock(struct sock *sk); int udp_pre_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); int __udp_disconnect(struct sock *sk, int flags); int udp_disconnect(struct sock *sk, int flags);
__poll_t udp_poll(struct file *file, struct socket *sock, poll_table *wait); struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
netdev_features_t features, bool is_ipv6); int udp_lib_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); int udp_lib_setsockopt(struct sock *sk, int level, int optname,
sockptr_t optval, unsignedint optlen, int (*push_pending_frames)(struct sock *)); struct sock *udp4_lib_lookup(conststruct net *net, __be32 saddr, __be16 sport,
__be32 daddr, __be16 dport, int dif); struct sock *__udp4_lib_lookup(conststruct net *net, __be32 saddr,
__be16 sport,
__be32 daddr, __be16 dport, int dif, int sdif, struct udp_table *tbl, struct sk_buff *skb); struct sock *udp4_lib_lookup_skb(conststruct sk_buff *skb,
__be16 sport, __be16 dport); struct sock *udp6_lib_lookup(conststruct net *net, conststruct in6_addr *saddr, __be16 sport, conststruct in6_addr *daddr, __be16 dport, int dif); struct sock *__udp6_lib_lookup(conststruct net *net, conststruct in6_addr *saddr, __be16 sport, conststruct in6_addr *daddr, __be16 dport, int dif, int sdif, struct udp_table *tbl, struct sk_buff *skb); struct sock *udp6_lib_lookup_skb(conststruct sk_buff *skb,
__be16 sport, __be16 dport); int udp_read_skb(struct sock *sk, skb_read_actor_t recv_actor);
/* UDP uses skb->dev_scratch to cache as much information as possible and avoid *possiblymultiplecachemissondequeue()
*/ struct udp_dev_scratch { /* skb->truesize and the stateless bit are embedded in a single field; *donotuseabitfieldsincethecompileremitsbetter/smallercode *thisway
*/
u32 _tsize_state;
#if BITS_PER_LONG == 64 /* len and the bit needed to compute skb_csum_unnecessary *willbeoncoldcachelinesatrecvmsgtime. *skb->lencanbestoredon16bitssincetheudpheaderhasbeen *alreadyvalidatedandpulled.
*/
u16 len; bool is_linear; bool csum_unnecessary; #endif
};
/* Avoid csum recalculation by skb_segment unless userspace explicitly *asksforthefinalchecksumvalues
*/ if (!inet_get_convert_csum(sk))
features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
/* UDP segmentation expects packets of type CHECKSUM_PARTIAL or *CHECKSUM_NONEin__udp_gso_segment.UDPGROindeedbuildspartial *packetsinudp_gro_complete_segment.AsdoesUDPGSO,verifiedby *udp_send_skb.Butwhenthosepacketsareloopedindev_loopback_xmit *theirip_summedCHECKSUM_NONEischangedtoCHECKSUM_UNNECESSARY. *Resetinthisspecificcase,wherePARTIALisbothcorrectand *required.
*/ if (skb->pkt_type == PACKET_LOOPBACK)
skb->ip_summed = CHECKSUM_PARTIAL;
/* the GSO CB lays after the UDP one, no need to save and restore any *CBfragment
*/
segs = __skb_gso_segment(skb, features, false); if (IS_ERR_OR_NULL(segs)) {
drop_count = skb_shinfo(skb)->gso_segs; goto drop;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.