bug-zebra
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] table-id extension to zapi


From: Arnold, Gilad
Subject: [PATCH] table-id extension to zapi
Date: Sun, 27 Jan 2002 13:05:20 +0200

Hi,

Following is a small patch extending the Zebra API (used between the
zebra daemon and protocol daemons) to support table ID being passed
along.  Currently, the table character is unavailable through ZAPI,
although rib.c handles non-default table identifiers.

I agree this patch hasn't to do directly with present Zebra
functionality, since Zebra is currently designed for single RIB support.
However, the extension is of generic nature, retains the default
behavior of current protocol daemons, is backward compatible, and... we
might be needing it in the near future for other extensions (multiple
RIBs, etc.).

Please let me know whether you do / don't insert it into cvs.

Regards,
G.

---


Index: lib/zclient.c
===================================================================
RCS file: /cvsroot/zebra/lib/zclient.c,v
retrieving revision 1.44
diff -c -r1.44 zclient.c
*** lib/zclient.c       12 Aug 2001 04:03:38 -0000      1.44
--- lib/zclient.c       27 Jan 2002 10:48:27 -0000
***************
*** 335,340 ****
--- 335,342 ----
      stream_putc (s, api->distance);
    if (CHECK_FLAG (api->message, ZAPI_MESSAGE_METRIC))
      stream_putl (s, api->metric);
+   if (CHECK_FLAG (api->message, ZAPI_MESSAGE_TABLE))
+     stream_putc (s, api->table);
  
    /* Put length at the first point of the stream. */
    stream_putw_at (s, 0, stream_get_endp (s));
***************
*** 389,394 ****
--- 391,398 ----
      stream_putc (s, api->distance);
    if (CHECK_FLAG (api->message, ZAPI_MESSAGE_METRIC))
      stream_putl (s, api->metric);
+   if (CHECK_FLAG (api->message, ZAPI_MESSAGE_TABLE))
+     stream_putc (s, api->table);
  
    /* Put length at the first point of the stream. */
    stream_putw_at (s, 0, stream_get_endp (s));
Index: lib/zclient.h
===================================================================
RCS file: /cvsroot/zebra/lib/zclient.h,v
retrieving revision 1.19
diff -c -r1.19 zclient.h
*** lib/zclient.h       11 Jan 2001 01:07:27 -0000      1.19
--- lib/zclient.h       27 Jan 2002 10:48:28 -0000
***************
*** 79,84 ****
--- 79,85 ----
  #define ZAPI_MESSAGE_IFINDEX  0x02
  #define ZAPI_MESSAGE_DISTANCE 0x04
  #define ZAPI_MESSAGE_METRIC   0x08
+ #define ZAPI_MESSAGE_TABLE    0x10
  
  /* Zebra IPv4 route message API. */
  struct zapi_ipv4
***************
*** 98,103 ****
--- 99,106 ----
    u_char distance;
  
    u_int32_t metric;
+   
+   u_char table;
  };
  
  int
Index: zebra/zserv.c
===================================================================
RCS file: /cvsroot/zebra/zebra/zserv.c,v
retrieving revision 1.53
diff -c -r1.53 zserv.c
*** zebra/zserv.c       27 Aug 2001 08:59:37 -0000      1.53
--- zebra/zserv.c       27 Jan 2002 10:48:28 -0000
***************
*** 960,966 ****
    /* Metric. */
    if (CHECK_FLAG (message, ZAPI_MESSAGE_METRIC))
      rib->metric = stream_getl (s);
!     
    rib_add_ipv4_multipath (&p, rib);
  }
  
--- 960,970 ----
    /* Metric. */
    if (CHECK_FLAG (message, ZAPI_MESSAGE_METRIC))
      rib->metric = stream_getl (s);
!   
!   /* Table. */
!   if (CHECK_FLAG (message, ZAPI_MESSAGE_TABLE))
!     rib->table = stream_getc (s);
! 
    rib_add_ipv4_multipath (&p, rib);
  }
  
***************
*** 1032,1040 ****
      api.metric = stream_getl (s);
    else
      api.metric = 0;
      
    rib_delete_ipv4 (api.type, api.flags, &p, &nexthop, ifindex,
!                  client->rtm_table);
  }
  
  /* Nexthop lookup for IPv4. */
--- 1036,1050 ----
      api.metric = stream_getl (s);
    else
      api.metric = 0;
+   
+   /* Table. */
+   if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TABLE))
+     api.table = stream_getc (s);
+   else
+     api.table = client->rtm_table;
      
    rib_delete_ipv4 (api.type, api.flags, &p, &nexthop, ifindex,
!                  api.table);
  }
  
  /* Nexthop lookup for IPv4. */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]