From: Andi Kleen <andi@firstfloor.org>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, tom.zanussi@linux.intel.com,
Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 15/24] net, diet: Make igmp and mcast ioctls depend on IP_MULTICAST
Date: Mon, 5 May 2014 15:26:04 -0700 [thread overview]
Message-ID: <1399328773-6531-16-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1399328773-6531-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
There was already a CONFIG_IP_MULTICAST, but it didn't control
the multicasting code (like igmp) in the IP stack, only some
driver code. Change this.
This disables some multi cast filters in TCP/UDP too, but
that should be ok because we never joing multicast groups
without this options, so the packets should never arrive up-stack.
Worth ~20k when disabled
text data bss dec hex filename
420363 17509 11624 449496 6dbd8 net/built-in.o-with-mcast
399649 17381 11624 428654 68a6e net/built-in.o-wo-mcast
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
include/linux/igmp.h | 31 +++++++++++++++++++++++--------
net/ipv4/Kconfig | 8 +++-----
net/ipv4/Makefile | 3 ++-
net/ipv4/devinet.c | 2 ++
net/ipv4/ip_sockglue.c | 4 ++++
net/ipv4/sysctl_net_ipv4.c | 2 ++
6 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index f47550d..1a1a044 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -108,11 +108,7 @@ struct ip_mc_list {
#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
-extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
extern int igmp_rcv(struct sk_buff *);
-extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
-extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
-extern void ip_mc_drop_socket(struct sock *sk);
extern int ip_mc_source(int add, int omode, struct sock *sk,
struct ip_mreq_source *mreqs, int ifindex);
extern int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf,int ifindex);
@@ -120,14 +116,33 @@ extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
struct ip_msfilter __user *optval, int __user *optlen);
extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
struct group_filter __user *optval, int __user *optlen);
-extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif);
-extern void ip_mc_init_dev(struct in_device *);
-extern void ip_mc_destroy_dev(struct in_device *);
-extern void ip_mc_up(struct in_device *);
extern void ip_mc_down(struct in_device *);
extern void ip_mc_unmap(struct in_device *);
extern void ip_mc_remap(struct in_device *);
extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
+#ifdef CONFIG_IP_MULTICAST
+extern int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif);
+extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
+extern void ip_mc_up(struct in_device *);
+extern void ip_mc_destroy_dev(struct in_device *);
+extern void ip_mc_init_dev(struct in_device *);
+extern void ip_mc_drop_socket(struct sock *sk);
+extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
+extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
+#else
+static inline int ip_mc_sf_allow(struct sock *sk, __be32 local, __be32 rmt, int dif)
+{ return 0; }
+static inline int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto)
+{ return 0; }
+static inline void ip_mc_up(struct in_device *d) {}
+static inline void ip_mc_destroy_dev(struct in_device *d) {}
+static inline void ip_mc_init_dev(struct in_device *d) {}
+static inline void ip_mc_drop_socket(struct sock *sk) {}
+static inline int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr)
+{ return -EINVAL; }
+static inline int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
+{ return -EINVAL; }
+#endif
#endif
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 00a7f76..c1f9899 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -5,11 +5,9 @@ config IP_MULTICAST
bool "IP: multicasting"
help
This is code for addressing several networked computers at once,
- enlarging your kernel by about 2 KB. You need multicasting if you
- intend to participate in the MBONE, a high bandwidth network on top
- of the Internet which carries audio and video broadcasts. More
- information about the MBONE is on the WWW at
- <http://www.savetz.com/mbone/>. For most people, it's safe to say N.
+ enlarging your kernel by about 20 KB. This is needed for many
+ modern networking services on the local network, so you should
+ probably say Y.
config IP_ADVANCED_ROUTER
bool "IP: advanced router"
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile
index 784a782..eb129a4 100644
--- a/net/ipv4/Makefile
+++ b/net/ipv4/Makefile
@@ -9,7 +9,7 @@ obj-y := route.o inetpeer.o protocol.o \
tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o \
tcp_minisocks.o tcp_cong.o tcp_fastopen.o \
datagram.o raw.o udp.o udplite.o \
- arp.o icmp.o devinet.o af_inet.o igmp.o \
+ arp.o icmp.o devinet.o af_inet.o \
fib_frontend.o fib_semantics.o fib_trie.o \
inet_fragment.o ip_tunnel_core.o gre_offload.o
@@ -37,6 +37,7 @@ obj-$(CONFIG_INET_TUNNEL) += tunnel4.o
obj-$(CONFIG_INET_XFRM_MODE_TRANSPORT) += xfrm4_mode_transport.o
obj-$(CONFIG_INET_XFRM_MODE_TUNNEL) += xfrm4_mode_tunnel.o
obj-$(CONFIG_IP_PNP) += ipconfig.o
+obj-$(CONFIG_IP_MULTICAST) += igmp.o
obj-$(CONFIG_NETFILTER) += netfilter.o netfilter/
obj-$(CONFIG_INET_DIAG) += inet_diag.o
obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index bdbf68b..c19266d 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1402,6 +1402,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
/* Send gratuitous ARP to notify of link change */
inetdev_send_gratuitous_arp(dev, in_dev);
break;
+#ifdef CONFIG_IP_MULTICAST
case NETDEV_DOWN:
ip_mc_down(in_dev);
break;
@@ -1411,6 +1412,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
case NETDEV_POST_TYPE_CHANGE:
ip_mc_remap(in_dev);
break;
+#endif
case NETDEV_CHANGEMTU:
if (inetdev_valid_mtu(dev->mtu))
break;
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 64741b9..ed5c7bd 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -652,6 +652,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
if (!val)
skb_queue_purge(&sk->sk_error_queue);
break;
+#ifdef CONFIG_IP_MULTICAST
case IP_MULTICAST_TTL:
if (sk->sk_type == SOCK_STREAM)
goto e_inval;
@@ -1010,6 +1011,7 @@ mc_msf_out:
goto e_inval;
inet->mc_all = val;
break;
+#endif
case IP_ROUTER_ALERT:
err = ip_ra_control(sk, val ? 1 : 0, NULL);
break;
@@ -1248,6 +1250,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
case IP_RECVERR:
val = inet->recverr;
break;
+#ifdef CONFIG_IP_MULTICAST
case IP_MULTICAST_TTL:
val = inet->mc_ttl;
break;
@@ -1310,6 +1313,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
case IP_MULTICAST_ALL:
val = inet->mc_all;
break;
+#endif
case IP_PKTOPTIONS:
{
struct msghdr msg;
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 2110d2e..fe5823a 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -443,6 +443,7 @@ static struct ctl_table ipv4_table[] = {
.mode = 0644,
.proc_handler = proc_do_large_bitmap,
},
+#ifdef CONFIG_IP_MULTICAST
{
.procname = "igmp_max_memberships",
.data = &sysctl_igmp_max_memberships,
@@ -457,6 +458,7 @@ static struct ctl_table ipv4_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec
},
+#endif
{
.procname = "inet_peer_threshold",
.data = &inet_peer_threshold,
--
1.9.0
next prev parent reply other threads:[~2014-05-05 22:26 UTC|newest]
Thread overview: 124+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-05 22:25 RFC: A reduced Linux network stack for small systems Andi Kleen
2014-05-05 22:25 ` [PATCH 01/24] net, diet: Reduce netdev name hash table for CONFIG_BASE_SMALL Andi Kleen
2014-05-06 3:03 ` David Miller
2014-05-05 22:25 ` [PATCH 02/24] net, diet: Reduce NAPI " Andi Kleen
2014-05-05 22:25 ` [PATCH 03/24] net, diet: Decrease ip defrag hash tables and max length with BASE_SMALL Andi Kleen
2014-05-05 22:25 ` [PATCH 04/24] net, diet: Make FIB hash tables smaller with CONFIG_BASE_SMALL Andi Kleen
2014-05-06 3:10 ` David Miller
2014-05-05 22:25 ` [PATCH 05/24] net, diet: Default to small TCP hash tables on small kernels Andi Kleen
2014-05-06 3:12 ` David Miller
2014-05-05 22:25 ` [PATCH 06/24] net, diet: Use small UDP " Andi Kleen
2014-05-06 3:11 ` David Miller
2014-05-06 14:26 ` Eric Dumazet
2014-05-06 18:23 ` Andi Kleen
2014-05-06 19:25 ` Eric Dumazet
2014-05-05 22:25 ` [PATCH 07/24] net, diet: Make ping sockets optional Andi Kleen
2014-05-06 3:04 ` David Miller
2014-05-05 22:25 ` [PATCH 08/24] net, diet: Make TCP metrics optional Andi Kleen
2014-05-05 23:18 ` Yuchung Cheng
2014-05-05 23:28 ` Andi Kleen
2014-05-06 3:12 ` David Miller
2014-05-06 3:21 ` Andi Kleen
2014-05-06 3:23 ` David Miller
2014-05-06 4:39 ` Tom Zanussi
2014-05-07 13:59 ` One Thousand Gnomes
2014-05-07 17:20 ` David Miller
2014-05-07 22:19 ` Tim Bird
2014-05-07 22:52 ` David Miller
2014-05-06 15:57 ` josh
2014-05-06 15:59 ` David Miller
2014-05-06 16:41 ` josh
2014-05-06 17:12 ` Rick Jones
2014-05-06 18:09 ` josh
2014-05-06 17:16 ` David Miller
2014-05-06 17:55 ` josh
2014-05-06 18:33 ` Cong Wang
2014-05-06 18:48 ` Andi Kleen
2014-05-06 19:19 ` Richard Cochran
2014-05-06 20:44 ` David Miller
2014-05-06 21:08 ` josh
2014-05-06 21:11 ` David Miller
2014-05-06 22:50 ` josh
2014-05-06 23:27 ` Eric Dumazet
2014-06-14 20:33 ` Pavel Machek
2014-06-23 10:17 ` zhuyj
2014-05-06 19:14 ` Richard Cochran
2014-05-06 19:50 ` Andi Kleen
2014-05-06 20:07 ` Richard Cochran
2014-05-06 21:05 ` Andi Kleen
2014-05-06 23:29 ` Eric Dumazet
2014-05-07 4:33 ` Andi Kleen
2014-05-06 20:46 ` David Miller
2014-05-07 8:39 ` David Laight
2014-05-09 9:48 ` Pavel Machek
2014-05-06 16:39 ` Eric Dumazet
2014-05-06 16:45 ` josh
2014-05-06 17:03 ` Eric Dumazet
2014-05-06 17:30 ` josh
2014-05-06 17:17 ` David Miller
2014-05-06 17:21 ` josh
2014-05-06 17:25 ` David Miller
2014-05-06 20:06 ` Andi Kleen
2014-05-06 20:47 ` David Miller
2014-05-06 20:11 ` josh
2014-05-06 20:44 ` Andi Kleen
2014-05-06 17:14 ` David Miller
2014-05-06 18:32 ` Andi Kleen
2014-05-06 18:58 ` Tom Herbert
2014-05-06 19:37 ` josh
2014-05-06 19:57 ` Andi Kleen
2014-05-06 20:17 ` Eric Dumazet
2014-05-06 20:27 ` josh
2014-05-06 20:37 ` Andi Kleen
2014-05-06 20:48 ` David Miller
2014-05-07 13:35 ` One Thousand Gnomes
2014-05-13 16:22 ` Christer Weinigel
2014-05-09 7:38 ` Pavel Machek
2014-05-05 22:25 ` [PATCH 09/24] net, diet: Make ethtool optional Andi Kleen
2014-05-06 3:11 ` David Miller
2014-05-06 3:14 ` Andi Kleen
2014-05-06 3:22 ` David Miller
2014-05-05 22:25 ` [PATCH 10/24] net, diet: Make LPF filter optional Andi Kleen
2014-05-06 3:10 ` David Miller
2014-05-05 22:26 ` [PATCH 11/24] net, diet: Move rtnl_lock to separate file Andi Kleen
2014-05-05 22:26 ` [PATCH 12/24] net, diet: Make rtnetlink optional Andi Kleen
2014-05-06 3:08 ` David Miller
2014-05-06 3:11 ` Andi Kleen
2014-05-05 22:26 ` [PATCH 13/24] net, diet: Make GRO offload optional Andi Kleen
2014-05-06 3:01 ` David Miller
2014-05-06 3:03 ` Andi Kleen
2014-05-05 22:26 ` [PATCH 14/24] net, diet: Make MIB statistics collections depend on PROC_FS Andi Kleen
2014-05-06 3:05 ` David Miller
2014-05-05 22:26 ` Andi Kleen [this message]
2014-05-05 22:26 ` [PATCH 16/24] net, diet: Make TCP fastopen optional Andi Kleen
2014-05-06 3:06 ` David Miller
2014-05-05 22:26 ` [PATCH 17/24] net, diet: Make internal control sockets use UDP Andi Kleen
2014-05-05 22:26 ` [PATCH 18/24] net, diet: Make raw sockets optional Andi Kleen
2014-05-06 3:12 ` David Miller
2014-05-05 22:26 ` [PATCH 19/24] net, diet: Make RPS configurable Andi Kleen
2014-05-06 3:14 ` David Miller
2014-05-06 3:16 ` Andi Kleen
2014-05-06 8:32 ` Bjørn Mork
2014-05-05 22:26 ` [PATCH 20/24] net, diet: Make XPS configurable Andi Kleen
2014-05-05 22:26 ` [PATCH 21/24] net, diet: Make packet tpacket/mmap/fanout/rings optional Andi Kleen
2014-05-06 3:09 ` David Miller
2014-05-05 22:26 ` [PATCH 22/24] net, diet: Support simpler routing table Andi Kleen
2014-05-06 3:02 ` David Miller
2014-05-06 3:08 ` Andi Kleen
2014-05-06 3:21 ` David Miller
2014-05-05 22:26 ` [PATCH 23/24] net, diet: Add coccinelle script to convert drivers to ETHTOOL_OPS Andi Kleen
2014-05-06 9:27 ` Nicolas Palix
2014-05-06 15:05 ` David Miller
2014-05-07 0:18 ` Wilfried Klaebe
2014-05-05 22:26 ` [PATCH 24/24] net, diet: Convert all drivers to use SET_ETHTOOL_OPS Andi Kleen
2014-05-06 7:25 ` RFC: A reduced Linux network stack for small systems Richard Weinberger
2014-05-06 13:34 ` Tom Zanussi
2014-05-06 15:20 ` Alexei Starovoitov
2014-05-06 15:34 ` Tom Zanussi
2014-05-06 17:20 ` Alexei Starovoitov
2014-05-06 20:00 ` Andi Kleen
2014-05-06 21:05 ` Alexei Starovoitov
2014-05-09 7:39 ` Pavel Machek
2014-05-09 7:38 ` Pavel Machek
2014-05-06 9:18 ` David Laight
2014-05-07 13:20 ` One Thousand Gnomes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399328773-6531-16-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=ak@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tom.zanussi@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).