| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  *	inet6 interface/address list definitions | 
					
						
							|  |  |  |  *	Linux INET6 implementation  | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *	Authors: | 
					
						
							|  |  |  |  *	Pedro Roque		<roque@di.fc.ul.pt>	 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *	This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  *      modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  *      as published by the Free Software Foundation; either version | 
					
						
							|  |  |  |  *      2 of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef _NET_IF_INET6_H
 | 
					
						
							|  |  |  | #define _NET_IF_INET6_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <net/snmp.h>
 | 
					
						
							|  |  |  | #include <linux/ipv6.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* inet6_dev.if_flags */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define IF_RA_OTHERCONF	0x80
 | 
					
						
							|  |  |  | #define IF_RA_MANAGED	0x40
 | 
					
						
							|  |  |  | #define IF_RA_RCVD	0x20
 | 
					
						
							|  |  |  | #define IF_RS_SENT	0x10
 | 
					
						
							| 
									
										
										
										
											2005-12-21 22:57:24 +09:00
										 |  |  | #define IF_READY	0x80000000
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* prefix flags */ | 
					
						
							|  |  |  | #define IF_PREFIX_ONLINK	0x01
 | 
					
						
							|  |  |  | #define IF_PREFIX_AUTOCONF	0x02
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-18 15:36:06 -07:00
										 |  |  | enum { | 
					
						
							| 
									
										
										
										
											2014-03-27 18:28:07 +01:00
										 |  |  | 	INET6_IFADDR_STATE_PREDAD, | 
					
						
							| 
									
										
										
										
											2010-05-18 15:36:06 -07:00
										 |  |  | 	INET6_IFADDR_STATE_DAD, | 
					
						
							|  |  |  | 	INET6_IFADDR_STATE_POSTDAD, | 
					
						
							| 
									
										
										
										
											2014-03-27 18:28:07 +01:00
										 |  |  | 	INET6_IFADDR_STATE_ERRDAD, | 
					
						
							| 
									
										
										
										
											2010-05-18 15:36:06 -07:00
										 |  |  | 	INET6_IFADDR_STATE_UP, | 
					
						
							|  |  |  | 	INET6_IFADDR_STATE_DEAD, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-03 03:26:03 +00:00
										 |  |  | struct inet6_ifaddr { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct in6_addr		addr; | 
					
						
							|  |  |  | 	__u32			prefix_len; | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2011-07-26 13:50:49 +00:00
										 |  |  | 	/* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	__u32			valid_lft; | 
					
						
							|  |  |  | 	__u32			prefered_lft; | 
					
						
							|  |  |  | 	atomic_t		refcnt; | 
					
						
							|  |  |  | 	spinlock_t		lock; | 
					
						
							| 
									
										
										
										
											2010-05-18 15:36:06 -07:00
										 |  |  | 	spinlock_t		state_lock; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int			state; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-06 09:45:21 +01:00
										 |  |  | 	__u32			flags; | 
					
						
							| 
									
										
										
										
											2013-06-23 18:39:01 +02:00
										 |  |  | 	__u8			dad_probes; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	__u16			scope; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-21 13:29:05 -07:00
										 |  |  | 	unsigned long		cstamp;	/* created timestamp */ | 
					
						
							|  |  |  | 	unsigned long		tstamp; /* updated timestamp */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-27 18:28:07 +01:00
										 |  |  | 	struct delayed_work	dad_work; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	struct inet6_dev	*idev; | 
					
						
							|  |  |  | 	struct rt6_info		*rt; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-17 20:31:10 +00:00
										 |  |  | 	struct hlist_node	addr_lst; | 
					
						
							| 
									
										
										
										
											2010-03-17 20:31:13 +00:00
										 |  |  | 	struct list_head	if_list; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-17 20:31:09 +00:00
										 |  |  | 	struct list_head	tmp_list; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct inet6_ifaddr	*ifpub; | 
					
						
							|  |  |  | 	int			regen_count; | 
					
						
							| 
									
										
										
										
											2013-10-28 20:07:50 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-09 03:47:16 +00:00
										 |  |  | 	bool			tokenized; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-17 20:31:11 +00:00
										 |  |  | 	struct rcu_head		rcu; | 
					
						
							| 
									
										
										
										
											2013-05-16 22:32:00 +00:00
										 |  |  | 	struct in6_addr		peer_addr; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-03 03:26:03 +00:00
										 |  |  | struct ip6_sf_socklist { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned int		sl_max; | 
					
						
							|  |  |  | 	unsigned int		sl_count; | 
					
						
							|  |  |  | 	struct in6_addr		sl_addr[0]; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define IP6_SFLSIZE(count)	(sizeof(struct ip6_sf_socklist) + \
 | 
					
						
							|  |  |  | 	(count) * sizeof(struct in6_addr)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define IP6_SFBLOCK	10	/* allocate this many at once */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-03 03:26:03 +00:00
										 |  |  | struct ipv6_mc_socklist { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct in6_addr		addr; | 
					
						
							|  |  |  | 	int			ifindex; | 
					
						
							| 
									
										
										
										
											2010-11-23 13:12:15 +00:00
										 |  |  | 	struct ipv6_mc_socklist __rcu *next; | 
					
						
							| 
									
										
										
										
											2005-12-27 14:03:00 -08:00
										 |  |  | 	rwlock_t		sflock; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned int		sfmode;		/* MCAST_{INCLUDE,EXCLUDE} */ | 
					
						
							|  |  |  | 	struct ip6_sf_socklist	*sflist; | 
					
						
							| 
									
										
										
										
											2010-11-23 13:12:15 +00:00
										 |  |  | 	struct rcu_head		rcu; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-03 03:26:03 +00:00
										 |  |  | struct ip6_sf_list { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct ip6_sf_list	*sf_next; | 
					
						
							|  |  |  | 	struct in6_addr		sf_addr; | 
					
						
							|  |  |  | 	unsigned long		sf_count[2];	/* include/exclude counts */ | 
					
						
							|  |  |  | 	unsigned char		sf_gsresp;	/* include in g & s response? */ | 
					
						
							|  |  |  | 	unsigned char		sf_oldin;	/* change state */ | 
					
						
							|  |  |  | 	unsigned char		sf_crcount;	/* retrans. left to send */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define MAF_TIMER_RUNNING	0x01
 | 
					
						
							|  |  |  | #define MAF_LAST_REPORTER	0x02
 | 
					
						
							|  |  |  | #define MAF_LOADED		0x04
 | 
					
						
							|  |  |  | #define MAF_NOREPORT		0x08
 | 
					
						
							|  |  |  | #define MAF_GSQUERY		0x10
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-03 03:26:03 +00:00
										 |  |  | struct ifmcaddr6 { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct in6_addr		mca_addr; | 
					
						
							|  |  |  | 	struct inet6_dev	*idev; | 
					
						
							|  |  |  | 	struct ifmcaddr6	*next; | 
					
						
							|  |  |  | 	struct ip6_sf_list	*mca_sources; | 
					
						
							|  |  |  | 	struct ip6_sf_list	*mca_tomb; | 
					
						
							|  |  |  | 	unsigned int		mca_sfmode; | 
					
						
							| 
									
										
										
										
											2008-02-03 04:09:17 -08:00
										 |  |  | 	unsigned char		mca_crcount; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned long		mca_sfcount[2]; | 
					
						
							|  |  |  | 	struct timer_list	mca_timer; | 
					
						
							| 
									
										
										
										
											2012-04-15 05:58:06 +00:00
										 |  |  | 	unsigned int		mca_flags; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	int			mca_users; | 
					
						
							|  |  |  | 	atomic_t		mca_refcnt; | 
					
						
							|  |  |  | 	spinlock_t		mca_lock; | 
					
						
							|  |  |  | 	unsigned long		mca_cstamp; | 
					
						
							|  |  |  | 	unsigned long		mca_tstamp; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Anycast stuff */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-03 03:26:03 +00:00
										 |  |  | struct ipv6_ac_socklist { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct in6_addr		acl_addr; | 
					
						
							|  |  |  | 	int			acl_ifindex; | 
					
						
							|  |  |  | 	struct ipv6_ac_socklist *acl_next; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-03 03:26:03 +00:00
										 |  |  | struct ifacaddr6 { | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct in6_addr		aca_addr; | 
					
						
							|  |  |  | 	struct inet6_dev	*aca_idev; | 
					
						
							|  |  |  | 	struct rt6_info		*aca_rt; | 
					
						
							|  |  |  | 	struct ifacaddr6	*aca_next; | 
					
						
							|  |  |  | 	int			aca_users; | 
					
						
							|  |  |  | 	atomic_t		aca_refcnt; | 
					
						
							|  |  |  | 	spinlock_t		aca_lock; | 
					
						
							|  |  |  | 	unsigned long		aca_cstamp; | 
					
						
							|  |  |  | 	unsigned long		aca_tstamp; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define	IFA_HOST	IPV6_ADDR_LOOPBACK
 | 
					
						
							|  |  |  | #define	IFA_LINK	IPV6_ADDR_LINKLOCAL
 | 
					
						
							|  |  |  | #define	IFA_SITE	IPV6_ADDR_SITELOCAL
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct ipv6_devstat { | 
					
						
							|  |  |  | 	struct proc_dir_entry	*proc_dir_entry; | 
					
						
							| 
									
										
										
										
											2006-11-04 20:11:37 +09:00
										 |  |  | 	DEFINE_SNMP_STAT(struct ipstats_mib, ipv6); | 
					
						
							| 
									
										
										
										
											2011-05-19 01:14:23 +00:00
										 |  |  | 	DEFINE_SNMP_STAT_ATOMIC(struct icmpv6_mib_device, icmpv6dev); | 
					
						
							|  |  |  | 	DEFINE_SNMP_STAT_ATOMIC(struct icmpv6msg_mib_device, icmpv6msgdev); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-03 03:26:03 +00:00
										 |  |  | struct inet6_dev { | 
					
						
							| 
									
										
										
										
											2010-03-17 20:31:13 +00:00
										 |  |  | 	struct net_device	*dev; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-17 20:31:13 +00:00
										 |  |  | 	struct list_head	addr_list; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	struct ifmcaddr6	*mc_list; | 
					
						
							|  |  |  | 	struct ifmcaddr6	*mc_tomb; | 
					
						
							| 
									
										
										
										
											2010-02-17 18:48:44 -08:00
										 |  |  | 	spinlock_t		mc_lock; | 
					
						
							| 
									
										
											  
											
												net: ipv6: mld: fix v1/v2 switchback timeout to rfc3810, 9.12.
i) RFC3810, 9.2. Query Interval [QI] says:
   The Query Interval variable denotes the interval between General
   Queries sent by the Querier. Default value: 125 seconds. [...]
ii) RFC3810, 9.3. Query Response Interval [QRI] says:
  The Maximum Response Delay used to calculate the Maximum Response
  Code inserted into the periodic General Queries. Default value:
  10000 (10 seconds) [...] The number of seconds represented by the
  [Query Response Interval] must be less than the [Query Interval].
iii) RFC3810, 9.12. Older Version Querier Present Timeout [OVQPT] says:
  The Older Version Querier Present Timeout is the time-out for
  transitioning a host back to MLDv2 Host Compatibility Mode. When an
  MLDv1 query is received, MLDv2 hosts set their Older Version Querier
  Present Timer to [Older Version Querier Present Timeout].
  This value MUST be ([Robustness Variable] times (the [Query Interval]
  in the last Query received)) plus ([Query Response Interval]).
Hence, on *default* the timeout results in:
  [RV] = 2, [QI] = 125sec, [QRI] = 10sec
  [OVQPT] = [RV] * [QI] + [QRI] = 260sec
Having that said, we currently calculate [OVQPT] (here given as 'switchback'
variable) as ...
  switchback = (idev->mc_qrv + 1) * max_delay
RFC3810, 9.12. says "the [Query Interval] in the last Query received". In
section "9.14. Configuring timers", it is said:
  This section is meant to provide advice to network administrators on
  how to tune these settings to their network. Ambitious router
  implementations might tune these settings dynamically based upon
  changing characteristics of the network. [...]
iv) RFC38010, 9.14.2. Query Interval:
  The overall level of periodic MLD traffic is inversely proportional
  to the Query Interval. A longer Query Interval results in a lower
  overall level of MLD traffic. The value of the Query Interval MUST
  be equal to or greater than the Maximum Response Delay used to
  calculate the Maximum Response Code inserted in General Query
  messages.
I assume that was why switchback is calculated as is (3 * max_delay), although
this setting seems to be meant for routers only to configure their [QI]
interval for non-default intervals. So usage here like this is clearly wrong.
Concluding, the current behaviour in IPv6's multicast code is not conform
to the RFC as switch back is calculated wrongly. That is, it has a too small
value, so MLDv2 hosts switch back again to MLDv2 way too early, i.e. ~30secs
instead of ~260secs on default.
Hence, introduce necessary helper functions and fix this up properly as it
should be.
Introduced in 06da92283 ("[IPV6]: Add MLDv2 support."). Credits to Hannes
Frederic Sowa who also had a hand in this as well. Also thanks to Hangbin Liu
who did initial testing.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: David Stevens <dlstevens@us.ibm.com>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
											
										 
											2013-09-04 00:19:37 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	unsigned char		mc_qrv;		/* Query Robustness Variable */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned char		mc_gq_running; | 
					
						
							|  |  |  | 	unsigned char		mc_ifc_count; | 
					
						
							| 
									
										
										
										
											2013-06-27 00:07:01 +02:00
										 |  |  | 	unsigned char		mc_dad_count; | 
					
						
							| 
									
										
											  
											
												net: ipv6: mld: fix v1/v2 switchback timeout to rfc3810, 9.12.
i) RFC3810, 9.2. Query Interval [QI] says:
   The Query Interval variable denotes the interval between General
   Queries sent by the Querier. Default value: 125 seconds. [...]
ii) RFC3810, 9.3. Query Response Interval [QRI] says:
  The Maximum Response Delay used to calculate the Maximum Response
  Code inserted into the periodic General Queries. Default value:
  10000 (10 seconds) [...] The number of seconds represented by the
  [Query Response Interval] must be less than the [Query Interval].
iii) RFC3810, 9.12. Older Version Querier Present Timeout [OVQPT] says:
  The Older Version Querier Present Timeout is the time-out for
  transitioning a host back to MLDv2 Host Compatibility Mode. When an
  MLDv1 query is received, MLDv2 hosts set their Older Version Querier
  Present Timer to [Older Version Querier Present Timeout].
  This value MUST be ([Robustness Variable] times (the [Query Interval]
  in the last Query received)) plus ([Query Response Interval]).
Hence, on *default* the timeout results in:
  [RV] = 2, [QI] = 125sec, [QRI] = 10sec
  [OVQPT] = [RV] * [QI] + [QRI] = 260sec
Having that said, we currently calculate [OVQPT] (here given as 'switchback'
variable) as ...
  switchback = (idev->mc_qrv + 1) * max_delay
RFC3810, 9.12. says "the [Query Interval] in the last Query received". In
section "9.14. Configuring timers", it is said:
  This section is meant to provide advice to network administrators on
  how to tune these settings to their network. Ambitious router
  implementations might tune these settings dynamically based upon
  changing characteristics of the network. [...]
iv) RFC38010, 9.14.2. Query Interval:
  The overall level of periodic MLD traffic is inversely proportional
  to the Query Interval. A longer Query Interval results in a lower
  overall level of MLD traffic. The value of the Query Interval MUST
  be equal to or greater than the Maximum Response Delay used to
  calculate the Maximum Response Code inserted in General Query
  messages.
I assume that was why switchback is calculated as is (3 * max_delay), although
this setting seems to be meant for routers only to configure their [QI]
interval for non-default intervals. So usage here like this is clearly wrong.
Concluding, the current behaviour in IPv6's multicast code is not conform
to the RFC as switch back is calculated wrongly. That is, it has a too small
value, so MLDv2 hosts switch back again to MLDv2 way too early, i.e. ~30secs
instead of ~260secs on default.
Hence, introduce necessary helper functions and fix this up properly as it
should be.
Introduced in 06da92283 ("[IPV6]: Add MLDv2 support."). Credits to Hannes
Frederic Sowa who also had a hand in this as well. Also thanks to Hangbin Liu
who did initial testing.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: David Stevens <dlstevens@us.ibm.com>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
											
										 
											2013-09-04 00:19:37 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	unsigned long		mc_v1_seen;	/* Max time we stay in MLDv1 mode */ | 
					
						
							|  |  |  | 	unsigned long		mc_qi;		/* Query Interval */ | 
					
						
							|  |  |  | 	unsigned long		mc_qri;		/* Query Response Interval */ | 
					
						
							| 
									
										
										
										
											2008-02-03 04:06:59 -08:00
										 |  |  | 	unsigned long		mc_maxdelay; | 
					
						
							| 
									
										
											  
											
												net: ipv6: mld: fix v1/v2 switchback timeout to rfc3810, 9.12.
i) RFC3810, 9.2. Query Interval [QI] says:
   The Query Interval variable denotes the interval between General
   Queries sent by the Querier. Default value: 125 seconds. [...]
ii) RFC3810, 9.3. Query Response Interval [QRI] says:
  The Maximum Response Delay used to calculate the Maximum Response
  Code inserted into the periodic General Queries. Default value:
  10000 (10 seconds) [...] The number of seconds represented by the
  [Query Response Interval] must be less than the [Query Interval].
iii) RFC3810, 9.12. Older Version Querier Present Timeout [OVQPT] says:
  The Older Version Querier Present Timeout is the time-out for
  transitioning a host back to MLDv2 Host Compatibility Mode. When an
  MLDv1 query is received, MLDv2 hosts set their Older Version Querier
  Present Timer to [Older Version Querier Present Timeout].
  This value MUST be ([Robustness Variable] times (the [Query Interval]
  in the last Query received)) plus ([Query Response Interval]).
Hence, on *default* the timeout results in:
  [RV] = 2, [QI] = 125sec, [QRI] = 10sec
  [OVQPT] = [RV] * [QI] + [QRI] = 260sec
Having that said, we currently calculate [OVQPT] (here given as 'switchback'
variable) as ...
  switchback = (idev->mc_qrv + 1) * max_delay
RFC3810, 9.12. says "the [Query Interval] in the last Query received". In
section "9.14. Configuring timers", it is said:
  This section is meant to provide advice to network administrators on
  how to tune these settings to their network. Ambitious router
  implementations might tune these settings dynamically based upon
  changing characteristics of the network. [...]
iv) RFC38010, 9.14.2. Query Interval:
  The overall level of periodic MLD traffic is inversely proportional
  to the Query Interval. A longer Query Interval results in a lower
  overall level of MLD traffic. The value of the Query Interval MUST
  be equal to or greater than the Maximum Response Delay used to
  calculate the Maximum Response Code inserted in General Query
  messages.
I assume that was why switchback is calculated as is (3 * max_delay), although
this setting seems to be meant for routers only to configure their [QI]
interval for non-default intervals. So usage here like this is clearly wrong.
Concluding, the current behaviour in IPv6's multicast code is not conform
to the RFC as switch back is calculated wrongly. That is, it has a too small
value, so MLDv2 hosts switch back again to MLDv2 way too early, i.e. ~30secs
instead of ~260secs on default.
Hence, introduce necessary helper functions and fix this up properly as it
should be.
Introduced in 06da92283 ("[IPV6]: Add MLDv2 support."). Credits to Hannes
Frederic Sowa who also had a hand in this as well. Also thanks to Hangbin Liu
who did initial testing.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: David Stevens <dlstevens@us.ibm.com>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
											
										 
											2013-09-04 00:19:37 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct timer_list	mc_gq_timer;	/* general query timer */ | 
					
						
							|  |  |  | 	struct timer_list	mc_ifc_timer;	/* interface change timer */ | 
					
						
							| 
									
										
										
										
											2013-06-27 00:07:01 +02:00
										 |  |  | 	struct timer_list	mc_dad_timer;	/* dad complete mc timer */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	struct ifacaddr6	*ac_list; | 
					
						
							|  |  |  | 	rwlock_t		lock; | 
					
						
							|  |  |  | 	atomic_t		refcnt; | 
					
						
							|  |  |  | 	__u32			if_flags; | 
					
						
							|  |  |  | 	int			dead; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	u8			rndid[8]; | 
					
						
							|  |  |  | 	struct timer_list	regen_timer; | 
					
						
							| 
									
										
										
										
											2010-03-17 20:31:09 +00:00
										 |  |  | 	struct list_head	tempaddr_list; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												net: ipv6: add tokenized interface identifier support
This patch adds support for IPv6 tokenized IIDs, that allow
for administrators to assign well-known host-part addresses
to nodes whilst still obtaining global network prefix from
Router Advertisements. It is currently in draft status.
  The primary target for such support is server platforms
  where addresses are usually manually configured, rather
  than using DHCPv6 or SLAAC. By using tokenised identifiers,
  hosts can still determine their network prefix by use of
  SLAAC, but more readily be automatically renumbered should
  their network prefix change. [...]
  The disadvantage with static addresses is that they are
  likely to require manual editing should the network prefix
  in use change.  If instead there were a method to only
  manually configure the static identifier part of the IPv6
  address, then the address could be automatically updated
  when a new prefix was introduced, as described in [RFC4192]
  for example.  In such cases a DNS server might be
  configured with such a tokenised interface identifier of
  ::53, and SLAAC would use the token in constructing the
  interface address, using the advertised prefix. [...]
  http://tools.ietf.org/html/draft-chown-6man-tokenised-ipv6-identifiers-02
The implementation is partially based on top of Mark K.
Thompson's proof of concept. However, it uses the Netlink
interface for configuration resp. data retrival, so that
it can be easily extended in future. Successfully tested
by myself.
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
											
										 
											2013-04-08 04:01:30 +00:00
										 |  |  | 	struct in6_addr		token; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	struct neigh_parms	*nd_parms; | 
					
						
							|  |  |  | 	struct ipv6_devconf	cnf; | 
					
						
							|  |  |  | 	struct ipv6_devstat	stats; | 
					
						
							| 
									
										
										
										
											2013-06-23 18:39:01 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	struct timer_list	rs_timer; | 
					
						
							|  |  |  | 	__u8			rs_probes; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	unsigned long		tstamp; /* ipv6InterfaceTable update timestamp */ | 
					
						
							| 
									
										
										
										
											2006-09-22 14:44:24 -07:00
										 |  |  | 	struct rcu_head		rcu; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-22 04:53:02 +00:00
										 |  |  | static inline void ipv6_eth_mc_map(const struct in6_addr *addr, char *buf) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 *	+-------+-------+-------+-------+-------+-------+ | 
					
						
							|  |  |  | 	 *      |   33  |   33  | DST13 | DST14 | DST15 | DST16 | | 
					
						
							|  |  |  | 	 *      +-------+-------+-------+-------+-------+-------+ | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	buf[0]= 0x33; | 
					
						
							|  |  |  | 	buf[1]= 0x33; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline void ipv6_arcnet_mc_map(const struct in6_addr *addr, char *buf) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	buf[0] = 0x00; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-10 13:38:41 -07:00
										 |  |  | static inline void ipv6_ib_mc_map(const struct in6_addr *addr, | 
					
						
							|  |  |  | 				  const unsigned char *broadcast, char *buf) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-12-10 13:38:41 -07:00
										 |  |  | 	unsigned char scope = broadcast[5] & 0xF; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	buf[0]  = 0;		/* Reserved */ | 
					
						
							|  |  |  | 	buf[1]  = 0xff;		/* Multicast QPN */ | 
					
						
							|  |  |  | 	buf[2]  = 0xff; | 
					
						
							|  |  |  | 	buf[3]  = 0xff; | 
					
						
							|  |  |  | 	buf[4]  = 0xff; | 
					
						
							| 
									
										
										
										
											2007-12-10 13:38:41 -07:00
										 |  |  | 	buf[5]  = 0x10 | scope;	/* scope from broadcast address */ | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	buf[6]  = 0x60;		/* IPv6 signature */ | 
					
						
							|  |  |  | 	buf[7]  = 0x1b; | 
					
						
							| 
									
										
										
										
											2007-12-10 13:38:41 -07:00
										 |  |  | 	buf[8]  = broadcast[8];	/* P_Key */ | 
					
						
							|  |  |  | 	buf[9]  = broadcast[9]; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	memcpy(buf + 10, addr->s6_addr + 6, 10); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2011-03-28 22:40:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | static inline int ipv6_ipgre_mc_map(const struct in6_addr *addr, | 
					
						
							|  |  |  | 				    const unsigned char *broadcast, char *buf) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0) { | 
					
						
							|  |  |  | 		memcpy(buf, broadcast, 4); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		/* v4mapped? */ | 
					
						
							|  |  |  | 		if ((addr->s6_addr32[0] | addr->s6_addr32[1] | | 
					
						
							|  |  |  | 		     (addr->s6_addr32[2] ^ htonl(0x0000ffff))) != 0) | 
					
						
							|  |  |  | 			return -EINVAL; | 
					
						
							|  |  |  | 		memcpy(buf, &addr->s6_addr32[3], 4); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 |