website:https://frrouting.org/
github:https://github.com/FRRouting/frr
FRRouting (FRR) is an IP routing protocol suite for Linux and Unix platforms which includes protocol daemons for BGP, IS-IS, LDP, OSPF, PIM, and RIP.
FRR’s seamless integration with the native Linux/Unix IP networking stacks makes it applicable to a wide variety of use cases including connecting hosts/VMs/containers to the network, advertising network services, LAN switching and routing, Internet access routers, and Internet peering.
支持的协议列表:
Protocol IPv4 IPv6
OSPF OSPFv2 OSPFv3
ISIS ISIS IPv4 ISIS IPv6
RIP RIP RIPng
BGP BGP IPv4 BGP IPv6
BGP 4-byte AS BGP IPv4 4-byte AS BGP IPv6 4-byte AS
LDP LDP IPv4
每个守护进程使用socket收发报文,以RIP为例:
1、static int rip_create(void)
/* Create read and timer thread. */
rip_event(RIP_READ, rip->sock);
rip_event(RIP_UPDATE_EVENT, 1);
2、void rip_event(enum rip_event event, int sock)
thread_add_read(master, rip_read, NULL, sock, &rip->t_read);
thread_add_timer(master, rip_update, NULL,
sock ? 2 : rip->update_time + jitter,
&rip->t_update);
3、static int rip_read(struct thread *t)
len = recvfrom(sock, (char *)&rip_buf.buf, sizeof(rip_buf.buf), 0,
(struct sockaddr *)&from, &fromlen);
4、static int rip_send_packet(u_char *buf, int size, struct sockaddr_in *to, struct connected *ifc)
ret = sendto(rip->sock, buf, size, 0, (struct sockaddr *)&sin,
sizeof(struct sockaddr_in));