iproute2: Fix batch-mode for mrules.
Subsystems (2)
The do_multirule logic was broken in batch mode because it expected the preferred_family to be AF_INET or AF_INET6, but it then assigned it to RTNL_FAMILY_IPMR or RTNL_FAMILY_IP6MR. So, the next iteration of the batch processing, it failed the check for AF_INET or AF_INET6.
---
:100644 100644 9c8c6ef... d3b97e2... M ip/iprule.c
ip/iprule.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
ip/iprule.c +5 -1
@@ -446,8 +446,12 @@ int do_multirule(int argc, char **argv)case AF_INET6 : preferred_family =RTNL_FAMILY_IP6MR ;break ; +case RTNL_FAMILY_IPMR : +case RTNL_FAMILY_IP6MR : +break ;default : -fprintf (stderr,"Multicast rules are only supported for IPv4/IPv6\n" ); +fprintf (stderr,"Multicast rules are only supported for IPv4/IPv6, was: %i\n" , + preferred_family);exit (-1 ); }
Signature · 1 line
1.6.2.5
Stephen Hemminger
AppliedQuoted 20 lines · On Thu, 15 Jul 2010 15:48:10 -0700 Ben Greear <[email protected]> wrote:
The
do_multirulelogic was broken in batch mode because it expected thepreferred_familyto beAF_INETorAF_INET6, but it then assigned it toRTNL_FAMILY_IPMRorRTNL_FAMILY_IP6MR. So, the next iteration of the batch processing, it failed the check forAF_INETorAF_INET6.Signed-off-by Ben Greear <[email protected]>---
:100644 100644 9c8c6ef... d3b97e2... Mip/iprule.cip/iprule.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)ip/iprule.c +0
-0@@ -446,8 +446,12 @@ int do_multirule(int argc, char **argv)case AF_INET6 : preferred_family =RTNL_FAMILY_IP6MR ;break ;
ip/iprule.c int do_multirule(int argc, char **argv) · line 457
Quoted 10 lines
ip/iprule.c +5
-1+case RTNL_FAMILY_IPMR : +case RTNL_FAMILY_IP6MR : +break ;default : -fprintf (stderr,"Multicast rules are only supported for IPv4/IPv6\n" ); +fprintf (stderr,"Multicast rules are only supported for IPv4/IPv6, was: %i\n" , + preferred_family);exit (-1 ); }
Applied
Quoted 27 lines · Stephen Hemminger
Quoted 24 lines · On Thu, 15 Jul 2010 15:48:10 -0700 Ben Greear<[email protected]> wrote:
The
do_multirulelogic was broken in batch mode because it expected thepreferred_familyto beAF_INETorAF_INET6, but it then assigned it toRTNL_FAMILY_IPMRorRTNL_FAMILY_IP6MR. So, the next iteration of the batch processing, it failed the check forAF_INETorAF_INET6.Signed-off-by Ben Greear<[email protected]>---
:100644 100644 9c8c6ef... d3b97e2... Mip/iprule.cip/iprule.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)ip/iprule.c +3
-0@@ -446,8 +446,12 @@ int do_multirule(int argc, char **argv)case AF_INET6 : preferred_family =RTNL_FAMILY_IP6MR ;break ; +case RTNL_FAMILY_IPMR : +case RTNL_FAMILY_IP6MR : +break ;default :
Quoted 8 lines
ip/iprule.c int do_multirule(int argc, char **argv) · line 457
Quoted 6 lines
ip/iprule.c +2
-1-fprintf (stderr,"Multicast rules are only supported for IPv4/IPv6\n" ); +fprintf (stderr,"Multicast rules are only supported for IPv4/IPv6, was: %i\n" , + preferred_family);exit (-1 ); }Applied
Thanks. I recently realized this patch is not quite enough for full flexibility.
It does help the case where you have 'normal' cmds followed by mrule commands, but it doesn't fix the case where you have 'normal' commands after the mrule commands.
I was thinking maybe we should pass the preferred_family in as an argument to the method(s) instead of twiddling the global value?
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com