Re: fix carp "carppeer" + "real mac-address"
On Mon, Oct 24, 2016 at 12:04:37PM +0900, YASUOKA Masahiko wrote: > FYI. I just commited regress tests on regress/netinet/carp/ . > carp_4.sh demostrates the problem which the diff fixes. root@ot1:.../carp# make ksh /usr/src/regress/sys/netinet/carp/carp_1.sh -R "11 12" -I "11 12" ksh /usr/src/regress/sys/netinet/carp/carp_2.sh -R "11 12" -I "11 12" ksh /usr/src/regress/sys/netinet/carp/carp_3.sh -R "11 12" -I "11 12" ksh /usr/src/regress/sys/netinet/carp/carp_4.sh -R "11 12" -I "11 12" *** Error 1 in . (Makefile:13 'carp_4') FAILED *** Error 1 in target 'regress' (ignored) A test that does not print a reason when it fails is hard to debug. Even with -v it becomes not clear why it fails. You may want to print the failed condition when you do FAILS=$((FAILS + 1)). > On Tue, 18 Oct 2016 19:33:01 +0900 (JST) > YASUOKA Masahiko wrote: > > Currenlty when carppeer + "real mac-address" are used at once, > > changing MASTER by carpdemote causes "MASTER-MASTER" problem, BACKUP > > is to become MASTER but the present MASTER also will keep its state. > > > > The diff following will fix this problem. > > > > ok? I cannot see a downside of accepting such a packet. OK bluhm@ > > > > Accept CARP advertisement packets whose destination is not for multicast. > > When both "carppeer" and "real mac-address" are used at once and the > > BACKUP is to take over the new MASTER, the present MASTER receives > > such packets. > > > > found by and diff from nagasaka at iij > > > > diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c > > index 9eb5552..bfbf430 100644 > > --- a/sys/netinet/ip_carp.c > > +++ b/sys/netinet/ip_carp.c > > @@ -453,7 +453,7 @@ carp_proto_input_if(struct ifnet *ifp, struct mbuf *m, > > int hlen) > > ismulti = IN_MULTICAST(ip->ip_dst.s_addr); > > > > /* check if received on a valid carp interface */ > > - if (!((ifp->if_type == IFT_CARP && ismulti) || > > + if (!(ifp->if_type == IFT_CARP || > > (ifp->if_type != IFT_CARP && !ismulti && ifp->if_carp != NULL))) { > > carpstats.carps_badif++; > > CARP_LOG(LOG_INFO, sc, > >
Re: fix carp "carppeer" + "real mac-address"
FYI. I just commited regress tests on regress/netinet/carp/ . carp_4.sh demostrates the problem which the diff fixes. On Tue, 18 Oct 2016 19:33:01 +0900 (JST) YASUOKA Masahiko wrote: > Currenlty when carppeer + "real mac-address" are used at once, > changing MASTER by carpdemote causes "MASTER-MASTER" problem, BACKUP > is to become MASTER but the present MASTER also will keep its state. > > The diff following will fix this problem. > > ok? > > Accept CARP advertisement packets whose destination is not for multicast. > When both "carppeer" and "real mac-address" are used at once and the > BACKUP is to take over the new MASTER, the present MASTER receives > such packets. > > found by and diff from nagasaka at iij > > diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c > index 9eb5552..bfbf430 100644 > --- a/sys/netinet/ip_carp.c > +++ b/sys/netinet/ip_carp.c > @@ -453,7 +453,7 @@ carp_proto_input_if(struct ifnet *ifp, struct mbuf *m, > int hlen) > ismulti = IN_MULTICAST(ip->ip_dst.s_addr); > > /* check if received on a valid carp interface */ > - if (!((ifp->if_type == IFT_CARP && ismulti) || > + if (!(ifp->if_type == IFT_CARP || > (ifp->if_type != IFT_CARP && !ismulti && ifp->if_carp != NULL))) { > carpstats.carps_badif++; > CARP_LOG(LOG_INFO, sc, >
fix carp "carppeer" + "real mac-address"
Hi, Currenlty when carppeer + "real mac-address" are used at once, changing MASTER by carpdemote causes "MASTER-MASTER" problem, BACKUP is to become MASTER but the present MASTER also will keep its state. The diff following will fix this problem. ok? Accept CARP advertisement packets whose destination is not for multicast. When both "carppeer" and "real mac-address" are used at once and the BACKUP is to take over the new MASTER, the present MASTER receives such packets. found by and diff from nagasaka at iij diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 9eb5552..bfbf430 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -453,7 +453,7 @@ carp_proto_input_if(struct ifnet *ifp, struct mbuf *m, int hlen) ismulti = IN_MULTICAST(ip->ip_dst.s_addr); /* check if received on a valid carp interface */ - if (!((ifp->if_type == IFT_CARP && ismulti) || + if (!(ifp->if_type == IFT_CARP || (ifp->if_type != IFT_CARP && !ismulti && ifp->if_carp != NULL))) { carpstats.carps_badif++; CARP_LOG(LOG_INFO, sc,