aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_sockglue.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 00:04:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 00:04:47 -0400
commit3b59bf081622b6446db77ad06c93fe23677bc533 (patch)
tree3f4bb5a27c90cc86994a1f6d3c53fbf9208003cb /net/ipv4/ip_sockglue.c
parente45836fafe157df137a837093037f741ad8f4c90 (diff)
parentbbdb32cb5b73597386913d052165423b9d736145 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking merge from David Miller: "1) Move ixgbe driver over to purely page based buffering on receive. From Alexander Duyck. 2) Add receive packet steering support to e1000e, from Bruce Allan. 3) Convert TCP MD5 support over to RCU, from Eric Dumazet. 4) Reduce cpu usage in handling out-of-order TCP packets on modern systems, also from Eric Dumazet. 5) Support the IP{,V6}_UNICAST_IF socket options, making the wine folks happy, from Erich Hoover. 6) Support VLAN trunking from guests in hyperv driver, from Haiyang Zhang. 7) Support byte-queue-limtis in r8169, from Igor Maravic. 8) Outline code intended for IP_RECVTOS in IP_PKTOPTIONS existed but was never properly implemented, Jiri Benc fixed that. 9) 64-bit statistics support in r8169 and 8139too, from Junchang Wang. 10) Support kernel side dump filtering by ctmark in netfilter ctnetlink, from Pablo Neira Ayuso. 11) Support byte-queue-limits in gianfar driver, from Paul Gortmaker. 12) Add new peek socket options to assist with socket migration, from Pavel Emelyanov. 13) Add sch_plug packet scheduler whose queue is controlled by userland daemons using explicit freeze and release commands. From Shriram Rajagopalan. 14) Fix FCOE checksum offload handling on transmit, from Yi Zou." * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1846 commits) Fix pppol2tp getsockname() Remove printk from rds_sendmsg ipv6: fix incorrent ipv6 ipsec packet fragment cpsw: Hook up default ndo_change_mtu. net: qmi_wwan: fix build error due to cdc-wdm dependecy netdev: driver: ethernet: Add TI CPSW driver netdev: driver: ethernet: add cpsw address lookup engine support phy: add am79c874 PHY support mlx4_core: fix race on comm channel bonding: send igmp report for its master fs_enet: Add MPC5125 FEC support and PHY interface selection net: bpf_jit: fix BPF_S_LDX_B_MSH compilation net: update the usage of CHECKSUM_UNNECESSARY fcoe: use CHECKSUM_UNNECESSARY instead of CHECKSUM_PARTIAL on tx net: do not do gso for CHECKSUM_UNNECESSARY in netif_needs_gso ixgbe: Fix issues with SR-IOV loopback when flow control is disabled net/hyperv: Fix the code handling tx busy ixgbe: fix namespace issues when FCoE/DCB is not enabled rtlwifi: Remove unused ETH_ADDR_LEN defines igbvf: Use ETH_ALEN ... Fix up fairly trivial conflicts in drivers/isdn/gigaset/interface.c and drivers/net/usb/{Kconfig,qmi_wwan.c} as per David.
Diffstat (limited to 'net/ipv4/ip_sockglue.c')
-rw-r--r--net/ipv4/ip_sockglue.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 5343d9ac510b..2fd0fba77124 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -464,6 +464,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
464 (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) | 464 (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) |
465 (1<<IP_PASSSEC) | (1<<IP_TRANSPARENT) | 465 (1<<IP_PASSSEC) | (1<<IP_TRANSPARENT) |
466 (1<<IP_MINTTL) | (1<<IP_NODEFRAG))) || 466 (1<<IP_MINTTL) | (1<<IP_NODEFRAG))) ||
467 optname == IP_UNICAST_IF ||
467 optname == IP_MULTICAST_TTL || 468 optname == IP_MULTICAST_TTL ||
468 optname == IP_MULTICAST_ALL || 469 optname == IP_MULTICAST_ALL ||
469 optname == IP_MULTICAST_LOOP || 470 optname == IP_MULTICAST_LOOP ||
@@ -623,6 +624,35 @@ static int do_ip_setsockopt(struct sock *sk, int level,
623 goto e_inval; 624 goto e_inval;
624 inet->mc_loop = !!val; 625 inet->mc_loop = !!val;
625 break; 626 break;
627 case IP_UNICAST_IF:
628 {
629 struct net_device *dev = NULL;
630 int ifindex;
631
632 if (optlen != sizeof(int))
633 goto e_inval;
634
635 ifindex = (__force int)ntohl((__force __be32)val);
636 if (ifindex == 0) {
637 inet->uc_index = 0;
638 err = 0;
639 break;
640 }
641
642 dev = dev_get_by_index(sock_net(sk), ifindex);
643 err = -EADDRNOTAVAIL;
644 if (!dev)
645 break;
646 dev_put(dev);
647
648 err = -EINVAL;
649 if (sk->sk_bound_dev_if)
650 break;
651
652 inet->uc_index = ifindex;
653 err = 0;
654 break;
655 }
626 case IP_MULTICAST_IF: 656 case IP_MULTICAST_IF:
627 { 657 {
628 struct ip_mreqn mreq; 658 struct ip_mreqn mreq;
@@ -1173,6 +1203,9 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1173 case IP_MULTICAST_LOOP: 1203 case IP_MULTICAST_LOOP:
1174 val = inet->mc_loop; 1204 val = inet->mc_loop;
1175 break; 1205 break;
1206 case IP_UNICAST_IF:
1207 val = (__force int)htonl((__u32) inet->uc_index);
1208 break;
1176 case IP_MULTICAST_IF: 1209 case IP_MULTICAST_IF:
1177 { 1210 {
1178 struct in_addr addr; 1211 struct in_addr addr;
@@ -1251,6 +1284,10 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1251 int hlim = inet->mc_ttl; 1284 int hlim = inet->mc_ttl;
1252 put_cmsg(&msg, SOL_IP, IP_TTL, sizeof(hlim), &hlim); 1285 put_cmsg(&msg, SOL_IP, IP_TTL, sizeof(hlim), &hlim);
1253 } 1286 }
1287 if (inet->cmsg_flags & IP_CMSG_TOS) {
1288 int tos = inet->rcv_tos;
1289 put_cmsg(&msg, SOL_IP, IP_TOS, sizeof(tos), &tos);
1290 }
1254 len -= msg.msg_controllen; 1291 len -= msg.msg_controllen;
1255 return put_user(len, optlen); 1292 return put_user(len, optlen);
1256 } 1293 }