aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/in.h1
-rw-r--r--include/net/inet_sock.h3
-rw-r--r--net/ipv4/af_inet.c1
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/ip_sockglue.c11
5 files changed, 16 insertions, 2 deletions
diff --git a/include/linux/in.h b/include/linux/in.h
index d60122a3a088..cf196da04ec9 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -107,6 +107,7 @@ struct in_addr {
107#define MCAST_JOIN_SOURCE_GROUP 46 107#define MCAST_JOIN_SOURCE_GROUP 46
108#define MCAST_LEAVE_SOURCE_GROUP 47 108#define MCAST_LEAVE_SOURCE_GROUP 47
109#define MCAST_MSFILTER 48 109#define MCAST_MSFILTER 48
110#define IP_MULTICAST_ALL 49
110 111
111#define MCAST_EXCLUDE 0 112#define MCAST_EXCLUDE 0
112#define MCAST_INCLUDE 1 113#define MCAST_INCLUDE 1
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index de0ecc71cf03..20a6957af870 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -130,7 +130,8 @@ struct inet_sock {
130 freebind:1, 130 freebind:1,
131 hdrincl:1, 131 hdrincl:1,
132 mc_loop:1, 132 mc_loop:1,
133 transparent:1; 133 transparent:1,
134 mc_all:1;
134 int mc_index; 135 int mc_index;
135 __be32 mc_addr; 136 __be32 mc_addr;
136 struct ip_mc_socklist *mc_list; 137 struct ip_mc_socklist *mc_list;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 5abee4c97449..d87362178588 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -375,6 +375,7 @@ lookup_protocol:
375 inet->uc_ttl = -1; 375 inet->uc_ttl = -1;
376 inet->mc_loop = 1; 376 inet->mc_loop = 1;
377 inet->mc_ttl = 1; 377 inet->mc_ttl = 1;
378 inet->mc_all = 1;
378 inet->mc_index = 0; 379 inet->mc_index = 0;
379 inet->mc_list = NULL; 380 inet->mc_list = NULL;
380 381
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 9eb6219af615..e6058a503796 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -2196,7 +2196,7 @@ int ip_mc_sf_allow(struct sock *sk, __be32 loc_addr, __be32 rmt_addr, int dif)
2196 break; 2196 break;
2197 } 2197 }
2198 if (!pmc) 2198 if (!pmc)
2199 return 1; 2199 return inet->mc_all;
2200 psl = pmc->sflist; 2200 psl = pmc->sflist;
2201 if (!psl) 2201 if (!psl)
2202 return pmc->sfmode == MCAST_EXCLUDE; 2202 return pmc->sfmode == MCAST_EXCLUDE;
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 21b0187123d6..cb49936856e0 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -453,6 +453,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
453 (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) | 453 (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) |
454 (1<<IP_PASSSEC) | (1<<IP_TRANSPARENT))) || 454 (1<<IP_PASSSEC) | (1<<IP_TRANSPARENT))) ||
455 optname == IP_MULTICAST_TTL || 455 optname == IP_MULTICAST_TTL ||
456 optname == IP_MULTICAST_ALL ||
456 optname == IP_MULTICAST_LOOP || 457 optname == IP_MULTICAST_LOOP ||
457 optname == IP_RECVORIGDSTADDR) { 458 optname == IP_RECVORIGDSTADDR) {
458 if (optlen >= sizeof(int)) { 459 if (optlen >= sizeof(int)) {
@@ -898,6 +899,13 @@ mc_msf_out:
898 kfree(gsf); 899 kfree(gsf);
899 break; 900 break;
900 } 901 }
902 case IP_MULTICAST_ALL:
903 if (optlen < 1)
904 goto e_inval;
905 if (val != 0 && val != 1)
906 goto e_inval;
907 inet->mc_all = val;
908 break;
901 case IP_ROUTER_ALERT: 909 case IP_ROUTER_ALERT:
902 err = ip_ra_control(sk, val ? 1 : 0, NULL); 910 err = ip_ra_control(sk, val ? 1 : 0, NULL);
903 break; 911 break;
@@ -1151,6 +1159,9 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1151 release_sock(sk); 1159 release_sock(sk);
1152 return err; 1160 return err;
1153 } 1161 }
1162 case IP_MULTICAST_ALL:
1163 val = inet->mc_all;
1164 break;
1154 case IP_PKTOPTIONS: 1165 case IP_PKTOPTIONS:
1155 { 1166 {
1156 struct msghdr msg; 1167 struct msghdr msg;