1FPM 2=== 3 4FPM stands for Forwarding Plane Manager and it's a module for use with Zebra. 5 6The encapsulation header for the messages exchanged with the FPM is 7defined by the file :file:`fpm/fpm.h` in the frr tree. The routes 8themselves are encoded in Netlink or protobuf format, with Netlink 9being the default. 10 11Netlink is standard format for encoding messages to talk with kernel space 12in Linux and it is also the name of the socket type used by it. 13The FPM netlink usage differs from Linux's in: 14 15- Linux netlink sockets use datagrams in a multicast fashion, FPM uses 16 as a stream and it is unicast. 17- FPM netlink messages might have more or less information than a normal 18 Linux netlink socket message (example: RTM_NEWROUTE might add an extra 19 route attribute to signalize VxLAN encapsulation). 20 21Protobuf is one of a number of new serialization formats wherein the 22message schema is expressed in a purpose-built language. Code for 23encoding/decoding to/from the wire format is generated from the 24schema. Protobuf messages can be extended easily while maintaining 25backward-compatibility with older code. Protobuf has the following 26advantages over Netlink: 27 28- Code for serialization/deserialization is generated automatically. This 29 reduces the likelihood of bugs, allows third-party programs to be integrated 30 quickly, and makes it easy to add fields. 31- The message format is not tied to an OS (Linux), and can be evolved 32 independently. 33 34.. note:: 35 36 Currently there are two FPM modules in ``zebra``: 37 38 * ``fpm`` 39 * ``dplane_fpm_nl`` 40 41fpm 42^^^ 43 44The first FPM implementation that was built using hooks in ``zebra`` route 45handling functions. It uses its own netlink/protobuf encoding functions to 46translate ``zebra`` route data structures into formatted binary data. 47 48 49dplane_fpm_nl 50^^^^^^^^^^^^^ 51 52The newer FPM implementation that was built using ``zebra``'s data plane 53framework as a plugin. It only supports netlink and it shares ``zebra``'s 54netlink functions to translate route event snapshots into formatted binary 55data. 56 57 58Protocol Specification 59---------------------- 60 61FPM (in any mode) uses a TCP connection to talk with external applications. 62It operates as TCP client and uses the CLI configured address/port to connect 63to the FPM server (defaults to port ``2620``). 64 65FPM frames all data with a header to help the external reader figure how 66many bytes it has to read in order to read the full message (this helps 67simulates datagrams like in the original netlink Linux kernel usage). 68 69Frame header: 70 71:: 72 73 0 1 2 3 74 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 75 +---------------+---------------+-------------------------------+ 76 | Version | Message type | Message length | 77 +---------------+---------------+-------------------------------+ 78 | Data... | 79 +---------------------------------------------------------------+ 80 81 82Version 83^^^^^^^ 84 85Currently there is only one version, so it should be always ``1``. 86 87 88Message Type 89^^^^^^^^^^^^ 90 91Defines what underlining protocol we are using: netlink (``1``) or protobuf (``2``). 92 93 94Message Length 95^^^^^^^^^^^^^^ 96 97Amount of data in this frame in network byte order. 98 99 100Data 101^^^^ 102 103The netlink or protobuf message payload. 104