aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r--net/ipv4/udp.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 3465d4ad301b..5e67e3245299 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -471,6 +471,7 @@ static int udp_push_pending_frames(struct sock *sk)
471 struct sk_buff *skb; 471 struct sk_buff *skb;
472 struct udphdr *uh; 472 struct udphdr *uh;
473 int err = 0; 473 int err = 0;
474 int is_udplite = IS_UDPLITE(sk);
474 __wsum csum = 0; 475 __wsum csum = 0;
475 476
476 /* Grab the skbuff where UDP header space exists. */ 477 /* Grab the skbuff where UDP header space exists. */
@@ -486,7 +487,7 @@ static int udp_push_pending_frames(struct sock *sk)
486 uh->len = htons(up->len); 487 uh->len = htons(up->len);
487 uh->check = 0; 488 uh->check = 0;
488 489
489 if (up->pcflag) /* UDP-Lite */ 490 if (is_udplite) /* UDP-Lite */
490 csum = udplite_csum_outgoing(sk, skb); 491 csum = udplite_csum_outgoing(sk, skb);
491 492
492 else if (sk->sk_no_check == UDP_CSUM_NOXMIT) { /* UDP csum disabled */ 493 else if (sk->sk_no_check == UDP_CSUM_NOXMIT) { /* UDP csum disabled */
@@ -514,7 +515,7 @@ out:
514 up->len = 0; 515 up->len = 0;
515 up->pending = 0; 516 up->pending = 0;
516 if (!err) 517 if (!err)
517 UDP_INC_STATS_USER(UDP_MIB_OUTDATAGRAMS, up->pcflag); 518 UDP_INC_STATS_USER(UDP_MIB_OUTDATAGRAMS, is_udplite);
518 return err; 519 return err;
519} 520}
520 521
@@ -531,7 +532,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
531 __be32 daddr, faddr, saddr; 532 __be32 daddr, faddr, saddr;
532 __be16 dport; 533 __be16 dport;
533 u8 tos; 534 u8 tos;
534 int err, is_udplite = up->pcflag; 535 int err, is_udplite = IS_UDPLITE(sk);
535 int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; 536 int corkreq = up->corkflag || msg->msg_flags&MSG_MORE;
536 int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); 537 int (*getfrag)(void *, char *, int, int, int, struct sk_buff *);
537 538
@@ -942,6 +943,7 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
942{ 943{
943 struct udp_sock *up = udp_sk(sk); 944 struct udp_sock *up = udp_sk(sk);
944 int rc; 945 int rc;
946 int is_udplite = IS_UDPLITE(sk);
945 947
946 /* 948 /*
947 * Charge it to the socket, dropping if the queue is full. 949 * Charge it to the socket, dropping if the queue is full.
@@ -978,7 +980,7 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
978 /* 980 /*
979 * UDP-Lite specific tests, ignored on UDP sockets 981 * UDP-Lite specific tests, ignored on UDP sockets
980 */ 982 */
981 if ((up->pcflag & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) { 983 if ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {
982 984
983 /* 985 /*
984 * MIB statistics other than incrementing the error count are 986 * MIB statistics other than incrementing the error count are
@@ -1019,14 +1021,14 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
1019 if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { 1021 if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) {
1020 /* Note that an ENOMEM error is charged twice */ 1022 /* Note that an ENOMEM error is charged twice */
1021 if (rc == -ENOMEM) 1023 if (rc == -ENOMEM)
1022 UDP_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, up->pcflag); 1024 UDP_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, is_udplite);
1023 goto drop; 1025 goto drop;
1024 } 1026 }
1025 1027
1026 return 0; 1028 return 0;
1027 1029
1028drop: 1030drop:
1029 UDP_INC_STATS_BH(UDP_MIB_INERRORS, up->pcflag); 1031 UDP_INC_STATS_BH(UDP_MIB_INERRORS, is_udplite);
1030 kfree_skb(skb); 1032 kfree_skb(skb);
1031 return -1; 1033 return -1;
1032} 1034}
@@ -1235,6 +1237,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
1235 struct udp_sock *up = udp_sk(sk); 1237 struct udp_sock *up = udp_sk(sk);
1236 int val; 1238 int val;
1237 int err = 0; 1239 int err = 0;
1240 int is_udplite = IS_UDPLITE(sk);
1238 1241
1239 if (optlen<sizeof(int)) 1242 if (optlen<sizeof(int))
1240 return -EINVAL; 1243 return -EINVAL;
@@ -1276,7 +1279,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
1276 /* The sender sets actual checksum coverage length via this option. 1279 /* The sender sets actual checksum coverage length via this option.
1277 * The case coverage > packet length is handled by send module. */ 1280 * The case coverage > packet length is handled by send module. */
1278 case UDPLITE_SEND_CSCOV: 1281 case UDPLITE_SEND_CSCOV:
1279 if (!up->pcflag) /* Disable the option on UDP sockets */ 1282 if (!is_udplite) /* Disable the option on UDP sockets */
1280 return -ENOPROTOOPT; 1283 return -ENOPROTOOPT;
1281 if (val != 0 && val < 8) /* Illegal coverage: use default (8) */ 1284 if (val != 0 && val < 8) /* Illegal coverage: use default (8) */
1282 val = 8; 1285 val = 8;
@@ -1288,7 +1291,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
1288 * sense, this should be set to at least 8 (as done below). If zero is 1291 * sense, this should be set to at least 8 (as done below). If zero is
1289 * used, this again means full checksum coverage. */ 1292 * used, this again means full checksum coverage. */
1290 case UDPLITE_RECV_CSCOV: 1293 case UDPLITE_RECV_CSCOV:
1291 if (!up->pcflag) /* Disable the option on UDP sockets */ 1294 if (!is_udplite) /* Disable the option on UDP sockets */
1292 return -ENOPROTOOPT; 1295 return -ENOPROTOOPT;
1293 if (val != 0 && val < 8) /* Avoid silly minimal values. */ 1296 if (val != 0 && val < 8) /* Avoid silly minimal values. */
1294 val = 8; 1297 val = 8;