udp.h (7e225619e8afc432fb054ef135f10c11cf8cfc85) | udp.h (cf329aa42b6659204fee865bbce0ea20462552eb) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Definitions for the UDP module. 7 * 8 * Version: @(#)udp.h 1.0.2 05/07/93 --- 403 unchanged lines hidden (view full) --- 412 else __SNMP_INC_STATS((net)->mib.udp_stats_in6, field); \ 413} while(0) 414#define UDP6_INC_STATS(net, field, __lite) do { \ 415 if (__lite) SNMP_INC_STATS((net)->mib.udplite_stats_in6, field); \ 416 else SNMP_INC_STATS((net)->mib.udp_stats_in6, field); \ 417} while(0) 418 419#if IS_ENABLED(CONFIG_IPV6) | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Definitions for the UDP module. 7 * 8 * Version: @(#)udp.h 1.0.2 05/07/93 --- 403 unchanged lines hidden (view full) --- 412 else __SNMP_INC_STATS((net)->mib.udp_stats_in6, field); \ 413} while(0) 414#define UDP6_INC_STATS(net, field, __lite) do { \ 415 if (__lite) SNMP_INC_STATS((net)->mib.udplite_stats_in6, field); \ 416 else SNMP_INC_STATS((net)->mib.udp_stats_in6, field); \ 417} while(0) 418 419#if IS_ENABLED(CONFIG_IPV6) |
420#define __UDPX_INC_STATS(sk, field) \ 421do { \ 422 if ((sk)->sk_family == AF_INET) \ 423 __UDP_INC_STATS(sock_net(sk), field, 0); \ 424 else \ 425 __UDP6_INC_STATS(sock_net(sk), field, 0); \ 426} while (0) | 420#define __UDPX_MIB(sk, ipv4) \ 421({ \ 422 ipv4 ? (IS_UDPLITE(sk) ? sock_net(sk)->mib.udplite_statistics : \ 423 sock_net(sk)->mib.udp_statistics) : \ 424 (IS_UDPLITE(sk) ? sock_net(sk)->mib.udplite_stats_in6 : \ 425 sock_net(sk)->mib.udp_stats_in6); \ 426}) |
427#else | 427#else |
428#define __UDPX_INC_STATS(sk, field) __UDP_INC_STATS(sock_net(sk), field, 0) | 428#define __UDPX_MIB(sk, ipv4) \ 429({ \ 430 IS_UDPLITE(sk) ? sock_net(sk)->mib.udplite_statistics : \ 431 sock_net(sk)->mib.udp_statistics; \ 432}) |
429#endif 430 | 433#endif 434 |
435#define __UDPX_INC_STATS(sk, field) \ 436 __SNMP_INC_STATS(__UDPX_MIB(sk, (sk)->sk_family == AF_INET), field) 437 |
|
431#ifdef CONFIG_PROC_FS 432struct udp_seq_afinfo { 433 sa_family_t family; 434 struct udp_table *udp_table; 435}; 436 437struct udp_iter_state { 438 struct seq_net_private p; --- 17 unchanged lines hidden (view full) --- 456 457DECLARE_STATIC_KEY_FALSE(udp_encap_needed_key); 458void udp_encap_enable(void); 459#if IS_ENABLED(CONFIG_IPV6) 460DECLARE_STATIC_KEY_FALSE(udpv6_encap_needed_key); 461void udpv6_encap_enable(void); 462#endif 463 | 438#ifdef CONFIG_PROC_FS 439struct udp_seq_afinfo { 440 sa_family_t family; 441 struct udp_table *udp_table; 442}; 443 444struct udp_iter_state { 445 struct seq_net_private p; --- 17 unchanged lines hidden (view full) --- 463 464DECLARE_STATIC_KEY_FALSE(udp_encap_needed_key); 465void udp_encap_enable(void); 466#if IS_ENABLED(CONFIG_IPV6) 467DECLARE_STATIC_KEY_FALSE(udpv6_encap_needed_key); 468void udpv6_encap_enable(void); 469#endif 470 |
471static inline struct sk_buff *udp_rcv_segment(struct sock *sk, 472 struct sk_buff *skb, bool ipv4) 473{ 474 struct sk_buff *segs; 475 476 /* the GSO CB lays after the UDP one, no need to save and restore any 477 * CB fragment 478 */ 479 segs = __skb_gso_segment(skb, NETIF_F_SG, false); 480 if (unlikely(IS_ERR_OR_NULL(segs))) { 481 int segs_nr = skb_shinfo(skb)->gso_segs; 482 483 atomic_add(segs_nr, &sk->sk_drops); 484 SNMP_ADD_STATS(__UDPX_MIB(sk, ipv4), UDP_MIB_INERRORS, segs_nr); 485 kfree_skb(skb); 486 return NULL; 487 } 488 489 consume_skb(skb); 490 return segs; 491} 492 |
|
464#endif /* _UDP_H */ | 493#endif /* _UDP_H */ |