]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge remote-tracking branch 'origin/master' into int-new
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Thu, 12 May 2016 15:49:12 +0000 (17:49 +0200)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Thu, 12 May 2016 16:03:23 +0000 (18:03 +0200)
26 files changed:
1  2 
conf/cf-lex.l
configure.in
lib/birdlib.h
lib/bitops.h
lib/ip.h
lib/printf.c
lib/socket.h
nest/config.Y
nest/neighbor.c
nest/proto-hooks.c
nest/proto.c
nest/protocol.h
nest/route.h
nest/rt-attr.c
nest/rt-dev.c
nest/rt-dev.h
nest/rt-table.c
proto/bgp/bgp.c
proto/bgp/config.Y
proto/ospf/lsalib.c
proto/ospf/packet.c
sysdep/linux/netlink.c
sysdep/linux/sysio.h
sysdep/unix/io.c
sysdep/unix/log.c
sysdep/unix/main.c

diff --cc conf/cf-lex.l
Simple merge
diff --cc configure.in
index f1697c1217568b13541e8b359fc69d445036b35f,16a0b4146241806534c3735f19e630c86b611d5e..a0db0fbdae18dfd078852d38a43a730a69a91825
@@@ -167,9 -205,10 +167,9 @@@ f
  
  AC_SUBST(iproutedir)
  
- # all_protocols="$proto_bfd bgp ospf pipe radv rip static"
 -all_protocols="$proto_bfd bgp ospf pipe $proto_radv rip static"
 -if test "$ip" = ipv6 ; then
 -   all_protocols="$all_protocols babel"
 -fi
++# all_protocols="$proto_bfd babel bgp ospf pipe radv rip static"
 +all_protocols="$proto_bfd ospf pipe radv rip static"
 +
  all_protocols=`echo $all_protocols | sed 's/ /,/g'`
  
  if test "$with_protocols" = all ; then
diff --cc lib/birdlib.h
Simple merge
diff --cc lib/bitops.h
Simple merge
diff --cc lib/ip.h
Simple merge
diff --cc lib/printf.c
index 318cee2c39b90f7df6b7f0a11ce830c936cad91f,a067fe981c561e2e6969771fa2f60c59dee5d26e..844f596948aeeb02d58a6f8170ac7db9d67a69e4
@@@ -118,15 -118,16 +118,16 @@@ static char * number(char * str, long n
   * @fmt: format string
   * @args: a list of arguments to be formatted
   *
 - * This functions acts like ordinary sprintf() except that it checks
 - * available space to avoid buffer overflows and it allows some more
 - * format specifiers: |%I| for formatting of IP addresses (any non-zero
 - * width is automatically replaced by standard IP address width which
 - * depends on whether we use IPv4 or IPv6; |%#I| gives hexadecimal format),
 - * |%R| for Router / Network ID (u32 value printed as IPv4 address)
 - * |%lR| for 64bit Router / Network ID (u64 value printed as eight :-separated octets)
 - * and |%m| resp. |%M| for error messages (uses strerror() to translate @errno code to
 - * message text). On the other hand, it doesn't support floating
 - * point numbers.
 + * This functions acts like ordinary sprintf() except that it checks available
 + * space to avoid buffer overflows and it allows some more format specifiers:
 + * |%I| for formatting of IP addresses (width of 1 is automatically replaced by
 + * standard IP address width which depends on whether we use IPv4 or IPv6; |%I4|
 + * or |%I6| can be used for explicit ip4_addr / ip6_addr arguments, |%N| for
 + * generic network addresses (net_addr *), |%R| for Router / Network ID (u32
-  * value printed as IPv4 address) and |%m| resp. |%M| for error messages (uses
-  * strerror() to translate @errno code to message text). On the other hand, it
-  * doesn't support floating point numbers.
++ * value printed as IPv4 address), |%lR| for 64bit Router / Network ID (u64
++ * value printed as eight :-separated octets) and |%m| resp. |%M| for error
++ * messages (uses strerror() to translate @errno code to message text). On the
++ * other hand, it doesn't support floating point numbers.
   *
   * Result: number of characters of the output string or -1 if
   * the buffer space was insufficient.
@@@ -137,9 -138,10 +138,10 @@@ int bvsnprintf(char *buf, int size, con
        unsigned long num;
        int i, base;
        u32 x;
+       u64 X;
        char *str, *start;
        const char *s;
 -      char ipbuf[MAX(STD_ADDRESS_P_LENGTH,ROUTER_ID_64_LENGTH)+1];
 +      char ipbuf[NET_MAX_TEXT_LENGTH+1];
        struct iface *iface;
  
        int flags;              /* flags to number() */
  
                /* Router/Network ID - essentially IPv4 address in u32 value */
                case 'R':
-                       x = va_arg(args, u32);
-                       ip4_ntop(ip4_from_u32(x), ipbuf);
 -                      if(qualifier == 'l') {
++                      if (qualifier == 'l') {
+                               X = va_arg(args, u64);
+                               bsprintf(ipbuf, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
+                                       ((X >> 56) & 0xff),
+                                       ((X >> 48) & 0xff),
+                                       ((X >> 40) & 0xff),
+                                       ((X >> 32) & 0xff),
+                                       ((X >> 24) & 0xff),
+                                       ((X >> 16) & 0xff),
+                                       ((X >> 8) & 0xff),
+                                       (X & 0xff));
+                       }
+                       else
+                       {
+                               x = va_arg(args, u32);
 -                              bsprintf(ipbuf, "%d.%d.%d.%d",
 -                                      ((x >> 24) & 0xff),
 -                                      ((x >> 16) & 0xff),
 -                                      ((x >> 8) & 0xff),
 -                                      (x & 0xff));
++                              ip4_ntop(ip4_from_u32(x), ipbuf);
+                       }
                        s = ipbuf;
                        goto str;
  
diff --cc lib/socket.h
Simple merge
diff --cc nest/config.Y
index 890a6d097bce2d32af2ed4ad2db822d0f76d98ec,4566971faa2c063224b1764923137dbf1fd5be95..2961dafb0c466c48e49bdfc18c6f41f70d8702be
@@@ -355,8 -334,8 +355,9 @@@ dev_proto_start: proto_start DIRECT 
  dev_proto:
     dev_proto_start proto_name '{'
   | dev_proto proto_item ';'
 + | dev_proto proto_channel ';'
   | dev_proto dev_iface_patt ';'
+  | dev_proto CHECK LINK bool ';' { DIRECT_CFG->check_link = $4; }
   ;
  
  dev_iface_init:
diff --cc nest/neighbor.c
Simple merge
Simple merge
diff --cc nest/proto.c
index ce859f138e9922ba49d6ef8cc0af1709cb7b81d9,1091b32102a555af97d94bc98a55864d525c9469..f241674875907221af9bacc5b7ef1ddd2e186473
@@@ -1258,8 -920,13 +1259,11 @@@ protos_build(void
    proto_build(&proto_bfd);
    bfd_init_all();
  #endif
+ #ifdef CONFIG_BABEL
+   proto_build(&proto_babel);
+ #endif
  
    proto_pool = rp_new(&root_pool, "Protocols");
 -  proto_flush_event = ev_new(proto_pool);
 -  proto_flush_event->hook = proto_flush_loop;
    proto_shutdown_timer = tm_new(proto_pool);
    proto_shutdown_timer->hook = proto_shutdown_loop;
  }
diff --cc nest/protocol.h
Simple merge
diff --cc nest/route.h
index 865b09073010c9e4c70643cf3022f4bfce801cab,3969db6b77de4b6c270005e3ca9076cf4837d436..b5885ee3fb29c7934ae59b38b859095faeeb1542
@@@ -550,10 -555,13 +558,11 @@@ extern struct protocol *attr_class_to_p
  #define DEF_PREF_DIRECT               240     /* Directly connected */
  #define DEF_PREF_STATIC               200     /* Static route */
  #define DEF_PREF_OSPF         150     /* OSPF intra-area, inter-area and type 1 external routes */
+ #define DEF_PREF_BABEL                130     /* Babel */
  #define DEF_PREF_RIP          120     /* RIP */
  #define DEF_PREF_BGP          100     /* BGP */
 -#define DEF_PREF_PIPE         70      /* Routes piped from other tables */
  #define DEF_PREF_INHERITED    10      /* Routes inherited from other routing daemons */
  
 -
  /*
   *    Route Origin Authorization
   */
diff --cc nest/rt-attr.c
Simple merge
diff --cc nest/rt-dev.c
index 098885b9271b88795b57f75bd223035eb5465065,ed6c06afd70ee4ef53bc4356a4440bf7d059d95e..d98cd79f39965df9092385e9c4876df768b09ca0
@@@ -68,8 -64,11 +68,11 @@@ dev_ifa_notify(struct proto *P, uint fl
  
        DBG("dev_if_notify: %s:%I going up\n", ad->iface->name, ad->ip);
  
 -      if (P->check_link && !(ad->iface->flags & IF_LINK_UP))
++      if (cf->check_link && !(ad->iface->flags & IF_LINK_UP))
+       return;
        /* Use iface ID as local source ID */
 -      struct rte_src *src = rt_get_source(p, ad->iface->index);
 +      struct rte_src *src = rt_get_source(P, ad->iface->index);
  
        rta a0 = {
        .src = src,
      }
  }
  
+ static void
+ dev_if_notify(struct proto *p, uint c, struct iface *iface)
+ {
+   struct rt_dev_config *cf = (void *) p->cf;
+   if (c & (IF_CHANGE_UP | IF_CHANGE_DOWN))
+     return;
+   if ((c & IF_CHANGE_LINK) && cf->check_link)
+   {
+     uint ac = (iface->flags & IF_LINK_UP) ? IF_CHANGE_UP : IF_CHANGE_DOWN;
+     struct ifa *a;
+     WALK_LIST(a, iface->addrs)
+       dev_ifa_notify(p, ac, a);
+   }
+ }
  static struct proto *
 -dev_init(struct proto_config *c)
 +dev_init(struct proto_config *CF)
  {
 -  struct proto *p = proto_new(c, sizeof(struct proto));
 +  struct proto *P = proto_new(CF);
 +  struct rt_dev_proto *p = (void *) P;
 +  // struct rt_dev_config *cf = (void *) CF;
 +
 +  proto_configure_channel(P, &p->ip4_channel, proto_cf_find_channel(CF, NET_IP4));
 +  proto_configure_channel(P, &p->ip6_channel, proto_cf_find_channel(CF, NET_IP6));
 +
++  P->if_notify = dev_if_notify;
 +  P->ifa_notify = dev_ifa_notify;
  
 -  p->if_notify = dev_if_notify;
 -  p->ifa_notify = dev_ifa_notify;
 -  return p;
 +  return P;
  }
  
  static int
 -dev_reconfigure(struct proto *p, struct proto_config *new)
 +dev_reconfigure(struct proto *P, struct proto_config *CF)
  {
 -  struct rt_dev_config *o = (struct rt_dev_config *) p->cf;
 -  struct rt_dev_config *n = (struct rt_dev_config *) new;
 +  struct rt_dev_proto *p = (void *) P;
 +  struct rt_dev_config *o = (void *) P->cf;
 +  struct rt_dev_config *n = (void *) CF;
 +
-   if (!iface_patts_equal(&o->iface_list, &n->iface_list, NULL))
++  if (!iface_patts_equal(&o->iface_list, &n->iface_list, NULL) ||
++      (o->check_link != n->check_link))
 +    return 0;
 +
 +  return
 +    proto_configure_channel(P, &p->ip4_channel, proto_cf_find_channel(CF, NET_IP4)) &&
 +    proto_configure_channel(P, &p->ip6_channel, proto_cf_find_channel(CF, NET_IP6));
  
 -  return iface_patts_equal(&o->iface_list, &n->iface_list, NULL) &&
 -    (o->check_link == n->check_link);
 +  return 1;
  }
  
  static void
diff --cc nest/rt-dev.h
index c901233620ae73afdf3561b48c4d621579e3b508,191b9a0209c8fd3c9012b037caa92b305579cd6e..20b88a64bdad9d89289ae55ec2aa037da6627a1a
  struct rt_dev_config {
    struct proto_config c;
    list iface_list;            /* list of struct iface_patt */
+   int check_link;
  };
  
 +struct rt_dev_proto {
 +  struct proto p;
 +  struct channel *ip4_channel;
 +  struct channel *ip6_channel;
 +};
 +
  #endif
diff --cc nest/rt-table.c
Simple merge
diff --cc proto/bgp/bgp.c
Simple merge
index 614ef08cd3ea29d56eeb469d0813bcf185c281a1,f3ba0e16b72437d014601d8bec892f60c2b697e4..33561bff20affc4d40b997fa2ef8ca82d60ffe3d
@@@ -112,6 -113,13 +113,7 @@@ bgp_proto
   | bgp_proto CAPABILITIES bool ';' { BGP_CFG->capabilities = $3; }
   | bgp_proto ADVERTISE IPV4 bool ';' { BGP_CFG->advertise_ipv4 = $4; }
   | bgp_proto PASSWORD text ';' { BGP_CFG->password = $3; }
 - | bgp_proto ROUTE LIMIT expr ';' {
 -     this_proto->in_limit = cfg_allocz(sizeof(struct proto_limit));
 -     this_proto->in_limit->limit = $4;
 -     this_proto->in_limit->action = PLA_RESTART;
 -     log(L_WARN "%s: Route limit option is deprecated, use import limit", this_proto->name);
 -   }
+  | bgp_proto SETKEY bool ';' { BGP_CFG->setkey = $3; }
   | bgp_proto PASSIVE bool ';' { BGP_CFG->passive = $3; }
   | bgp_proto INTERPRET COMMUNITIES bool ';' { BGP_CFG->interpret_communities = $4; }
   | bgp_proto SECONDARY bool ';' { BGP_CFG->secondary = $3; }
index 5564bee7a1ba0a340b9359da127fcf1bec49ed18,1bbd13724490aae399bc1d44da8edd2baef005a8..b4d2faba45fccbb128e04921539f27b9c69163af
@@@ -552,6 -554,8 +552,8 @@@ lsa_validate_prefix(struct ospf_lsa_hea
  /**
   * lsa_validate - check whether given LSA is valid
   * @lsa: LSA header
 - * @lsa_type: one of %LSA_T_xxx
 - * @ospf2: %true means OSPF version 2, %false means OSPF version 3
++ * @lsa_type: internal LSA type (%LSA_T_xxx)
++ * @ospf2: %true for OSPFv2, %false for OSPFv3
   * @body: pointer to LSA body
   *
   * Checks internal structure of given LSA body (minimal length,
index 35ef7c6ecc6c66ea90c9ee3912c1962d19438a22,04f0d47c3421b77d0bd3f89285b682d9ed5a6b2b..7ce6d99f57944f50c63ff1eb01a4594045d4bb16
@@@ -207,7 -207,7 +207,7 @@@ drop
  /**
   * ospf_rx_hook
   * @sk: socket we received the packet.
-  * @size: size of the packet
 - * @len: size of the packet
++ * @len: length of the packet
   *
   * This is the entry point for messages from neighbors. Many checks (like
   * authentication, checksums, size) are done before the packet is passed to
Simple merge
index 6386940ff24411388bcd92ed2eb0b4c952339367,58644417f9cffda0ea6154f76e0ea94b87f31b4d..3c07a3e7904a5c4f1c106982904d908c239d01c9
@@@ -184,7 -184,7 +184,7 @@@ sk_set_md5_auth(sock *s, ip_addr local 
    struct tcp_md5sig md5;
  
    memset(&md5, 0, sizeof(md5));
-   sockaddr_fill((sockaddr *) &md5.tcpm_addr, fam_to_af[s->fam], a, ifa, 0);
 -  sockaddr_fill((sockaddr *) &md5.tcpm_addr, s->af, remote, ifa, 0);
++  sockaddr_fill((sockaddr *) &md5.tcpm_addr, fam_to_af[s->fam], remote, ifa, 0);
  
    if (passwd)
    {
Simple merge
Simple merge
Simple merge