]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge commit '8df02847e8af29863c325b7297e3a2b2ed5f961c' into integrated
authorOndrej Zajicek <santiago@crfreenet.org>
Wed, 22 May 2013 22:16:19 +0000 (00:16 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Wed, 22 May 2013 22:16:19 +0000 (00:16 +0200)
Conflicts:

proto/ospf/config.Y
proto/ospf/hello.c
proto/ospf/iface.c
proto/ospf/ospf.h

1  2 
proto/ospf/config.Y
proto/ospf/hello.c
proto/ospf/iface.c
proto/ospf/ospf.h

index 3325a5de7e5dc11b80dfab4f1fed1506c0bb4bb0,2cc0b9634d65509881b51c5650af4dbd8c47a73e..2f1ee624e88042a2b390dadbedf70fde09a6a3c6
@@@ -279,7 -289,8 +279,8 @@@ ospf_iface_item
   | TYPE PTP { OSPF_PATT->type = OSPF_IT_PTP ; }
   | TYPE POINTOMULTIPOINT { OSPF_PATT->type = OSPF_IT_PTMP ; }
   | TYPE PTMP { OSPF_PATT->type = OSPF_IT_PTMP ; }
 - | REAL BROADCAST bool { OSPF_PATT->real_bcast = $3; if (OSPF_VERSION != 2) cf_error("Real broadcast option requires OSPFv2"); }
 - | PTP NETMASK bool { OSPF_PATT->ptp_netmask = $3; if (OSPF_VERSION != 2) cf_error("Real netmask option requires OSPFv2"); }
 + | REAL BROADCAST bool { OSPF_PATT->real_bcast = $3; if (!ospf_cfg_is_v2()) cf_error("Real broadcast option requires OSPFv2"); }
++ | PTP NETMASK bool { OSPF_PATT->ptp_netmask = $3; if (!ospf_cfg_is_v2()) cf_error("Real netmask option requires OSPFv2"); }
   | TRANSMIT DELAY expr { OSPF_PATT->inftransdelay = $3 ; if (($3<=0) || ($3>65535)) cf_error("Transmit delay must be in range 1-65535"); }
   | PRIORITY expr { OSPF_PATT->priority = $2 ; if (($2<0) || ($2>255)) cf_error("Priority must be in range 0-255"); }
   | STRICT NONBROADCAST bool { OSPF_PATT->strictnbma = $3 ; }
index c25187087effebc7edde7c4e25251ec74edccfc4,d5aa1b95eddcf04ef29c910492b548381e8c3c22..8f2e497f2f3a95dcf18eb64154eb6fa2ad066621
@@@ -258,55 -242,52 +258,56 @@@ ospf_hello_send(struct ospf_iface *ifa
    DBG("%s: Hello/Poll timer fired on interface %s with IP %I\n",
        p->name, ifa->iface->name, ifa->addr->ip);
  
 -  /* Now we should send a hello packet */
    pkt = ospf_tx_buffer(ifa);
 -  op = &pkt->ospf_packet;
 -
 -  /* Now fill ospf_hello header */
    ospf_pkt_fill_hdr(ifa, pkt, HELLO_P);
  
 -#ifdef OSPFv2
 -  pkt->netmask = ipa_mkmask(ifa->addr->pxlen);
 -  ipa_hton(pkt->netmask);
 -  if ((ifa->type == OSPF_IT_VLINK) ||
 -      ((ifa->type == OSPF_IT_PTP) && !ifa->ptp_netmask))
 -    pkt->netmask = IPA_NONE;
 -#endif
 -
 -  pkt->helloint = ntohs(ifa->helloint);
 -  pkt->priority = ifa->priority;
 -
 -#ifdef OSPFv3
 -  pkt->iface_id = htonl(ifa->iface_id);
 -
 -  pkt->options3 = ifa->oa->options >> 16;
 -  pkt->options2 = ifa->oa->options >> 8;
 -#endif
 -  pkt->options = ifa->oa->options;
 -
 -#ifdef OSPFv2
 -  pkt->deadint = htonl(ifa->deadint);
 -  pkt->dr = htonl(ipa_to_u32(ifa->drip));
 -  pkt->bdr = htonl(ipa_to_u32(ifa->bdrip));
 -#else /* OSPFv3 */
 -  pkt->deadint = htons(ifa->deadint);
 -  pkt->dr = htonl(ifa->drid);
 -  pkt->bdr = htonl(ifa->bdrid);
 -#endif
 +  if (ospf_is_v2(po))
 +  {
 +    struct ospf_hello2_packet *ps = (void *) pkt;
 +
 +    ps->netmask = htonl(u32_mkmask(ifa->addr->pxlen));
 +
-     if ((ifa->type == OSPF_IT_VLINK) || (ifa->type == OSPF_IT_PTP))
++    if ((ifa->type == OSPF_IT_VLINK) ||
++      ((ifa->type == OSPF_IT_PTP) && !ifa->ptp_netmask))
 +      ps->netmask = 0;
 +
 +    ps->helloint = ntohs(ifa->helloint);
 +    ps->options = ifa->oa->options;
 +    ps->priority = ifa->priority;
 +    ps->deadint = htonl(ifa->deadint);
 +    ps->dr = htonl(ipa_to_u32(ifa->drip));
 +    ps->bdr = htonl(ipa_to_u32(ifa->bdrip));
 +
 +    length = sizeof(struct ospf_hello2_packet);
 +    neighbors = ps->neighbors;
 +  }
 +  else
 +  {
 +    struct ospf_hello3_packet *ps = (void *) pkt;
 +
 +    ps->iface_id = htonl(ifa->iface_id);
 +    ps->priority = ifa->priority;
 +    ps->options3 = ifa->oa->options >> 16;
 +    ps->options2 = ifa->oa->options >> 8;
 +    ps->options = ifa->oa->options;
 +    ps->helloint = ntohs(ifa->helloint);
 +    ps->deadint = htons(ifa->deadint);
 +    ps->dr = htonl(ifa->drid);
 +    ps->bdr = htonl(ifa->bdrid);
 +
 +    length = sizeof(struct ospf_hello3_packet);
 +    neighbors = ps->neighbors;
 +  }
  
 -  /* Fill all neighbors */
    i = 0;
 +  max = (ospf_pkt_bufsize(ifa) - length) / sizeof(u32);
  
 +  /* Fill all neighbors */
    if (kind != OHS_SHUTDOWN)
    {
 -    u32 *pp = (u32 *) (((u8 *) pkt) + sizeof(struct ospf_hello_packet));
      WALK_LIST(neigh, ifa->neigh_list)
      {
 -      if ((i+1) * sizeof(u32) + sizeof(struct ospf_hello_packet) > ospf_pkt_bufsize(ifa))
 +      if (i == max)
        {
        log(L_WARN "%s: Too many neighbors on interface %s", p->name, ifa->iface->name);
        break;
index 8613ec8511d21116b581b8cb8431e30cfff99b5c,9050f7b10f77ed9f21a151a1f219119671aef406..19f4c585f24f802678b0cbe8cdad312137e179c6
@@@ -534,10 -533,19 +534,14 @@@ ospf_iface_new(struct ospf_area *oa, st
    ifa->rxbuf = ip->rxbuf;
    ifa->check_link = ip->check_link;
    ifa->ecmp_weight = ip->ecmp_weight;
 -
 -#ifdef OSPFv2
    ifa->autype = ip->autype;
    ifa->passwords = ip->passwords;
 -#endif
 -
 -#ifdef OSPFv3
 -  ifa->instance_id = ip->instance_id;
 -#endif
 +  ifa->instance_id = ip->instance_id;
 +
+   ifa->ptp_netmask = !(addr->flags & IA_PEER);
+   if (ip->ptp_netmask < 2)
+     ifa->ptp_netmask = ip->ptp_netmask;
    ifa->type = ospf_iface_classify(ip->type, addr);
  
    /* Check validity of interface type */
index 146d07f61b76fa196e5cd886a9c833b8bcfe6702,d924e6574a37d42cf571775ef18d26af763ce01f..1c411a71c8e048d1de188f19a86eb70d400de32f
@@@ -749,8 -811,15 +750,9 @@@ struct ospf_iface_pat
    u8 check_link;
    u8 ecmp_weight;
    u8 real_bcast;              /* Not really used in OSPFv3 */
-   list *passwords;
+   u8 ptp_netmask;             /* bool but 2 for unspecified */
 -
 -#ifdef OSPFv2
 -  list *passwords;
 -#endif
 -
 -#ifdef OSPFv3
    u8 instance_id;
 -#endif
++  list *passwords;
  };
  
  int ospf_import_control(struct proto *p, rte **new, ea_list **attrs,