Skip to content

How to fetch BGP routes from the FRR - ZAPI example #11965

Discussion options

You must be logged in to vote

Figured out the issue: - I missed to add the data payload as part of the length parameter.
Here is the updated code for other's references. Thanks.

package main

import (
	"encoding/binary"
	"fmt"
	"io"
	"net"
)

const (
	// Zebra API - ZAPI unix socket address
	ZAPI_SERV_ADDRESS = "/var/run/frr/zserv.api"
)

const (
	ZAPI_HEADER_SIZE   uint16 = 10
	ZAPI_HEADER_MARKER uint8  = 254
	ZAPI_VERSION       uint8  = 6
	DEFAULT_VRF        uint32 = 0

	ZAPI_HELLO            uint16 = 18
	ZAPI_REDISTRIBUTE_ADD uint16 = 11

	routeSystem  uint8 = 0
	routeKernel  uint8 = 1
	routeConnect uint8 = 2
	RouteStatic  uint8 = 3
	RouteBGP     uint8 = 9
)

func main() {
	conn, err := net.Dial("unix", ZAPI_SERV_A…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by sakthishanmugam02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant