New upstream version 1.2.3
[quagga-debian.git] / doc / protocol.texi
1 @node  Zebra Protocol
2 @appendix Zebra Protocol
3 @appendixsection Overview of the Zebra Protocol
4
5 Zebra Protocol is used by protocol daemons to communicate with the
6 zebra daemon.
7
8 Each protocol daemon may request and send information to and from the
9 zebra daemon such as interface states, routing state,
10 nexthop-validation, and so on. Protocol daemons may also install routes
11 with zebra. The zebra daemon manages which route is installed into the
12 forwarding table with the kernel.
13
14 Zebra Protocol is a streaming protocol, with a common header.  The protocol
15 is versioned to allow for incompatible changes.  Version 0 is implicitely
16 versioned.  Version 1 onwards has an explicit version field.  Version 0 can
17 be distinguished from all other versions by examining the 3rd byte of the
18 header, which contains a marker value of 255 for all versions bar version 0. 
19 The marker byte corresponds to the command field in version 0, and the
20 marker value is a reserved command in version 0.
21
22 Version 0 is used by all versions of GNU Zebra as of this writing, and
23 versions of Quagga up to and including Quagga 0.98.  The version 1 header
24 was introduced with Quagga 0.99.3.  The version 3 header was introduced with
25 Quagga 1.0.20160309.
26
27 @appendixsection Zebra Protocol Definition
28 @appendixsubsec Zebra Protocol Header (version 0)
29 @example
30 @group
31 0                   1                   2                   3
32 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
33 +-------------------------------+---------------+
34 |           Length (2)          |   Command (1) |
35 +-------------------------------+---------------+
36 @end group
37 @end example
38
39 @appendixsubsec Zebra Protocol Common Header (version 1 and 2)
40 @example
41 @group
42 0                   1                   2                   3
43 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
44 +-------------------------------+---------------+-------------+
45 |           Length (2)          |   Marker (1)  | Version (1) |
46 +-------------------------------+---------------+-------------+
47 |          Command (2)          |
48 +-------------------------------+
49 @end group
50 @end example
51
52 @appendixsubsec Zebra Protocol Common Header (version 3)
53 @example
54 @group
55 0                   1                   2                   3
56 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
57 +-------------------------------+---------------+-------------+
58 |           Length (2)          |   Marker (1)  | Version (1) |
59 +-------------------------------+---------------+-------------+
60 |          VRF ID  (2)          |        Command (2)          |
61 +-------------------------------+-----------------------------+
62 @end group
63 @end example
64
65
66 @appendixsubsec Zebra Protocol Header Field Definitions
67 @table @samp
68 @item Length
69 Total packet length including this header. The minimum length is 3
70 bytes for version 0 messages, 6 bytes for version 1 and 2 messages, and
71 8 bytes for version 3.
72
73 @item Marker
74 Static marker with a value of 255 always. This is to allow version 0
75 Zserv headers (which do not include version explicitely) to be
76 distinguished from versioned headers. Not present in version 0
77 messages.
78
79 @item Version
80 Version number of the Zserv message. Clients should not continue
81 processing messages past the version field for versions they do not
82 recognise. Not present in version 0 messages.
83
84 @item VRF ID
85 Virtual Routing/Forwarding context ID, to which the message applies. Only
86 present from version 3 onwards.
87
88 @item Command
89 The Zebra Protocol command.
90 @end table
91
92 @appendixsubsec Zebra Protocol Commands
93 @multitable {ZEBRA_REDISTRIBUTE_DEFAULT_DELETE_WHATEVER} {99999}
94 @headitem Command @tab Value
95 @item ZEBRA_INTERFACE_ADD       
96 @tab 1
97 @item ZEBRA_INTERFACE_DELETE
98 @tab 2
99 @item ZEBRA_INTERFACE_ADDRESS_ADD
100 @tab 3
101 @item ZEBRA_INTERFACE_ADDRESS_DELETE
102 @tab 4
103 @item ZEBRA_INTERFACE_UP
104 @tab 5
105 @item ZEBRA_INTERFACE_DOWN
106 @tab 6
107 @item ZEBRA_IPV4_ROUTE_ADD
108 @tab 7
109 @item ZEBRA_IPV4_ROUTE_DELETE
110 @tab 8
111 @item ZEBRA_IPV6_ROUTE_ADD
112 @tab 9
113 @item ZEBRA_IPV6_ROUTE_DELETE
114 @tab 10
115 @item ZEBRA_REDISTRIBUTE_ADD
116 @tab 11
117 @item ZEBRA_REDISTRIBUTE_DELETE
118 @tab 12
119 @item ZEBRA_REDISTRIBUTE_DEFAULT_ADD
120 @tab 13
121 @item ZEBRA_REDISTRIBUTE_DEFAULT_DELETE
122 @tab 14
123 @item ZEBRA_IPV4_NEXTHOP_LOOKUP
124 @tab 15
125 @item ZEBRA_IPV6_NEXTHOP_LOOKUP
126 @tab 16
127 @end multitable