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.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 1807a30694d9..035915fc9ed3 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -448,8 +448,9 @@ static void udp4_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,
448/* 448/*
449 * Push out all pending data as one UDP datagram. Socket is locked. 449 * Push out all pending data as one UDP datagram. Socket is locked.
450 */ 450 */
451static int udp_push_pending_frames(struct sock *sk, struct udp_sock *up) 451static int udp_push_pending_frames(struct sock *sk)
452{ 452{
453 struct udp_sock *up = udp_sk(sk);
453 struct inet_sock *inet = inet_sk(sk); 454 struct inet_sock *inet = inet_sk(sk);
454 struct flowi *fl = &inet->cork.fl; 455 struct flowi *fl = &inet->cork.fl;
455 struct sk_buff *skb; 456 struct sk_buff *skb;
@@ -673,7 +674,7 @@ do_append_data:
673 if (err) 674 if (err)
674 udp_flush_pending_frames(sk); 675 udp_flush_pending_frames(sk);
675 else if (!corkreq) 676 else if (!corkreq)
676 err = udp_push_pending_frames(sk, up); 677 err = udp_push_pending_frames(sk);
677 else if (unlikely(skb_queue_empty(&sk->sk_write_queue))) 678 else if (unlikely(skb_queue_empty(&sk->sk_write_queue)))
678 up->pending = 0; 679 up->pending = 0;
679 release_sock(sk); 680 release_sock(sk);
@@ -746,7 +747,7 @@ int udp_sendpage(struct sock *sk, struct page *page, int offset,
746 747
747 up->len += size; 748 up->len += size;
748 if (!(up->corkflag || (flags&MSG_MORE))) 749 if (!(up->corkflag || (flags&MSG_MORE)))
749 ret = udp_push_pending_frames(sk, up); 750 ret = udp_push_pending_frames(sk);
750 if (!ret) 751 if (!ret)
751 ret = size; 752 ret = size;
752out: 753out:
@@ -1299,8 +1300,9 @@ int udp_destroy_sock(struct sock *sk)
1299/* 1300/*
1300 * Socket option code for UDP 1301 * Socket option code for UDP
1301 */ 1302 */
1302static int do_udp_setsockopt(struct sock *sk, int level, int optname, 1303int udp_lib_setsockopt(struct sock *sk, int level, int optname,
1303 char __user *optval, int optlen) 1304 char __user *optval, int optlen,
1305 int (*push_pending_frames)(struct sock *))
1304{ 1306{
1305 struct udp_sock *up = udp_sk(sk); 1307 struct udp_sock *up = udp_sk(sk);
1306 int val; 1308 int val;
@@ -1319,7 +1321,7 @@ static int do_udp_setsockopt(struct sock *sk, int level, int optname,
1319 } else { 1321 } else {
1320 up->corkflag = 0; 1322 up->corkflag = 0;
1321 lock_sock(sk); 1323 lock_sock(sk);
1322 udp_push_pending_frames(sk, up); 1324 (*push_pending_frames)(sk);
1323 release_sock(sk); 1325 release_sock(sk);
1324 } 1326 }
1325 break; 1327 break;
@@ -1375,7 +1377,8 @@ int udp_setsockopt(struct sock *sk, int level, int optname,
1375 char __user *optval, int optlen) 1377 char __user *optval, int optlen)
1376{ 1378{
1377 if (level == SOL_UDP || level == SOL_UDPLITE) 1379 if (level == SOL_UDP || level == SOL_UDPLITE)
1378 return do_udp_setsockopt(sk, level, optname, optval, optlen); 1380 return udp_lib_setsockopt(sk, level, optname, optval, optlen,
1381 udp_push_pending_frames);
1379 return ip_setsockopt(sk, level, optname, optval, optlen); 1382 return ip_setsockopt(sk, level, optname, optval, optlen);
1380} 1383}
1381 1384
@@ -1384,13 +1387,14 @@ int compat_udp_setsockopt(struct sock *sk, int level, int optname,
1384 char __user *optval, int optlen) 1387 char __user *optval, int optlen)
1385{ 1388{
1386 if (level == SOL_UDP || level == SOL_UDPLITE) 1389 if (level == SOL_UDP || level == SOL_UDPLITE)
1387 return do_udp_setsockopt(sk, level, optname, optval, optlen); 1390 return udp_lib_setsockopt(sk, level, optname, optval, optlen,
1391 udp_push_pending_frames);
1388 return compat_ip_setsockopt(sk, level, optname, optval, optlen); 1392 return compat_ip_setsockopt(sk, level, optname, optval, optlen);
1389} 1393}
1390#endif 1394#endif
1391 1395
1392static int do_udp_getsockopt(struct sock *sk, int level, int optname, 1396int udp_lib_getsockopt(struct sock *sk, int level, int optname,
1393 char __user *optval, int __user *optlen) 1397 char __user *optval, int __user *optlen)
1394{ 1398{
1395 struct udp_sock *up = udp_sk(sk); 1399 struct udp_sock *up = udp_sk(sk);
1396 int val, len; 1400 int val, len;
@@ -1437,7 +1441,7 @@ int udp_getsockopt(struct sock *sk, int level, int optname,
1437 char __user *optval, int __user *optlen) 1441 char __user *optval, int __user *optlen)
1438{ 1442{
1439 if (level == SOL_UDP || level == SOL_UDPLITE) 1443 if (level == SOL_UDP || level == SOL_UDPLITE)
1440 return do_udp_getsockopt(sk, level, optname, optval, optlen); 1444 return udp_lib_getsockopt(sk, level, optname, optval, optlen);
1441 return ip_getsockopt(sk, level, optname, optval, optlen); 1445 return ip_getsockopt(sk, level, optname, optval, optlen);
1442} 1446}
1443 1447
@@ -1446,7 +1450,7 @@ int compat_udp_getsockopt(struct sock *sk, int level, int optname,
1446 char __user *optval, int __user *optlen) 1450 char __user *optval, int __user *optlen)
1447{ 1451{
1448 if (level == SOL_UDP || level == SOL_UDPLITE) 1452 if (level == SOL_UDP || level == SOL_UDPLITE)
1449 return do_udp_getsockopt(sk, level, optname, optval, optlen); 1453 return udp_lib_getsockopt(sk, level, optname, optval, optlen);
1450 return compat_ip_getsockopt(sk, level, optname, optval, optlen); 1454 return compat_ip_getsockopt(sk, level, optname, optval, optlen);
1451} 1455}
1452#endif 1456#endif
@@ -1716,6 +1720,8 @@ EXPORT_SYMBOL(udp_ioctl);
1716EXPORT_SYMBOL(udp_get_port); 1720EXPORT_SYMBOL(udp_get_port);
1717EXPORT_SYMBOL(udp_prot); 1721EXPORT_SYMBOL(udp_prot);
1718EXPORT_SYMBOL(udp_sendmsg); 1722EXPORT_SYMBOL(udp_sendmsg);
1723EXPORT_SYMBOL(udp_lib_getsockopt);
1724EXPORT_SYMBOL(udp_lib_setsockopt);
1719EXPORT_SYMBOL(udp_poll); 1725EXPORT_SYMBOL(udp_poll);
1720 1726
1721#ifdef CONFIG_PROC_FS 1727#ifdef CONFIG_PROC_FS