[Olsr-dev] [PATCH] This adds a patch for quagga 0.99.24 in order to work with olsrd's quagga plugin.

Ferry Huberts (spam-protected)
Mon Nov 23 21:23:36 CET 2015


I'll not take this patch until someone else signs off on it.

Vasilis?

On 23/11/15 21:14, Christian Pointner wrote:
> Signed-off-by: Christian Pointner <(spam-protected)>
> ---
>   lib/quagga/patches/quagga-0.99.24.diff | 279 +++++++++++++++++++++++++++++++++
>   1 file changed, 279 insertions(+)
>   create mode 100644 lib/quagga/patches/quagga-0.99.24.diff
>
> diff --git a/lib/quagga/patches/quagga-0.99.24.diff b/lib/quagga/patches/quagga-0.99.24.diff
> new file mode 100644
> index 0000000..537b853
> --- /dev/null
> +++ b/lib/quagga/patches/quagga-0.99.24.diff
> @@ -0,0 +1,279 @@
> +diff --git a/lib/log.c b/lib/log.c
> +index f02e4c7..0ceb036 100644
> +--- a/lib/log.c
> ++++ b/lib/log.c
> +@@ -971,13 +971,19 @@ proto_redistnum(int afi, const char *s)
> + 	return ZEBRA_ROUTE_STATIC;
> +       else if (strncmp (s, "r", 1) == 0)
> + 	return ZEBRA_ROUTE_RIP;
> +-      else if (strncmp (s, "o", 1) == 0)
> ++      else if (strncmp (s, "os", 2) == 0)
> + 	return ZEBRA_ROUTE_OSPF;
> +       else if (strncmp (s, "i", 1) == 0)
> + 	return ZEBRA_ROUTE_ISIS;
> +       else if (strncmp (s, "bg", 2) == 0)
> + 	return ZEBRA_ROUTE_BGP;
> +-      else if (strncmp (s, "ba", 2) == 0)
> ++      else if (strncmp (s, "h", 1) == 0)
> ++	return ZEBRA_ROUTE_HSLS;
> ++      else if (strncmp (s, "ol", 2) == 0)
> ++	return ZEBRA_ROUTE_OLSR;
> ++      else if (strncmp (s, "bat", 3) == 0)
> ++	return ZEBRA_ROUTE_BATMAN;
> ++      else if (strncmp (s, "bab", 3) == 0)
> + 	return ZEBRA_ROUTE_BABEL;
> +     }
> +   if (afi == AFI_IP6)
> +@@ -990,13 +996,19 @@ proto_redistnum(int afi, const char *s)
> + 	return ZEBRA_ROUTE_STATIC;
> +       else if (strncmp (s, "r", 1) == 0)
> + 	return ZEBRA_ROUTE_RIPNG;
> +-      else if (strncmp (s, "o", 1) == 0)
> ++      else if (strncmp (s, "os", 2) == 0)
> + 	return ZEBRA_ROUTE_OSPF6;
> +       else if (strncmp (s, "i", 1) == 0)
> + 	return ZEBRA_ROUTE_ISIS;
> +       else if (strncmp (s, "bg", 2) == 0)
> + 	return ZEBRA_ROUTE_BGP;
> +-      else if (strncmp (s, "ba", 2) == 0)
> ++      else if (strncmp (s, "h", 1) == 0)
> ++	return ZEBRA_ROUTE_HSLS;
> ++      else if (strncmp (s, "ol", 2) == 0)
> ++	return ZEBRA_ROUTE_OLSR;
> ++      else if (strncmp (s, "bat", 3) == 0)
> ++	return ZEBRA_ROUTE_BATMAN;
> ++      else if (strncmp (s, "bab", 3) == 0)
> + 	return ZEBRA_ROUTE_BABEL;
> +     }
> +   return -1;
> +diff --git a/lib/route_types.txt b/lib/route_types.txt
> +index 1b85607..2dfd145 100644
> +--- a/lib/route_types.txt
> ++++ b/lib/route_types.txt
> +@@ -51,15 +51,11 @@ ZEBRA_ROUTE_OSPF,       ospf,      ospfd,  'O', 1, 0, "OSPF"
> + ZEBRA_ROUTE_OSPF6,      ospf6,     ospf6d, 'O', 0, 1, "OSPFv6"
> + ZEBRA_ROUTE_ISIS,       isis,      isisd,  'I', 1, 1, "IS-IS"
> + ZEBRA_ROUTE_BGP,        bgp,       bgpd,   'B', 1, 1, "BGP"
> +-ZEBRA_ROUTE_PIM,	pim,	   pimd,   'P', 1, 0, "PIM"
> +-# HSLS and OLSR both are AFI independent (so: 1, 1), however
> +-# we want to disable for them for general Quagga distribution.
> +-# This at least makes it trivial for users of these protocols
> +-# to 'switch on' redist support (direct numeric entry remaining
> +-# possible).
> +-ZEBRA_ROUTE_HSLS,       hsls,      hslsd,  'H', 0, 0, "HSLS"
> +-ZEBRA_ROUTE_OLSR,       olsr,      olsrd,  'o', 0, 0, "OLSR"
> ++ZEBRA_ROUTE_HSLS,       hsls,      hslsd,  'H', 1, 1, "HSLS"
> ++ZEBRA_ROUTE_OLSR,       olsr,      olsrd,  'o', 1, 1, "OLSR"
> ++ZEBRA_ROUTE_BATMAN,     batman,    batmand,'b', 1, 1, "BATMAN"
> + ZEBRA_ROUTE_BABEL,      babel,     babeld, 'A', 1, 1, "Babel"
> ++ZEBRA_ROUTE_PIM,        pim,       pimd,   'P', 1, 0, "PIM"
> +
> + ## help strings
> + ZEBRA_ROUTE_SYSTEM, "Reserved route type, for internal use only"
> +@@ -74,5 +70,6 @@ ZEBRA_ROUTE_ISIS,   "Intermediate System to Intermediate System (IS-IS)"
> + ZEBRA_ROUTE_BGP,    "Border Gateway Protocol (BGP)"
> + ZEBRA_ROUTE_PIM,    "Protocol Independent Multicast (PIM)"
> + ZEBRA_ROUTE_HSLS,   "Hazy-Sighted Link State Protocol (HSLS)"
> +-ZEBRA_ROUTE_OLSR,   "Optimised Link State Routing (OLSR)"
> ++ZEBRA_ROUTE_OLSR,   "Optimized Link State Routing (OLSR)"
> ++ZEBRA_ROUTE_BATMAN, "Better Approach to Mobile Ad-Hoc Networking (BATMAN)"
> + ZEBRA_ROUTE_BABEL,  "Babel routing protocol (Babel)"
> +diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c
> +index b005ece..0e1e52e 100644
> +--- a/ripd/rip_zebra.c
> ++++ b/ripd/rip_zebra.c
> +@@ -238,9 +238,12 @@ static struct {
> +   {ZEBRA_ROUTE_KERNEL,  1, "kernel"},
> +   {ZEBRA_ROUTE_CONNECT, 1, "connected"},
> +   {ZEBRA_ROUTE_STATIC,  1, "static"},
> +-  {ZEBRA_ROUTE_OSPF,    1, "ospf"},
> ++  {ZEBRA_ROUTE_OSPF,    2, "ospf"},
> +   {ZEBRA_ROUTE_BGP,     2, "bgp"},
> +-  {ZEBRA_ROUTE_BABEL,   2, "babel"},
> ++  {ZEBRA_ROUTE_HSLS,    1, "hsls"},
> ++  {ZEBRA_ROUTE_OLSR,    2, "olsr"},
> ++  {ZEBRA_ROUTE_BATMAN,  3, "batman"},
> ++  {ZEBRA_ROUTE_BABEL,   3, "babel"},
> +   {0, 0, NULL}
> + };
> +
> +diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c
> +index 68f37be..aa54bbe 100644
> +--- a/ripngd/ripng_zebra.c
> ++++ b/ripngd/ripng_zebra.c
> +@@ -216,9 +216,12 @@ static struct {
> +   {ZEBRA_ROUTE_KERNEL,  1, "kernel"},
> +   {ZEBRA_ROUTE_CONNECT, 1, "connected"},
> +   {ZEBRA_ROUTE_STATIC,  1, "static"},
> +-  {ZEBRA_ROUTE_OSPF6,   1, "ospf6"},
> ++  {ZEBRA_ROUTE_OSPF6,   2, "ospf6"},
> +   {ZEBRA_ROUTE_BGP,     2, "bgp"},
> +-  {ZEBRA_ROUTE_BABEL,   2, "babel"},
> ++  {ZEBRA_ROUTE_HSLS,    1, "hsls"},
> ++  {ZEBRA_ROUTE_OLSR,    2, "olsr"},
> ++  {ZEBRA_ROUTE_BATMAN,  3, "batman"},
> ++  {ZEBRA_ROUTE_BABEL,   3, "babel"},
> +   {0, 0, NULL}
> + };
> +
> +diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
> +index 2350070..d49a6e2 100644
> +--- a/zebra/rt_netlink.c
> ++++ b/zebra/rt_netlink.c
> +@@ -1457,6 +1457,7 @@ static void
> + _netlink_route_build_singlepath(
> +         const char *routedesc,
> +         int bytelen,
> ++        struct rib *rib,
> +         struct nexthop *nexthop,
> +         struct nlmsghdr *nlmsg,
> +         struct rtmsg *rtmsg,
> +@@ -1506,6 +1507,9 @@ _netlink_route_build_singlepath(
> +         addattr_l (nlmsg, req_size, RTA_PREFSRC,
> +                    &nexthop->src.ipv4, bytelen);
> +
> ++      if (rib->type == ZEBRA_ROUTE_OLSR)
> ++        rtmsg->rtm_scope = RT_SCOPE_LINK;
> ++
> +       if (IS_ZEBRA_DEBUG_KERNEL)
> +         zlog_debug("netlink_route_multipath() (%s): "
> +                    "nexthop via if %u", routedesc, nexthop->ifindex);
> +@@ -1755,7 +1759,7 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
> +               routedesc = recursing ? "recursive, 1 hop" : "single hop";
> +
> +               _netlink_route_debug(cmd, p, nexthop, routedesc, family);
> +-              _netlink_route_build_singlepath(routedesc, bytelen,
> ++              _netlink_route_build_singlepath(routedesc, bytelen, rib,
> +                                               nexthop, &req.n, &req.r,
> +                                               sizeof req);
> +
> +diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
> +index 0750e6e..faa314f 100644
> +--- a/zebra/zebra_rib.c
> ++++ b/zebra/zebra_rib.c
> +@@ -68,6 +68,9 @@ static const struct
> +   [ZEBRA_ROUTE_OSPF6]   = {ZEBRA_ROUTE_OSPF6,   110},
> +   [ZEBRA_ROUTE_ISIS]    = {ZEBRA_ROUTE_ISIS,    115},
> +   [ZEBRA_ROUTE_BGP]     = {ZEBRA_ROUTE_BGP,      20  /* IBGP is 200. */},
> ++  [ZEBRA_ROUTE_HSLS]    = {ZEBRA_ROUTE_HSLS,      0},
> ++  [ZEBRA_ROUTE_OLSR]    = {ZEBRA_ROUTE_OLSR,      0},
> ++  [ZEBRA_ROUTE_BATMAN]  = {ZEBRA_ROUTE_BATMAN,    0},
> +   [ZEBRA_ROUTE_BABEL]   = {ZEBRA_ROUTE_BABEL,    95},
> +   /* no entry/default: 150 */
> + };
> +@@ -575,6 +578,18 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set,
> + 		  }
> + 	      return resolved;
> + 	    }
> ++	  else if (match->type == ZEBRA_ROUTE_OLSR)
> ++	    {
> ++	      for (newhop = match->nexthop; newhop; newhop = newhop->next)
> ++		if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB)
> ++		    && newhop->type == NEXTHOP_TYPE_IFINDEX)
> ++		  {
> ++		    if (nexthop->type == NEXTHOP_TYPE_IPV4)
> ++		      nexthop->ifindex = newhop->ifindex;
> ++		    return 1;
> ++		  }
> ++	      return 0;
> ++	    }
> + 	  else
> + 	    {
> + 	      return 0;
> +@@ -711,6 +726,18 @@ nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set,
> + 		  }
> + 	      return resolved;
> + 	    }
> ++	  else if (match->type == ZEBRA_ROUTE_OLSR)
> ++	    {
> ++	      for (newhop = match->nexthop; newhop; newhop = newhop->next)
> ++		if (CHECK_FLAG (newhop->flags, NEXTHOP_FLAG_FIB)
> ++		    && newhop->type == NEXTHOP_TYPE_IFINDEX)
> ++		  {
> ++		    if (nexthop->type == NEXTHOP_TYPE_IPV6)
> ++		      nexthop->ifindex = newhop->ifindex;
> ++		    return 1;
> ++		  }
> ++	      return 0;
> ++	    }
> + 	  else
> + 	    {
> + 	      return 0;
> +@@ -1630,6 +1657,8 @@ static const u_char meta_queue_map[ZEBRA_ROUTE_MAX] = {
> +   [ZEBRA_ROUTE_ISIS]    = 2,
> +   [ZEBRA_ROUTE_BGP]     = 3,
> +   [ZEBRA_ROUTE_HSLS]    = 4,
> ++  [ZEBRA_ROUTE_OLSR]    = 4,
> ++  [ZEBRA_ROUTE_BATMAN]  = 4,
> +   [ZEBRA_ROUTE_BABEL]   = 2,
> + };
> +
> +diff --git a/zebra/zebra_snmp.c b/zebra/zebra_snmp.c
> +index f0d3e7e..f0a2e9f 100644
> +--- a/zebra/zebra_snmp.c
> ++++ b/zebra/zebra_snmp.c
> +@@ -245,6 +245,12 @@ proto_trans(int type)
> +       return 1; /* shouldn't happen */
> +     case ZEBRA_ROUTE_BGP:
> +       return 14; /* bgp */
> ++    case ZEBRA_ROUTE_HSLS:
> ++      return 1; /* other */
> ++    case ZEBRA_ROUTE_OLSR:
> ++      return 1; /* other */
> ++    case ZEBRA_ROUTE_BATMAN:
> ++      return 1; /* other */
> +     default:
> +       return 1; /* other */
> +     }
> +diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
> +index 1e39ebd..5ed03bf 100644
> +--- a/zebra/zebra_vty.c
> ++++ b/zebra/zebra_vty.c
> +@@ -731,7 +731,10 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn, int mcast)
> + 	  || rib->type == ZEBRA_ROUTE_OSPF
> + 	  || rib->type == ZEBRA_ROUTE_BABEL
> + 	  || rib->type == ZEBRA_ROUTE_ISIS
> +-	  || rib->type == ZEBRA_ROUTE_BGP)
> ++	  || rib->type == ZEBRA_ROUTE_BGP
> ++	  || rib->type == ZEBRA_ROUTE_HSLS
> ++	  || rib->type == ZEBRA_ROUTE_OLSR
> ++	  || rib->type == ZEBRA_ROUTE_BATMAN)
> + 	{
> + 	  time_t uptime;
> + 	  struct tm *tm;
> +@@ -926,7 +929,10 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
> + 	  || rib->type == ZEBRA_ROUTE_OSPF
> + 	  || rib->type == ZEBRA_ROUTE_BABEL
> + 	  || rib->type == ZEBRA_ROUTE_ISIS
> +-	  || rib->type == ZEBRA_ROUTE_BGP)
> ++	  || rib->type == ZEBRA_ROUTE_BGP
> ++	  || rib->type == ZEBRA_ROUTE_HSLS
> ++	  || rib->type == ZEBRA_ROUTE_OLSR
> ++	  || rib->type == ZEBRA_ROUTE_BATMAN)
> + 	{
> + 	  time_t uptime;
> + 	  struct tm *tm;
> +@@ -1827,7 +1833,10 @@ vty_show_ipv6_route_detail (struct vty *vty, struct route_node *rn)
> + 	  || rib->type == ZEBRA_ROUTE_OSPF6
> + 	  || rib->type == ZEBRA_ROUTE_BABEL
> + 	  || rib->type == ZEBRA_ROUTE_ISIS
> +-	  || rib->type == ZEBRA_ROUTE_BGP)
> ++	  || rib->type == ZEBRA_ROUTE_BGP
> ++	  || rib->type == ZEBRA_ROUTE_HSLS
> ++	  || rib->type == ZEBRA_ROUTE_OLSR
> ++	  || rib->type == ZEBRA_ROUTE_BATMAN)
> + 	{
> + 	  time_t uptime;
> + 	  struct tm *tm;
> +@@ -1969,7 +1978,10 @@ vty_show_ipv6_route (struct vty *vty, struct route_node *rn,
> + 	  || rib->type == ZEBRA_ROUTE_OSPF6
> + 	  || rib->type == ZEBRA_ROUTE_BABEL
> + 	  || rib->type == ZEBRA_ROUTE_ISIS
> +-	  || rib->type == ZEBRA_ROUTE_BGP)
> ++	  || rib->type == ZEBRA_ROUTE_BGP
> ++	  || rib->type == ZEBRA_ROUTE_HSLS
> ++	  || rib->type == ZEBRA_ROUTE_OLSR
> ++	  || rib->type == ZEBRA_ROUTE_BATMAN)
> + 	{
> + 	  time_t uptime;
> + 	  struct tm *tm;
>

-- 
Ferry Huberts



More information about the Olsr-dev mailing list