any working example of IPv6 /etc/hostname.carpXXX ?

2011-04-20 Thread Илья Шипицин
Dear Sirs,

I need to configure ipv6 over carp interface. It seems that carp doesn't
like things in one line


ifconfig carp470 vhid 70 pass xxx carpdev vlan470 advskew 20 inet6
2a00:1a70:80:470::2 prefixlen 128

it says something wrong about ipv6. don't have any idea why. so, one-line
config for hostname.carpXXX will not work.

if I do two ifconfigs:


ifconfig carp470 vhid 70 pass xxx carpdev vlan470 advskew 20
ifconfig carp470 inet6 2a00:1a70:80:470::2 prefixlen 128


everthing seems to be ok.

but if I put  stuff to hostname.carpXXX

r1n0:/root# cat
/etc/hostname.carp470

vhid 70 pass xxx carpdev vlan470 advskew 20
inet6 2a00:1a70:80:470::2 prefixlen 128
up


I got no ipv6 address and carp is in INIT state (no RUNNING flag).


is there a way to configure ipv6 + carp from /etc/hostname.XXX ?

Cheers,
Ilya Shipitsin



Re: any working example of IPv6 /etc/hostname.carpXXX ?

2011-04-23 Thread Stuart Henderson
On 2011-04-21,  ???  wrote:
> Dear Sirs,
>
> I need to configure ipv6 over carp interface. It seems that carp doesn't
> like things in one line
>
>
> ifconfig carp470 vhid 70 pass xxx carpdev vlan470 advskew 20 inet6
> 2a00:1a70:80:470::2 prefixlen 128
>
> it says something wrong about ipv6. don't have any idea why. so, one-line
> config for hostname.carpXXX will not work.
>
> if I do two ifconfigs:
>
>
> ifconfig carp470 vhid 70 pass xxx carpdev vlan470 advskew 20
> ifconfig carp470 inet6 2a00:1a70:80:470::2 prefixlen 128
>
>
> everthing seems to be ok.

Not really, it just sits in init unless you also configure a (possibly
dummy) ipv4 address.

> but if I put  stuff to hostname.carpXXX
>
> r1n0:/root# cat
> /etc/hostname.carp470
>
> vhid 70 pass xxx carpdev vlan470 advskew 20
> inet6 2a00:1a70:80:470::2 prefixlen 128
> up

bad syntax, should be

inet6 2a00:1a70:80:470::2 128

see hostname.if(5).

Same problem with needed a (possibly dummy) ipv4 address.
It certainly works fine with a v4 address in there.



Re: any working example of IPv6 /etc/hostname.carpXXX ?

2011-04-25 Thread Marco Pfatschbacher
On Sat, Apr 23, 2011 at 09:15:51PM +, Stuart Henderson wrote:
> On 2011-04-21,  ???  wrote:
> > Dear Sirs,
> >
> > I need to configure ipv6 over carp interface. It seems that carp doesn't
> > like things in one line
> >
> >
> > ifconfig carp470 vhid 70 pass xxx carpdev vlan470 advskew 20 inet6
> > 2a00:1a70:80:470::2 prefixlen 128
> >
> > it says something wrong about ipv6. don't have any idea why. so, one-line
> > config for hostname.carpXXX will not work.
> >
> > if I do two ifconfigs:
> >
> >
> > ifconfig carp470 vhid 70 pass xxx carpdev vlan470 advskew 20
> > ifconfig carp470 inet6 2a00:1a70:80:470::2 prefixlen 128
> >
> >
> > everthing seems to be ok.
> 
> Not really, it just sits in init unless you also configure a (possibly
> dummy) ipv4 address.
 
This is a bug in -current. I broke IPv6-only setups.


Index: ip_carp.c
===
RCS file: /cvs/src/sys/netinet/ip_carp.c,v
retrieving revision 1.181
diff -p -u -p -u -r1.181 ip_carp.c
--- ip_carp.c   8 Mar 2011 22:53:28 -   1.181
+++ ip_carp.c   22 Apr 2011 12:19:01 -
@@ -902,6 +902,11 @@ carp_clone_create(ifc, unit)
 #if NBPFILTER > 0
bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB, ETHER_HDR_LEN);
 #endif
+
+   /* Hook carp_addr_updated to cope with address and route changes */
+   if (sc->ah_cookie == NULL)
+   sc->ah_cookie = hook_establish(sc->sc_if.if_addrhooks, 0,
+   carp_addr_updated, sc);
return (0);
 }
 
@@ -2039,14 +2044,6 @@ carp_set_addr(struct carp_softc *sc, str
 
carp_set_state_all(sc, INIT);
 
-   /*
-* Hook if_addrhooks so that we get a callback after in_ifinit has run,
-* to correct any inappropriate routes that it inserted.
-*/
-   if (sc->ah_cookie == NULL)
-   sc->ah_cookie = hook_establish(sc->sc_if.if_addrhooks, 0,
-   carp_addr_updated, sc);
-
return (0);
 }
 
@@ -2131,10 +2128,10 @@ carp_set_addr6(struct carp_softc *sc, st
if (sc->sc_naddrs6 == 0 && (error = carp_join_multicast6(sc)) != 0)
return (error);
 
-   if (sc->sc_carpdev != NULL && sc->sc_naddrs6)
+   if (sc->sc_carpdev != NULL)
sc->sc_if.if_flags |= IFF_UP;
+
carp_set_state_all(sc, INIT);
-   carp_setrun_all(sc, 0);
 
return (0);
 }