There are no available options for this view.

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by zul_, Sat Sep 30 22:53:35 2006 UTC revision 1.3 by zul_, Mon Nov 13 20:57:29 2006 UTC
# Line 1  Line 1 
1  /*      $NetBSD: ip_carp.c,v 1.5 2006/07/23 22:06:13 ad Exp $   */  /*      $NetBSD: ip_carp.c,v 1.9 2006/10/30 00:58:21 christos Exp $     */
2  /*      $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $   */  /*      $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $   */
3    
4  /*  /*
# Line 513  Line 513 
513    
514  #ifdef INET6  #ifdef INET6
515  int  int
516  carp6_proto_input(struct mbuf **mp, int *offp, int proto)  carp6_proto_input(struct mbuf **mp, int *offp, int proto __unused)
517  {  {
518          struct mbuf *m = *mp;          struct mbuf *m = *mp;
519          struct carp_softc *sc = NULL;          struct carp_softc *sc = NULL;
# Line 729  Line 729 
729    
730  /* ARGSUSED */  /* ARGSUSED */
731  void  void
732  carpattach(int n)  carpattach(int n __unused)
733  {  {
734          if_clone_attach(&carp_cloner);          if_clone_attach(&carp_cloner);
735  }  }
# Line 854  Line 854 
854  }  }
855    
856  int  int
857  carp_prepare_ad(struct mbuf *m, struct carp_softc *sc, struct carp_header *ch)  carp_prepare_ad(struct mbuf *m __unused, struct carp_softc *sc,
858        struct carp_header *ch)
859  {  {
860          if (sc->sc_init_counter) {          if (sc->sc_init_counter) {
861                  /* this could also be seconds since unix epoch */                  /* this could also be seconds since unix epoch */
# Line 1841  Line 1842 
1842          struct carpreq carpr;          struct carpreq carpr;
1843          struct ifaddr *ifa;          struct ifaddr *ifa;
1844          struct ifreq *ifr;          struct ifreq *ifr;
         struct ifaliasreq *ifra;  
1845          struct ifnet *cdev = NULL;          struct ifnet *cdev = NULL;
1846          int error = 0;          int error = 0;
1847    
1848          ifa = (struct ifaddr *)addr;          ifa = (struct ifaddr *)addr;
         ifra = (struct ifaliasreq *)addr;  
1849          ifr = (struct ifreq *)addr;          ifr = (struct ifreq *)addr;
1850    
1851          switch (cmd) {          switch (cmd) {
# Line 1872  Line 1871 
1871                  }                  }
1872                  break;                  break;
1873    
         case SIOCAIFADDR:  
                 switch (ifa->ifa_addr->sa_family) {  
 #ifdef INET  
                 case AF_INET:  
                         sc->sc_if.if_flags |= IFF_UP;  
                         bcopy(ifa->ifa_addr, ifa->ifa_dstaddr,  
                             sizeof(struct sockaddr));  
                         error = carp_set_addr(sc, satosin(&ifra->ifra_addr));  
                         break;  
 #endif /* INET */  
 #ifdef INET6  
                 case AF_INET6:  
                         sc->sc_if.if_flags |= IFF_UP;  
                         error = carp_set_addr6(sc, satosin6(&ifra->ifra_addr));  
                         break;  
 #endif /* INET6 */  
                 default:  
                         error = EAFNOSUPPORT;  
                         break;  
                 }  
                 break;  
   
1874          case SIOCSIFFLAGS:          case SIOCSIFFLAGS:
1875                  if (sc->sc_state != INIT && !(ifr->ifr_flags & IFF_UP)) {                  if (sc->sc_state != INIT && !(ifr->ifr_flags & IFF_UP)) {
1876                          callout_stop(&sc->sc_ad_tmo);                          callout_stop(&sc->sc_ad_tmo);
# Line 1915  Line 1892 
1892                  break;                  break;
1893    
1894          case SIOCSVH:          case SIOCSVH:
1895                  if (l == 0 || (error = kauth_authorize_generic(l->l_cred,                  if (l == NULL)
1896                      KAUTH_GENERIC_ISSUSER, &l->l_acflag)))                          break;
1897                    if ((error = kauth_authorize_network(l->l_cred,
1898                        KAUTH_NETWORK_INTERFACE,
1899                        KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd,
1900                        NULL)) != 0)
1901                          break;                          break;
1902                  if ((error = copyin(ifr->ifr_data, &carpr, sizeof carpr)))                  if ((error = copyin(ifr->ifr_data, &carpr, sizeof carpr)))
1903                          break;                          break;
# Line 1991  Line 1972 
1972                  carpr.carpr_advbase = sc->sc_advbase;                  carpr.carpr_advbase = sc->sc_advbase;
1973                  carpr.carpr_advskew = sc->sc_advskew;                  carpr.carpr_advskew = sc->sc_advskew;
1974    
1975                  if (l != 0 || !(error = kauth_authorize_generic(l->l_cred,                  if ((l == NULL) || (error = kauth_authorize_network(l->l_cred,
1976                      KAUTH_GENERIC_ISSUSER, &l->l_acflag)))                      KAUTH_NETWORK_INTERFACE,
1977                        KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd,
1978                        NULL)) != 0)
1979                          bcopy(sc->sc_key, carpr.carpr_key,                          bcopy(sc->sc_key, carpr.carpr_key,
1980                              sizeof(carpr.carpr_key));                              sizeof(carpr.carpr_key));
1981                  error = copyout(&carpr, ifr->ifr_data, sizeof(carpr));                  error = copyout(&carpr, ifr->ifr_data, sizeof(carpr));

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3