Diff for /embedaddon/quagga/zebra/rtadv.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2012/02/21 17:26:11 version 1.1.1.2, 2012/10/09 09:22:29
Line 163  rtadv_send_packet (int sock, struct interface *ifp) Line 163  rtadv_send_packet (int sock, struct interface *ifp)
   struct rtadv_prefix *rprefix;    struct rtadv_prefix *rprefix;
   u_char all_nodes_addr[] = {0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,1};    u_char all_nodes_addr[] = {0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
   struct listnode *node;    struct listnode *node;
     u_int16_t pkt_RouterLifetime;
   
   /*    /*
    * Allocate control message bufffer.  This is dynamic because     * Allocate control message bufffer.  This is dynamic because
Line 190  rtadv_send_packet (int sock, struct interface *ifp) Line 191  rtadv_send_packet (int sock, struct interface *ifp)
   addr.sin6_len = sizeof (struct sockaddr_in6);    addr.sin6_len = sizeof (struct sockaddr_in6);
 #endif /* SIN6_LEN */  #endif /* SIN6_LEN */
   addr.sin6_port = htons (IPPROTO_ICMPV6);    addr.sin6_port = htons (IPPROTO_ICMPV6);
  memcpy (&addr.sin6_addr, all_nodes_addr, sizeof (struct in6_addr));  IPV6_ADDR_COPY (&addr.sin6_addr, all_nodes_addr);
   
   /* Fetch interface information. */    /* Fetch interface information. */
   zif = ifp->info;    zif = ifp->info;
Line 215  rtadv_send_packet (int sock, struct interface *ifp) Line 216  rtadv_send_packet (int sock, struct interface *ifp)
     rtadv->nd_ra_flags_reserved |= ND_RA_FLAG_OTHER;      rtadv->nd_ra_flags_reserved |= ND_RA_FLAG_OTHER;
   if (zif->rtadv.AdvHomeAgentFlag)    if (zif->rtadv.AdvHomeAgentFlag)
     rtadv->nd_ra_flags_reserved |= ND_RA_FLAG_HOME_AGENT;      rtadv->nd_ra_flags_reserved |= ND_RA_FLAG_HOME_AGENT;
  rtadv->nd_ra_router_lifetime = htons (zif->rtadv.AdvDefaultLifetime);  /* Note that according to Neighbor Discovery (RFC 4861 [18]),
    * AdvDefaultLifetime is by default based on the value of
    * MaxRtrAdvInterval.  AdvDefaultLifetime is used in the Router Lifetime
    * field of Router Advertisements.  Given that this field is expressed
    * in seconds, a small MaxRtrAdvInterval value can result in a zero
    * value for this field.  To prevent this, routers SHOULD keep
    * AdvDefaultLifetime in at least one second, even if the use of
    * MaxRtrAdvInterval would result in a smaller value. -- RFC6275, 7.5 */
   pkt_RouterLifetime = zif->rtadv.AdvDefaultLifetime != -1 ?
     zif->rtadv.AdvDefaultLifetime :
     MAX (1, 0.003 * zif->rtadv.MaxRtrAdvInterval);
   rtadv->nd_ra_router_lifetime = htons (pkt_RouterLifetime);
   rtadv->nd_ra_reachable = htonl (zif->rtadv.AdvReachableTime);    rtadv->nd_ra_reachable = htonl (zif->rtadv.AdvReachableTime);
   rtadv->nd_ra_retransmit = htonl (0);    rtadv->nd_ra_retransmit = htonl (0);
   
   len = sizeof (struct nd_router_advert);    len = sizeof (struct nd_router_advert);
   
  if (zif->rtadv.AdvHomeAgentFlag)  /* If both the Home Agent Preference and Home Agent Lifetime are set to
    * their default values specified above, this option SHOULD NOT be
    * included in the Router Advertisement messages sent by this home
    * agent. -- RFC6275, 7.4 */
   if
   (
     zif->rtadv.AdvHomeAgentFlag &&
     (zif->rtadv.HomeAgentPreference || zif->rtadv.HomeAgentLifetime != -1)
   )
     {      {
       struct nd_opt_homeagent_info *ndopt_hai =         struct nd_opt_homeagent_info *ndopt_hai = 
         (struct nd_opt_homeagent_info *)(buf + len);          (struct nd_opt_homeagent_info *)(buf + len);
Line 229  rtadv_send_packet (int sock, struct interface *ifp) Line 249  rtadv_send_packet (int sock, struct interface *ifp)
       ndopt_hai->nd_opt_hai_len = 1;        ndopt_hai->nd_opt_hai_len = 1;
       ndopt_hai->nd_opt_hai_reserved = 0;        ndopt_hai->nd_opt_hai_reserved = 0;
       ndopt_hai->nd_opt_hai_preference = htons(zif->rtadv.HomeAgentPreference);        ndopt_hai->nd_opt_hai_preference = htons(zif->rtadv.HomeAgentPreference);
      ndopt_hai->nd_opt_hai_lifetime = htons(zif->rtadv.HomeAgentLifetime);      /* 16-bit unsigned integer.  The lifetime associated with the home
        * agent in units of seconds.  The default value is the same as the
        * Router Lifetime, as specified in the main body of the Router
        * Advertisement.  The maximum value corresponds to 18.2 hours.  A
        * value of 0 MUST NOT be used. -- RFC6275, 7.5 */
       ndopt_hai->nd_opt_hai_lifetime = htons
       (
         zif->rtadv.HomeAgentLifetime != -1 ?
         zif->rtadv.HomeAgentLifetime :
         MAX (1, pkt_RouterLifetime) /* 0 is OK for RL, but not for HAL*/
       );
       len += sizeof(struct nd_opt_homeagent_info);        len += sizeof(struct nd_opt_homeagent_info);
     }      }
   
Line 267  rtadv_send_packet (int sock, struct interface *ifp) Line 297  rtadv_send_packet (int sock, struct interface *ifp)
       pinfo->nd_opt_pi_preferred_time = htonl (rprefix->AdvPreferredLifetime);        pinfo->nd_opt_pi_preferred_time = htonl (rprefix->AdvPreferredLifetime);
       pinfo->nd_opt_pi_reserved2 = 0;        pinfo->nd_opt_pi_reserved2 = 0;
   
      memcpy (&pinfo->nd_opt_pi_prefix, &rprefix->prefix.u.prefix6,      IPV6_ADDR_COPY (&pinfo->nd_opt_pi_prefix, &rprefix->prefix.prefix);
              sizeof (struct in6_addr)); 
   
 #ifdef DEBUG  #ifdef DEBUG
       {        {
Line 319  rtadv_send_packet (int sock, struct interface *ifp) Line 348  rtadv_send_packet (int sock, struct interface *ifp)
     }      }
 #endif /* HAVE_STRUCT_SOCKADDR_DL */  #endif /* HAVE_STRUCT_SOCKADDR_DL */
   
     /* MTU */
     if (zif->rtadv.AdvLinkMTU)
       {
         struct nd_opt_mtu * opt = (struct nd_opt_mtu *) (buf + len);
         opt->nd_opt_mtu_type = ND_OPT_MTU;
         opt->nd_opt_mtu_len = 1;
         opt->nd_opt_mtu_reserved = 0;
         opt->nd_opt_mtu_mtu = htonl (zif->rtadv.AdvLinkMTU);
         len += sizeof (struct nd_opt_mtu);
       }
   
   msg.msg_name = (void *) &addr;    msg.msg_name = (void *) &addr;
   msg.msg_namelen = sizeof (struct sockaddr_in6);    msg.msg_namelen = sizeof (struct sockaddr_in6);
   msg.msg_iov = &iov;    msg.msg_iov = &iov;
Line 368  rtadv_timer (struct thread *thread) Line 408  rtadv_timer (struct thread *thread)
   
   for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))    for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
     {      {
      if (if_is_loopback (ifp))      if (if_is_loopback (ifp) || ! if_is_operative (ifp))
         continue;          continue;
   
       zif = ifp->info;        zif = ifp->info;
Line 378  rtadv_timer (struct thread *thread) Line 418  rtadv_timer (struct thread *thread)
           zif->rtadv.AdvIntervalTimer -= period;            zif->rtadv.AdvIntervalTimer -= period;
           if (zif->rtadv.AdvIntervalTimer <= 0)            if (zif->rtadv.AdvIntervalTimer <= 0)
             {              {
                 /* FIXME: using MaxRtrAdvInterval each time isn't what section
                    6.2.4 of RFC4861 tells to do. */
               zif->rtadv.AdvIntervalTimer = zif->rtadv.MaxRtrAdvInterval;                zif->rtadv.AdvIntervalTimer = zif->rtadv.MaxRtrAdvInterval;
               rtadv_send_packet (rtadv->sock, ifp);                rtadv_send_packet (rtadv->sock, ifp);
             }              }
Line 552  rtadv_prefix_free (struct rtadv_prefix *rtadv_prefix) Line 594  rtadv_prefix_free (struct rtadv_prefix *rtadv_prefix)
 }  }
   
 static struct rtadv_prefix *  static struct rtadv_prefix *
rtadv_prefix_lookup (struct list *rplist, struct prefix *p)rtadv_prefix_lookup (struct list *rplist, struct prefix_ipv6 *p)
 {  {
   struct listnode *node;    struct listnode *node;
   struct rtadv_prefix *rprefix;    struct rtadv_prefix *rprefix;
   
   for (ALL_LIST_ELEMENTS_RO (rplist, node, rprefix))    for (ALL_LIST_ELEMENTS_RO (rplist, node, rprefix))
    if (prefix_same (&rprefix->prefix, p))    if (prefix_same ((struct prefix *) &rprefix->prefix, (struct prefix *) p))
       return rprefix;        return rprefix;
   return NULL;    return NULL;
 }  }
   
 static struct rtadv_prefix *  static struct rtadv_prefix *
rtadv_prefix_get (struct list *rplist, struct prefix *p)rtadv_prefix_get (struct list *rplist, struct prefix_ipv6 *p)
 {  {
   struct rtadv_prefix *rprefix;    struct rtadv_prefix *rprefix;
       
Line 573  rtadv_prefix_get (struct list *rplist, struct prefix * Line 615  rtadv_prefix_get (struct list *rplist, struct prefix *
     return rprefix;      return rprefix;
   
   rprefix = rtadv_prefix_new ();    rprefix = rtadv_prefix_new ();
  memcpy (&rprefix->prefix, p, sizeof (struct prefix));  memcpy (&rprefix->prefix, p, sizeof (struct prefix_ipv6));
   listnode_add (rplist, rprefix);    listnode_add (rplist, rprefix);
   
   return rprefix;    return rprefix;
Line 681  DEFUN (no_ipv6_nd_suppress_ra, Line 723  DEFUN (no_ipv6_nd_suppress_ra,
   
 DEFUN (ipv6_nd_ra_interval_msec,  DEFUN (ipv6_nd_ra_interval_msec,
        ipv6_nd_ra_interval_msec_cmd,         ipv6_nd_ra_interval_msec_cmd,
       "ipv6 nd ra-interval msec MILLISECONDS",       "ipv6 nd ra-interval msec <70-1800000>",
        "Interface IPv6 config commands\n"         "Interface IPv6 config commands\n"
        "Neighbor discovery\n"         "Neighbor discovery\n"
        "Router Advertisement interval\n"         "Router Advertisement interval\n"
        "Router Advertisement interval in milliseconds\n")         "Router Advertisement interval in milliseconds\n")
 {  {
  int interval;  unsigned interval;
  struct interface *ifp;  struct interface *ifp = (struct interface *) vty->index;
  struct zebra_if *zif;  struct zebra_if *zif = ifp->info;
   
  ifp = (struct interface *) vty->index;  VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0], 70, 1800000);
  zif = ifp->info;  if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime * 1000))
   {
     vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE);
     return CMD_WARNING;
   }
   
   interval = atoi (argv[0]);  
   
   if (interval <= 0)  
     {  
       vty_out (vty, "Invalid Router Advertisement Interval%s", VTY_NEWLINE);  
       return CMD_WARNING;  
     }  
   
   if (zif->rtadv.MaxRtrAdvInterval % 1000)    if (zif->rtadv.MaxRtrAdvInterval % 1000)
     rtadv->adv_msec_if_count--;      rtadv->adv_msec_if_count--;
   
Line 717  DEFUN (ipv6_nd_ra_interval_msec, Line 755  DEFUN (ipv6_nd_ra_interval_msec,
   
 DEFUN (ipv6_nd_ra_interval,  DEFUN (ipv6_nd_ra_interval,
        ipv6_nd_ra_interval_cmd,         ipv6_nd_ra_interval_cmd,
       "ipv6 nd ra-interval SECONDS",       "ipv6 nd ra-interval <1-1800>",
        "Interface IPv6 config commands\n"         "Interface IPv6 config commands\n"
        "Neighbor discovery\n"         "Neighbor discovery\n"
        "Router Advertisement interval\n"         "Router Advertisement interval\n"
        "Router Advertisement interval in seconds\n")         "Router Advertisement interval in seconds\n")
 {  {
  int interval;  unsigned interval;
  struct interface *ifp;  struct interface *ifp = (struct interface *) vty->index;
  struct zebra_if *zif;  struct zebra_if *zif = ifp->info;
   
  ifp = (struct interface *) vty->index;  VTY_GET_INTEGER_RANGE ("router advertisement interval", interval, argv[0], 1, 1800);
  zif = ifp->info;  if ((zif->rtadv.AdvDefaultLifetime != -1 && interval > (unsigned)zif->rtadv.AdvDefaultLifetime))
   {
     vty_out (vty, "This ra-interval would conflict with configured ra-lifetime!%s", VTY_NEWLINE);
     return CMD_WARNING;
   }
   
   interval = atoi (argv[0]);  
   
   if (interval <= 0)  
     {  
       vty_out (vty, "Invalid Router Advertisement Interval%s", VTY_NEWLINE);  
       return CMD_WARNING;  
     }  
   
   if (zif->rtadv.MaxRtrAdvInterval % 1000)    if (zif->rtadv.MaxRtrAdvInterval % 1000)
     rtadv->adv_msec_if_count--;      rtadv->adv_msec_if_count--;
                   
Line 775  DEFUN (no_ipv6_nd_ra_interval, Line 809  DEFUN (no_ipv6_nd_ra_interval,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (no_ipv6_nd_ra_interval,
          no_ipv6_nd_ra_interval_val_cmd,
          "no ipv6 nd ra-interval <1-1800>",
          NO_STR
          "Interface IPv6 config commands\n"
          "Neighbor discovery\n"
          "Router Advertisement interval\n")
   
   ALIAS (no_ipv6_nd_ra_interval,
          no_ipv6_nd_ra_interval_msec_val_cmd,
          "no ipv6 nd ra-interval msec <1-1800000>",
          NO_STR
          "Interface IPv6 config commands\n"
          "Neighbor discovery\n"
          "Router Advertisement interval\n"
          "Router Advertisement interval in milliseconds\n")
   
 DEFUN (ipv6_nd_ra_lifetime,  DEFUN (ipv6_nd_ra_lifetime,
        ipv6_nd_ra_lifetime_cmd,         ipv6_nd_ra_lifetime_cmd,
       "ipv6 nd ra-lifetime SECONDS",       "ipv6 nd ra-lifetime <0-9000>",
        "Interface IPv6 config commands\n"         "Interface IPv6 config commands\n"
        "Neighbor discovery\n"         "Neighbor discovery\n"
        "Router lifetime\n"         "Router lifetime\n"
       "Router lifetime in seconds\n")       "Router lifetime in seconds (0 stands for a non-default gw)\n")
 {  {
   int lifetime;    int lifetime;
   struct interface *ifp;    struct interface *ifp;
Line 790  DEFUN (ipv6_nd_ra_lifetime, Line 841  DEFUN (ipv6_nd_ra_lifetime,
   ifp = (struct interface *) vty->index;    ifp = (struct interface *) vty->index;
   zif = ifp->info;    zif = ifp->info;
   
  lifetime = atoi (argv[0]);  VTY_GET_INTEGER_RANGE ("router lifetime", lifetime, argv[0], 0, 9000);
   
  if (lifetime < 0 || lifetime > 0xffff)  /* The value to be placed in the Router Lifetime field
    * of Router Advertisements sent from the interface,
    * in seconds.  MUST be either zero or between
    * MaxRtrAdvInterval and 9000 seconds. -- RFC4861, 6.2.1 */
   if ((lifetime != 0 && lifetime * 1000 < zif->rtadv.MaxRtrAdvInterval))
     {      {
      vty_out (vty, "Invalid Router Lifetime%s", VTY_NEWLINE);      vty_out (vty, "This ra-lifetime would conflict with configured ra-interval%s", VTY_NEWLINE);
       return CMD_WARNING;        return CMD_WARNING;
     }      }
   
Line 817  DEFUN (no_ipv6_nd_ra_lifetime, Line 872  DEFUN (no_ipv6_nd_ra_lifetime,
   ifp = (struct interface *) vty->index;    ifp = (struct interface *) vty->index;
   zif = ifp->info;    zif = ifp->info;
   
  zif->rtadv.AdvDefaultLifetime = RTADV_ADV_DEFAULT_LIFETIME;  zif->rtadv.AdvDefaultLifetime = -1;
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (no_ipv6_nd_ra_lifetime,
          no_ipv6_nd_ra_lifetime_val_cmd,
          "no ipv6 nd ra-lifetime <0-9000>",
          NO_STR
          "Interface IPv6 config commands\n"
          "Neighbor discovery\n"
          "Router lifetime\n"
          "Router lifetime in seconds (0 stands for a non-default gw)\n")
   
 DEFUN (ipv6_nd_reachable_time,  DEFUN (ipv6_nd_reachable_time,
        ipv6_nd_reachable_time_cmd,         ipv6_nd_reachable_time_cmd,
       "ipv6 nd reachable-time MILLISECONDS",       "ipv6 nd reachable-time <1-3600000>",
        "Interface IPv6 config commands\n"         "Interface IPv6 config commands\n"
        "Neighbor discovery\n"         "Neighbor discovery\n"
        "Reachable time\n"         "Reachable time\n"
        "Reachable time in milliseconds\n")         "Reachable time in milliseconds\n")
 {  {
  u_int32_t rtime;  struct interface *ifp = (struct interface *) vty->index;
  struct interface *ifp;  struct zebra_if *zif = ifp->info;
  struct zebra_if *zif;  VTY_GET_INTEGER_RANGE ("reachable time", zif->rtadv.AdvReachableTime, argv[0], 1, RTADV_MAX_REACHABLE_TIME);
 
  ifp = (struct interface *) vty->index; 
  zif = ifp->info; 
 
  rtime = (u_int32_t) atol (argv[0]); 
 
  if (rtime > RTADV_MAX_REACHABLE_TIME) 
    { 
      vty_out (vty, "Invalid Reachable time%s", VTY_NEWLINE); 
      return CMD_WARNING; 
    } 
 
  zif->rtadv.AdvReachableTime = rtime; 
 
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
Line 869  DEFUN (no_ipv6_nd_reachable_time, Line 919  DEFUN (no_ipv6_nd_reachable_time,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (no_ipv6_nd_reachable_time,
          no_ipv6_nd_reachable_time_val_cmd,
          "no ipv6 nd reachable-time <1-3600000>",
          NO_STR
          "Interface IPv6 config commands\n"
          "Neighbor discovery\n"
          "Reachable time\n"
          "Reachable time in milliseconds\n")
   
 DEFUN (ipv6_nd_homeagent_preference,  DEFUN (ipv6_nd_homeagent_preference,
        ipv6_nd_homeagent_preference_cmd,         ipv6_nd_homeagent_preference_cmd,
       "ipv6 nd home-agent-preference PREFERENCE",       "ipv6 nd home-agent-preference <0-65535>",
        "Interface IPv6 config commands\n"         "Interface IPv6 config commands\n"
        "Neighbor discovery\n"         "Neighbor discovery\n"
        "Home Agent preference\n"         "Home Agent preference\n"
       "Home Agent preference value 0..65535\n")       "preference value (default is 0, least preferred)\n")
 {  {
  u_int32_t hapref;  struct interface *ifp = (struct interface *) vty->index;
  struct interface *ifp;  struct zebra_if *zif = ifp->info;
  struct zebra_if *zif;  VTY_GET_INTEGER_RANGE ("home agent preference", zif->rtadv.HomeAgentPreference, argv[0], 0, 65535);
 
  ifp = (struct interface *) vty->index; 
  zif = ifp->info; 
 
  hapref = (u_int32_t) atol (argv[0]); 
 
  if (hapref > 65535) 
    { 
      vty_out (vty, "Invalid Home Agent preference%s", VTY_NEWLINE); 
      return CMD_WARNING; 
    } 
 
  zif->rtadv.HomeAgentPreference = hapref; 
 
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
Line 916  DEFUN (no_ipv6_nd_homeagent_preference, Line 961  DEFUN (no_ipv6_nd_homeagent_preference,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (no_ipv6_nd_homeagent_preference,
          no_ipv6_nd_homeagent_preference_val_cmd,
          "no ipv6 nd home-agent-preference <0-65535>",
          NO_STR
          "Interface IPv6 config commands\n"
          "Neighbor discovery\n"
          "Home Agent preference\n"
          "preference value (default is 0, least preferred)\n")
   
 DEFUN (ipv6_nd_homeagent_lifetime,  DEFUN (ipv6_nd_homeagent_lifetime,
        ipv6_nd_homeagent_lifetime_cmd,         ipv6_nd_homeagent_lifetime_cmd,
       "ipv6 nd home-agent-lifetime SECONDS",       "ipv6 nd home-agent-lifetime <0-65520>",
        "Interface IPv6 config commands\n"         "Interface IPv6 config commands\n"
        "Neighbor discovery\n"         "Neighbor discovery\n"
        "Home Agent lifetime\n"         "Home Agent lifetime\n"
       "Home Agent lifetime in seconds\n")       "Home Agent lifetime in seconds (0 to track ra-lifetime)\n")
 {  {
  u_int32_t ha_ltime;  struct interface *ifp = (struct interface *) vty->index;
  struct interface *ifp;  struct zebra_if *zif = ifp->info;
  struct zebra_if *zif;  VTY_GET_INTEGER_RANGE ("home agent lifetime", zif->rtadv.HomeAgentLifetime, argv[0], 0, RTADV_MAX_HALIFETIME);
 
  ifp = (struct interface *) vty->index; 
  zif = ifp->info; 
 
  ha_ltime = (u_int32_t) atol (argv[0]); 
 
  if (ha_ltime > RTADV_MAX_HALIFETIME) 
    { 
      vty_out (vty, "Invalid Home Agent Lifetime time%s", VTY_NEWLINE); 
      return CMD_WARNING; 
    } 
 
  zif->rtadv.HomeAgentLifetime = ha_ltime; 
 
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
Line 958  DEFUN (no_ipv6_nd_homeagent_lifetime, Line 998  DEFUN (no_ipv6_nd_homeagent_lifetime,
   ifp = (struct interface *) vty->index;    ifp = (struct interface *) vty->index;
   zif = ifp->info;    zif = ifp->info;
   
  zif->rtadv.HomeAgentLifetime = 0;  zif->rtadv.HomeAgentLifetime = -1;
   
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (no_ipv6_nd_homeagent_lifetime,
          no_ipv6_nd_homeagent_lifetime_val_cmd,
          "no ipv6 nd home-agent-lifetime <0-65520>",
          NO_STR
          "Interface IPv6 config commands\n"
          "Neighbor discovery\n"
          "Home Agent lifetime\n"
          "Home Agent lifetime in seconds (0 to track ra-lifetime)\n")
   
 DEFUN (ipv6_nd_managed_config_flag,  DEFUN (ipv6_nd_managed_config_flag,
        ipv6_nd_managed_config_flag_cmd,         ipv6_nd_managed_config_flag_cmd,
        "ipv6 nd managed-config-flag",         "ipv6 nd managed-config-flag",
Line 1137  DEFUN (ipv6_nd_prefix, Line 1186  DEFUN (ipv6_nd_prefix,
   ifp = (struct interface *) vty->index;    ifp = (struct interface *) vty->index;
   zebra_if = ifp->info;    zebra_if = ifp->info;
   
  ret = str2prefix_ipv6 (argv[0], (struct prefix_ipv6 *) &rp.prefix);  ret = str2prefix_ipv6 (argv[0], &rp.prefix);
   if (!ret)    if (!ret)
     {      {
       vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);        vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
       return CMD_WARNING;        return CMD_WARNING;
     }      }
     apply_mask_ipv6 (&rp.prefix); /* RFC4861 4.6.2 */
   rp.AdvOnLinkFlag = 1;    rp.AdvOnLinkFlag = 1;
   rp.AdvAutonomousFlag = 1;    rp.AdvAutonomousFlag = 1;
   rp.AdvRouterAddressFlag = 0;    rp.AdvRouterAddressFlag = 0;
Line 1364  DEFUN (no_ipv6_nd_prefix, Line 1414  DEFUN (no_ipv6_nd_prefix,
   ifp = (struct interface *) vty->index;    ifp = (struct interface *) vty->index;
   zebra_if = ifp->info;    zebra_if = ifp->info;
   
  ret = str2prefix_ipv6 (argv[0], (struct prefix_ipv6 *) &rp.prefix);  ret = str2prefix_ipv6 (argv[0], &rp.prefix);
   if (!ret)    if (!ret)
     {      {
       vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);        vty_out (vty, "Malformed IPv6 prefix%s", VTY_NEWLINE);
       return CMD_WARNING;        return CMD_WARNING;
     }      }
     apply_mask_ipv6 (&rp.prefix); /* RFC4861 4.6.2 */
   
   ret = rtadv_prefix_reset (zebra_if, &rp);    ret = rtadv_prefix_reset (zebra_if, &rp);
   if (!ret)    if (!ret)
Line 1430  DEFUN (no_ipv6_nd_router_preference, Line 1481  DEFUN (no_ipv6_nd_router_preference,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   ALIAS (no_ipv6_nd_router_preference,
          no_ipv6_nd_router_preference_val_cmd,
          "no ipv6 nd router-preference (high|medium|low",
          NO_STR
          "Interface IPv6 config commands\n"
          "Neighbor discovery\n"
          "Default router preference\n"
          "High default router preference\n"
          "Low default router preference\n"
          "Medium default router preference (default)\n")
   
   DEFUN (ipv6_nd_mtu,
          ipv6_nd_mtu_cmd,
          "ipv6 nd mtu <1-65535>",
          "Interface IPv6 config commands\n"
          "Neighbor discovery\n"
          "Advertised MTU\n"
          "MTU in bytes\n")
   {
     struct interface *ifp = (struct interface *) vty->index;
     struct zebra_if *zif = ifp->info;
     VTY_GET_INTEGER_RANGE ("MTU", zif->rtadv.AdvLinkMTU, argv[0], 1, 65535);
     return CMD_SUCCESS;
   }
   
   DEFUN (no_ipv6_nd_mtu,
          no_ipv6_nd_mtu_cmd,
          "no ipv6 nd mtu",
          NO_STR
          "Interface IPv6 config commands\n"
          "Neighbor discovery\n"
          "Advertised MTU\n")
   {
     struct interface *ifp = (struct interface *) vty->index;
     struct zebra_if *zif = ifp->info;
     zif->rtadv.AdvLinkMTU = 0;
     return CMD_SUCCESS;
   }
   
   ALIAS (no_ipv6_nd_mtu,
          no_ipv6_nd_mtu_val_cmd,
          "no ipv6 nd mtu <1-65535>",
          NO_STR
          "Interface IPv6 config commands\n"
          "Neighbor discovery\n"
          "Advertised MTU\n"
          "MTU in bytes\n")
   
 /* Write configuration about router advertisement. */  /* Write configuration about router advertisement. */
 void  void
 rtadv_config_write (struct vty *vty, struct interface *ifp)  rtadv_config_write (struct vty *vty, struct interface *ifp)
Line 1463  rtadv_config_write (struct vty *vty, struct interface  Line 1562  rtadv_config_write (struct vty *vty, struct interface 
       vty_out (vty, " ipv6 nd ra-interval %d%s", interval / 1000,        vty_out (vty, " ipv6 nd ra-interval %d%s", interval / 1000,
              VTY_NEWLINE);               VTY_NEWLINE);
   
  if (zif->rtadv.AdvDefaultLifetime != RTADV_ADV_DEFAULT_LIFETIME)  if (zif->rtadv.AdvIntervalOption)
     vty_out (vty, " ipv6 nd adv-interval-option%s", VTY_NEWLINE);
 
   if (zif->rtadv.AdvDefaultLifetime != -1)
     vty_out (vty, " ipv6 nd ra-lifetime %d%s", zif->rtadv.AdvDefaultLifetime,      vty_out (vty, " ipv6 nd ra-lifetime %d%s", zif->rtadv.AdvDefaultLifetime,
              VTY_NEWLINE);               VTY_NEWLINE);
   
     if (zif->rtadv.HomeAgentPreference)
       vty_out (vty, " ipv6 nd home-agent-preference %u%s",
                zif->rtadv.HomeAgentPreference, VTY_NEWLINE);
   
     if (zif->rtadv.HomeAgentLifetime != -1)
       vty_out (vty, " ipv6 nd home-agent-lifetime %u%s",
                zif->rtadv.HomeAgentLifetime, VTY_NEWLINE);
   
     if (zif->rtadv.AdvHomeAgentFlag)
       vty_out (vty, " ipv6 nd home-agent-config-flag%s", VTY_NEWLINE);
   
   if (zif->rtadv.AdvReachableTime)    if (zif->rtadv.AdvReachableTime)
     vty_out (vty, " ipv6 nd reachable-time %d%s", zif->rtadv.AdvReachableTime,      vty_out (vty, " ipv6 nd reachable-time %d%s", zif->rtadv.AdvReachableTime,
              VTY_NEWLINE);               VTY_NEWLINE);
Line 1482  rtadv_config_write (struct vty *vty, struct interface  Line 1595  rtadv_config_write (struct vty *vty, struct interface 
              rtadv_pref_strs[zif->rtadv.DefaultPreference],               rtadv_pref_strs[zif->rtadv.DefaultPreference],
              VTY_NEWLINE);               VTY_NEWLINE);
   
     if (zif->rtadv.AdvLinkMTU)
       vty_out (vty, " ipv6 nd mtu %d%s", zif->rtadv.AdvLinkMTU, VTY_NEWLINE);
   
   for (ALL_LIST_ELEMENTS_RO (zif->rtadv.AdvPrefixList, node, rprefix))    for (ALL_LIST_ELEMENTS_RO (zif->rtadv.AdvPrefixList, node, rprefix))
     {      {
       vty_out (vty, " ipv6 nd prefix %s/%d",        vty_out (vty, " ipv6 nd prefix %s/%d",
               inet_ntop (AF_INET6, &rprefix->prefix.u.prefix6,                inet_ntop (AF_INET6, &rprefix->prefix.prefix,
                           (char *) buf, INET6_ADDRSTRLEN),                            (char *) buf, INET6_ADDRSTRLEN),
                rprefix->prefix.prefixlen);                 rprefix->prefix.prefixlen);
       if ((rprefix->AdvValidLifetime != RTADV_VALID_LIFETIME) ||         if ((rprefix->AdvValidLifetime != RTADV_VALID_LIFETIME) || 
Line 1572  rtadv_init (void) Line 1688  rtadv_init (void)
   install_element (INTERFACE_NODE, &ipv6_nd_ra_interval_cmd);    install_element (INTERFACE_NODE, &ipv6_nd_ra_interval_cmd);
   install_element (INTERFACE_NODE, &ipv6_nd_ra_interval_msec_cmd);    install_element (INTERFACE_NODE, &ipv6_nd_ra_interval_msec_cmd);
   install_element (INTERFACE_NODE, &no_ipv6_nd_ra_interval_cmd);    install_element (INTERFACE_NODE, &no_ipv6_nd_ra_interval_cmd);
     install_element (INTERFACE_NODE, &no_ipv6_nd_ra_interval_val_cmd);
     install_element (INTERFACE_NODE, &no_ipv6_nd_ra_interval_msec_val_cmd);
   install_element (INTERFACE_NODE, &ipv6_nd_ra_lifetime_cmd);    install_element (INTERFACE_NODE, &ipv6_nd_ra_lifetime_cmd);
   install_element (INTERFACE_NODE, &no_ipv6_nd_ra_lifetime_cmd);    install_element (INTERFACE_NODE, &no_ipv6_nd_ra_lifetime_cmd);
     install_element (INTERFACE_NODE, &no_ipv6_nd_ra_lifetime_val_cmd);
   install_element (INTERFACE_NODE, &ipv6_nd_reachable_time_cmd);    install_element (INTERFACE_NODE, &ipv6_nd_reachable_time_cmd);
   install_element (INTERFACE_NODE, &no_ipv6_nd_reachable_time_cmd);    install_element (INTERFACE_NODE, &no_ipv6_nd_reachable_time_cmd);
     install_element (INTERFACE_NODE, &no_ipv6_nd_reachable_time_val_cmd);
   install_element (INTERFACE_NODE, &ipv6_nd_managed_config_flag_cmd);    install_element (INTERFACE_NODE, &ipv6_nd_managed_config_flag_cmd);
   install_element (INTERFACE_NODE, &no_ipv6_nd_managed_config_flag_cmd);    install_element (INTERFACE_NODE, &no_ipv6_nd_managed_config_flag_cmd);
   install_element (INTERFACE_NODE, &ipv6_nd_other_config_flag_cmd);    install_element (INTERFACE_NODE, &ipv6_nd_other_config_flag_cmd);
Line 1584  rtadv_init (void) Line 1704  rtadv_init (void)
   install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_config_flag_cmd);    install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_config_flag_cmd);
   install_element (INTERFACE_NODE, &ipv6_nd_homeagent_preference_cmd);    install_element (INTERFACE_NODE, &ipv6_nd_homeagent_preference_cmd);
   install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_preference_cmd);    install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_preference_cmd);
     install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_preference_val_cmd);
   install_element (INTERFACE_NODE, &ipv6_nd_homeagent_lifetime_cmd);    install_element (INTERFACE_NODE, &ipv6_nd_homeagent_lifetime_cmd);
   install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_lifetime_cmd);    install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_lifetime_cmd);
     install_element (INTERFACE_NODE, &no_ipv6_nd_homeagent_lifetime_val_cmd);
   install_element (INTERFACE_NODE, &ipv6_nd_adv_interval_config_option_cmd);    install_element (INTERFACE_NODE, &ipv6_nd_adv_interval_config_option_cmd);
   install_element (INTERFACE_NODE, &no_ipv6_nd_adv_interval_config_option_cmd);    install_element (INTERFACE_NODE, &no_ipv6_nd_adv_interval_config_option_cmd);
   install_element (INTERFACE_NODE, &ipv6_nd_prefix_cmd);    install_element (INTERFACE_NODE, &ipv6_nd_prefix_cmd);
Line 1605  rtadv_init (void) Line 1727  rtadv_init (void)
   install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_cmd);    install_element (INTERFACE_NODE, &no_ipv6_nd_prefix_cmd);
   install_element (INTERFACE_NODE, &ipv6_nd_router_preference_cmd);    install_element (INTERFACE_NODE, &ipv6_nd_router_preference_cmd);
   install_element (INTERFACE_NODE, &no_ipv6_nd_router_preference_cmd);    install_element (INTERFACE_NODE, &no_ipv6_nd_router_preference_cmd);
     install_element (INTERFACE_NODE, &no_ipv6_nd_router_preference_val_cmd);
     install_element (INTERFACE_NODE, &ipv6_nd_mtu_cmd);
     install_element (INTERFACE_NODE, &no_ipv6_nd_mtu_cmd);
     install_element (INTERFACE_NODE, &no_ipv6_nd_mtu_val_cmd);
 }  }
   
 static int  static int

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>