Skip to content

Instantly share code, notes, and snippets.

View rwestphal's full-sized avatar

Renato Westphal rwestphal

View GitHub Profile
# +---------+
# | |
# | RT1 |
# | 1.1.1.1 |
# | |
# +---------+
# |rt1-eth0 (.1)
# |
# |10.0.1.0/24
# |
int nb_db_set_max_transactions(unsigned int max)
{
#ifdef HAVE_CONFIG_ROLLBACKS
int ret;
/*
* Delete old entries if necessary and update the SQL trigger that
* auto-deletes old entries.
*/
ret = db_execute(
static int nb_db_init(void)
{
#ifdef HAVE_CONFIG_ROLLBACKS
int ret;
ret = db_execute(
" \
BEGIN TRANSACTION; \
CREATE TABLE IF NOT EXISTS TRANSACTIONS( \
ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, \
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <err.h>
ripd# conf t
ripd(config)# router rip
ripd(config-router)# network eth2
ripd(config-router)# show configuration candidate changes
@@ -14,6 +14,7 @@
distance 25 172.16.1.0/24
network eth0
network eth1
+ network eth2
redistribute ospf metric 3
# +---------+ +---------+
# | | global | |
# | |rt1-eth0 rt2-eth0| |
# | +-------------------+ |
# | | 10.0.0.0/24 | |
# | | | |
# | | VRF RED | |
# | |rt1-eth1 rt2-eth1| |
# | RT1 +-------------------+ RT2 |
# | | 10.0.1.0/24 | |
# +---------+
# | |
# | RT1 |
# | 1.1.1.1 |
# | |
# +---------+
# |rt1-eth0 (.1)
# |
# |10.0.1.0/24
# |
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <err.h>
#include <libyang/libyang.h>
static struct ly_ctx *ly_ctx;
# +-----------+
# +--------+rt2-eth0 rt1-eth0| |rt1-eth7 rt9-eth0+--------+
# | rt2 +-----------------------+ +-----------------------+ rt9 |
# +--------+ (ah-md5) | | (esp-3des/ah-sha1) +--------+
# | |
# +--------+rt3-eth0 rt1-eth1| |rt1-eth8 rt10-eth0+--------+
# | rt3 +-----------------------+ +-----------------------+ rt10 |
# +--------+ (ah-sha1) | | (esp-aes-128/ah-md5) +--------+
# | |
# +--------+rt4-eth0 rt1-eth2| |rt1-eth9 rt11-eth0+--------+
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <err.h>
#include <assert.h>
#include <arpa/inet.h>
#include <stdbool.h>
#include <libyang/libyang.h>