Merge remote-tracking branch 'origin/stable/3.0'

This commit is contained in:
Donald Sharp 2017-04-25 10:42:14 -04:00
commit 1876a731a4
26 changed files with 411 additions and 134 deletions

View File

@ -31,9 +31,9 @@ any packages**
sudo addgroup --system --gid 92 frr
sudo addgroup --system --gid 85 frrvty
sudo adduser --system --ingroup frr --groups frrvty --home /var/run/frr/ \
--gecos "FRR FRRouting suite" --shell /bin/false frr
sudo usermode
sudo adduser --system --ingroup frr --home /var/run/frr/ \
--gecos "FRR suite" --shell /bin/false frr
sudo usermod -a -G frrvty frr
### Download Source, configure and compile it
(You may prefer different options on configure statement. These are just
@ -62,6 +62,7 @@ an example.)
--enable-rtadv \
--enable-tcp-zebra \
--enable-fpm \
--enable-ldpd \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
make
@ -69,6 +70,7 @@ an example.)
sudo make install
### Create empty FRR configuration files
sudo install -m 755 -o frr -g frr -d /var/log/frr
sudo install -m 775 -o frr -g frrvty -d /etc/frr
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/zebra.conf
@ -79,6 +81,8 @@ an example.)
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf
sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf
### Enable IP & IPv6 forwarding
@ -94,4 +98,4 @@ other settings)
# based on Router Advertisements for this host
net.ipv6.conf.all.forwarding=1
**Reboot** or use `sysctl` to apply the same config to the running system
**Reboot** or use `sysctl -p` to apply the same config to the running system

View File

@ -70,6 +70,7 @@ them if you are not building on a x86_64 architecture
sudo touch /etc/frr/ripngd.conf
sudo touch /etc/frr/pimd.conf
sudo touch /etc/frr/ldpd.conf
sudo touch /etc/frr/nhrpd.conf
sudo chown -R frr:frr /etc/frr/
sudo touch /etc/frr/vtysh.conf
sudo chown frr:frrvt /etc/frr/vtysh.conf
@ -111,7 +112,7 @@ Create a new file `/etc/modules-load.d/mpls.conf` with the following content:
install -p -m 644 redhat/ospf6d.service /usr/lib/systemd/system/ospf6d.service
install -p -m 644 redhat/ripngd.service /usr/lib/systemd/system/ripngd.service
install -p -m 644 redhat/pimd.service /usr/lib/systemd/system/pimd.service
install -p -m 644 redhat/pimd.service /usr/lib/systemd/system/ldpd.service
install -p -m 644 redhat/ldpd.service /usr/lib/systemd/system/ldpd.service
install -p -m 644 redhat/frr.sysconfig /etc/sysconfig/frr
install -p -m 644 redhat/frr.logrotate /etc/logrotate.d/frr

View File

@ -75,6 +75,7 @@ an example)
sudo touch /etc/frr/ripngd.conf
sudo touch /etc/frr/pimd.conf
sudo touch /etc/frr/ldpd.conf
sudo touch /etc/frr/nhrpd.conf
sudo chown -R _frr:_frr /etc/frr
sudo touch /etc/frr/vtysh.conf
sudo chown -R _frr:_frrvty /etc/frr/vtysh.conf

View File

@ -65,8 +65,9 @@ any packages**
sudo groupadd -g 92 frr
sudo groupadd -r -g 85 frrvty
sudo adduser --system --ingroup frr --groups frrvty --home /var/run/frr/ \
sudo adduser --system --ingroup frr --home /var/run/frr/ \
--gecos "FRR suite" --shell /sbin/nologin frr
sudo usermod -a -G frrvty frr
### Download Source, configure and compile it
(You may prefer different options on configure statement. These are just
@ -101,22 +102,19 @@ an example.)
### Create empty FRR configuration files
sudo mkdir /var/log/frr
sudo chown frr:frr /var/log/frr
sudo mkdir /etc/frr
sudo touch /etc/frr/zebra.conf
sudo touch /etc/frr/bgpd.conf
sudo touch /etc/frr/ospfd.conf
sudo touch /etc/frr/ospf6d.conf
sudo touch /etc/frr/isisd.conf
sudo touch /etc/frr/ripd.conf
sudo touch /etc/frr/ripngd.conf
sudo touch /etc/frr/pimd.conf
sudo touch /etc/frr/ldpd.conf
sudo chown frr:frr /etc/frr/
sudo touch /etc/frr/vtysh.conf
sudo chown frr:frrvty /etc/frr/vtysh.conf
sudo chmod 640 /etc/frr/*.conf
sudo install -m 755 -o frr -g frr -d /var/log/frr
sudo install -m 775 -o frr -g frrvty -d /etc/frr
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/zebra.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/bgpd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospfd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospf6d.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/isisd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf
sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf
### Enable IP & IPv6 forwarding
@ -131,4 +129,4 @@ other settings)
# based on Router Advertisements for this host
net.ipv6.conf.all.forwarding=1
**Reboot** or use `sysctl` to apply the same config to the running system
**Reboot** or use `sysctl -p` to apply the same config to the running system

View File

@ -25,8 +25,9 @@ any packages**
sudo groupadd -g 92 frr
sudo groupadd -r -g 85 frrvty
sudo adduser --system --ingroup frr --groups frrvty --home /var/run/frr/ \
sudo adduser --system --ingroup frr --home /var/run/frr/ \
--gecos "FRR suite" --shell /sbin/nologin frr
sudo usermod -a -G frrvty frr
### Download Source, configure and compile it
(You may prefer different options on configure statement. These are just
@ -53,6 +54,7 @@ an example.)
--enable-rtadv \
--enable-tcp-zebra \
--enable-fpm \
--enable-ldpd \
--with-pkg-git-version \
--with-pkg-extra-version=-MyOwnFRRVersion
make
@ -61,21 +63,19 @@ an example.)
### Create empty FRR configuration files
sudo mkdir /var/log/frr
sudo chown frr:frr /var/log/frr
sudo mkdir /etc/frr
sudo touch /etc/frr/zebra.conf
sudo touch /etc/frr/bgpd.conf
sudo touch /etc/frr/ospfd.conf
sudo touch /etc/frr/ospf6d.conf
sudo touch /etc/frr/isisd.conf
sudo touch /etc/frr/ripd.conf
sudo touch /etc/frr/ripngd.conf
sudo touch /etc/frr/pimd.conf
sudo chown frr:frr /etc/frr/
sudo touch /etc/frr/vtysh.conf
sudo chown frr:frrvty /etc/frr/vtysh.conf
sudo chmod 640 /etc/frr/*.conf
sudo install -m 755 -o frr -g frr -d /var/log/frr
sudo install -m 775 -o frr -g frrvty -d /etc/frr
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/zebra.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/bgpd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospfd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospf6d.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/isisd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf
sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf
### Enable IP & IPv6 forwarding
@ -90,4 +90,4 @@ other settings)
# based on Router Advertisements for this host
net.ipv6.conf.all.forwarding=1
**Reboot** or use `sysctl` to apply the same config to the running system
**Reboot** or use `sysctl -p` to apply the same config to the running system

View File

@ -26,8 +26,9 @@ any packages**
sudo groupadd -g 92 frr
sudo groupadd -r -g 85 frrvty
sudo adduser --system --ingroup frr --groups frrvty --home /var/run/frr/ \
sudo adduser --system --ingroup frr --home /var/run/frr/ \
--gecos "FRR suite" --shell /sbin/nologin frr
sudo usermod -a -G frrvty frr
### Download Source, configure and compile it
(You may prefer different options on configure statement. These are just
@ -62,22 +63,19 @@ an example.)
### Create empty FRR configuration files
sudo mkdir /var/log/frr
sudo chown frr:frr /var/log/frr
sudo mkdir /etc/frr
sudo touch /etc/frr/zebra.conf
sudo touch /etc/frr/bgpd.conf
sudo touch /etc/frr/ospfd.conf
sudo touch /etc/frr/ospf6d.conf
sudo touch /etc/frr/isisd.conf
sudo touch /etc/frr/ripd.conf
sudo touch /etc/frr/ripngd.conf
sudo touch /etc/frr/pimd.conf
sudo touch /etc/frr/ldpd.conf
sudo chown frr:frr /etc/frr/
sudo touch /etc/frr/vtysh.conf
sudo chown frr:frrvty /etc/frr/vtysh.conf
sudo chmod 640 /etc/frr/*.conf
sudo install -m 755 -o frr -g frr -d /var/log/frr
sudo install -m 775 -o frr -g frrvty -d /etc/frr
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/zebra.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/bgpd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospfd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ospf6d.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/isisd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf
sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf
sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf
### Enable IP & IPv6 forwarding
@ -111,4 +109,4 @@ Add the following lines to `/etc/modules-load.d/modules.conf`:
mpls-router
mpls-iptunnel
**Reboot** or use `sysctl` to apply the same config to the running system
**Reboot** or use `sysctl -p` to apply the same config to the running system

View File

@ -34,6 +34,7 @@ DEFINE_HOOK(frr_late_init, (struct thread_master *tm), (tm))
const char frr_sysconfdir[] = SYSCONFDIR;
const char frr_vtydir[] = DAEMON_VTY_DIR;
const char frr_moduledir[] = MODULE_PATH;
char config_default[256];
static char pidfile_default[256];
@ -62,6 +63,7 @@ static void opt_extend(const struct optspec *os)
#define OPTION_VTYSOCK 1000
#define OPTION_MODULEDIR 1002
static const struct option lo_always[] = {
{ "help", no_argument, NULL, 'h' },
@ -69,6 +71,7 @@ static const struct option lo_always[] = {
{ "daemon", no_argument, NULL, 'd' },
{ "module", no_argument, NULL, 'M' },
{ "vty_socket", required_argument, NULL, OPTION_VTYSOCK },
{ "moduledir", required_argument, NULL, OPTION_MODULEDIR },
{ NULL }
};
static const struct optspec os_always = {
@ -77,7 +80,8 @@ static const struct optspec os_always = {
" -v, --version Print program version\n"
" -d, --daemon Runs in daemon mode\n"
" -M, --module Load specified module\n"
" --vty_socket Override vty socket path\n",
" --vty_socket Override vty socket path\n"
" --moduledir Override modules directory\n",
lo_always
};
@ -193,6 +197,7 @@ struct option_chain {
struct option_chain *next;
const char *arg;
};
static struct option_chain *modules = NULL, **modnext = &modules;
static int errors = 0;
@ -277,6 +282,14 @@ static int frr_opt(int opt)
}
di->vty_sock_path = optarg;
break;
case OPTION_MODULEDIR:
if (di->module_path) {
fprintf(stderr, "----moduledir option specified more than once!\n");
errors++;
break;
}
di->module_path = optarg;
break;
case 'u':
if (di->flags & FRR_NO_PRIVSEP)
return 1;
@ -319,6 +332,8 @@ struct thread_master *frr_init(void)
struct option_chain *oc;
struct frrmod_runtime *module;
char moderr[256];
const char *dir;
dir = di->module_path ? di->module_path : frr_moduledir;
srandom(time(NULL));
@ -331,7 +346,7 @@ struct thread_master *frr_init(void)
frrmod_init(di->module);
while (modules) {
modules = (oc = modules)->next;
module = frrmod_load(oc->arg, moderr, sizeof(moderr));
module = frrmod_load(oc->arg, dir, moderr, sizeof(moderr));
if (!module) {
fprintf(stderr, "%s\n", moderr);
exit(1);

View File

@ -52,6 +52,7 @@ struct frr_daemon_info {
const char *config_file;
const char *pid_file;
const char *vty_path;
const char *module_path;
const char *proghelp;
void (*printhelp)(FILE *target);
@ -107,5 +108,6 @@ extern void frr_run(struct thread_master *master);
extern char config_default[256];
extern const char frr_sysconfdir[];
extern const char frr_vtydir[];
extern const char frr_moduledir[];
#endif /* _ZEBRA_FRR_H */

View File

@ -69,7 +69,7 @@ void frrmod_init(struct frrmod_runtime *modinfo)
}
struct frrmod_runtime *frrmod_load(const char *spec,
char *err, size_t err_len)
const char *dir, char *err, size_t err_len)
{
void *handle = NULL;
char name[PATH_MAX], fullpath[PATH_MAX], *args;
@ -84,12 +84,12 @@ struct frrmod_runtime *frrmod_load(const char *spec,
if (!strchr(name, '/')) {
if (!handle && execname) {
snprintf(fullpath, sizeof(fullpath), "%s/%s_%s.so",
MODULE_PATH, execname, name);
dir, execname, name);
handle = dlopen(fullpath, RTLD_NOW | RTLD_GLOBAL);
}
if (!handle) {
snprintf(fullpath, sizeof(fullpath), "%s/%s.so",
MODULE_PATH, name);
dir, name);
handle = dlopen(fullpath, RTLD_NOW | RTLD_GLOBAL);
}
}

View File

@ -95,7 +95,7 @@ extern struct frrmod_runtime *frrmod_list;
extern void frrmod_init(struct frrmod_runtime *modinfo);
extern struct frrmod_runtime *frrmod_load(const char *spec,
char *err, size_t err_len);
const char *dir, char *err, size_t err_len);
#if 0
/* not implemented yet */
extern void frrmod_unload(struct frrmod_runtime *module);

View File

@ -393,6 +393,8 @@ void nhrp_interface_set_protection(struct interface *ifp, const char *profile, c
if (nifp->ipsec_fallback_profile) free(nifp->ipsec_fallback_profile);
nifp->ipsec_fallback_profile = fallback_profile ? strdup(fallback_profile) : NULL;
notifier_call(&nifp->notifier_list, NOTIFY_INTERFACE_ADDRESS_CHANGED);
}
void nhrp_interface_set_source(struct interface *ifp, const char *ifname)

View File

@ -18,19 +18,6 @@ DEFINE_MTYPE_STATIC(NHRPD, NHRP_NHS, "NHRP next hop server")
DEFINE_MTYPE_STATIC(NHRPD, NHRP_REGISTRATION, "NHRP registration entries")
static int nhrp_nhs_resolve(struct thread *t);
struct nhrp_registration {
struct list_head reglist_entry;
struct thread *t_register;
struct nhrp_nhs *nhs;
struct nhrp_reqid reqid;
unsigned int timeout;
unsigned mark : 1;
union sockunion proto_addr;
struct nhrp_peer *peer;
struct notifier_block peer_notifier;
};
static int nhrp_reg_send_req(struct thread *t);
static void nhrp_reg_reply(struct nhrp_reqid *reqid, void *arg)
@ -370,3 +357,18 @@ void nhrp_nhs_terminate(void)
}
}
}
void nhrp_nhs_foreach(struct interface *ifp, afi_t afi, void (*cb)(struct nhrp_nhs *, struct nhrp_registration *, void *), void *ctx)
{
struct nhrp_interface *nifp = ifp->info;
struct nhrp_nhs *nhs;
struct nhrp_registration *reg;
list_for_each_entry(nhs, &nifp->afi[afi].nhslist_head, nhslist_entry) {
if (!list_empty(&nhs->reglist_head)) {
list_for_each_entry(reg, &nhs->reglist_head, reglist_entry)
cb(nhs, reg, ctx);
} else
cb(nhs, 0, ctx);
}
}

View File

@ -250,6 +250,8 @@ int nhrp_peer_check(struct nhrp_peer *p, int establish)
return 0;
if (p->requested)
return 0;
if (!nifp->ipsec_profile)
return 0;
if (sockunion_family(&vc->local.nbma) == AF_UNSPEC)
return 0;
@ -730,6 +732,15 @@ static void nhrp_packet_debug(struct zbuf *zb, const char *dir)
reply ? buf[0] : buf[1]);
}
static int proto2afi(uint16_t proto)
{
switch (proto) {
case ETH_P_IP: return AFI_IP;
case ETH_P_IPV6: return AFI_IP6;
}
return AF_UNSPEC;
}
struct nhrp_route_info {
int local;
struct interface *ifp;
@ -749,7 +760,7 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb)
const char *info = NULL;
union sockunion *target_addr;
unsigned paylen, extoff, extlen, realsize;
afi_t afi;
afi_t nbma_afi, proto_afi;
debugf(NHRP_DEBUG_KERNEL, "PACKET: Recv %s -> %s",
sockunion2str(&vc->remote.nbma, buf[0], sizeof buf[0]),
@ -777,20 +788,21 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb)
pp.hdr = hdr;
pp.peer = p;
afi = htons(hdr->afnum);
nbma_afi = htons(hdr->afnum);
proto_afi = proto2afi(htons(hdr->protocol_type));
if (hdr->type > ZEBRA_NUM_OF(packet_types) ||
hdr->version != NHRP_VERSION_RFC2332 ||
afi >= AFI_MAX ||
nbma_afi >= AFI_MAX || proto_afi == AF_UNSPEC ||
packet_types[hdr->type].type == PACKET_UNKNOWN ||
htons(hdr->packet_size) > realsize) {
zlog_info("From %s: error: packet type %d, version %d, AFI %d, size %d (real size %d)",
zlog_info("From %s: error: packet type %d, version %d, AFI %d, proto %x, size %d (real size %d)",
sockunion2str(&vc->remote.nbma, buf[0], sizeof buf[0]),
(int) hdr->type, (int) hdr->version, (int) afi,
(int) htons(hdr->packet_size),
(int) realsize);
(int) hdr->type, (int) hdr->version,
(int) nbma_afi, (int) htons(hdr->protocol_type),
(int) htons(hdr->packet_size), (int) realsize);
goto drop;
}
pp.if_ad = &((struct nhrp_interface *)ifp->info)->afi[afi];
pp.if_ad = &((struct nhrp_interface *)ifp->info)->afi[proto_afi];
extoff = htons(hdr->extension_offset);
if (extoff) {
@ -806,7 +818,7 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb)
extlen = zbuf_used(zb);
zbuf_init(&pp.extensions, zbuf_pulln(zb, extlen), extlen, extlen);
if (!nifp->afi[afi].network_id) {
if (!nifp->afi[proto_afi].network_id) {
info = "nhrp not enabled";
goto drop;
}

View File

@ -504,6 +504,32 @@ DEFUN(if_nhrp_map, if_nhrp_map_cmd,
return CMD_SUCCESS;
}
DEFUN(if_no_nhrp_map, if_no_nhrp_map_cmd,
"no " AFI_CMD " nhrp map <A.B.C.D|X:X::X:X>",
NO_STR
AFI_STR
NHRP_STR
"Nexthop Server configuration\n"
"IPv4 protocol address\n"
"IPv6 protocol address\n")
{
VTY_DECLVAR_CONTEXT(interface,ifp);
afi_t afi = cmd_to_afi(argv[1]);
union sockunion proto_addr;
struct nhrp_cache *c;
if (str2sockunion(argv[4]->arg, &proto_addr) < 0 ||
afi2family(afi) != sockunion_family(&proto_addr))
return nhrp_vty_return(vty, NHRP_ERR_PROTOCOL_ADDRESS_MISMATCH);
c = nhrp_cache_get(ifp, &proto_addr, 0);
if (!c || !c->map)
return nhrp_vty_return(vty, NHRP_ERR_ENTRY_NOT_FOUND);
nhrp_cache_update_binding(c, c->cur.type, -1, NULL, 0, NULL);
return CMD_SUCCESS;
}
DEFUN(if_nhrp_nhs, if_nhrp_nhs_cmd,
AFI_CMD " nhrp nhs <A.B.C.D|X:X::X:X|dynamic> nbma <A.B.C.D|FQDN>",
AFI_STR
@ -592,6 +618,56 @@ static void show_ip_nhrp_cache(struct nhrp_cache *c, void *pctx)
VTY_NEWLINE);
}
static void show_ip_nhrp_nhs(struct nhrp_nhs *n, struct nhrp_registration *reg, void *pctx)
{
struct info_ctx *ctx = pctx;
struct vty *vty = ctx->vty;
char buf[2][SU_ADDRSTRLEN];
if (!ctx->count) {
vty_out(vty, "%-8s %-24s %-16s %-16s%s",
"Iface",
"FQDN",
"NBMA",
"Protocol",
VTY_NEWLINE);
}
ctx->count++;
vty_out(vty, "%-8s %-24s %-16s %-16s%s",
n->ifp->name,
n->nbma_fqdn,
(reg && reg->peer) ? sockunion2str(&reg->peer->vc->remote.nbma, buf[0], sizeof buf[0]) : "-",
sockunion2str(reg ? &reg->proto_addr : &n->proto_addr, buf[1], sizeof buf[1]),
VTY_NEWLINE);
}
static void show_ip_nhrp_shortcut(struct nhrp_shortcut *s, void *pctx)
{
struct info_ctx *ctx = pctx;
struct nhrp_cache *c;
struct vty *vty = ctx->vty;
char buf1[PREFIX_STRLEN], buf2[SU_ADDRSTRLEN];
if (!ctx->count) {
vty_out(vty, "%-8s %-24s %-24s %s%s",
"Type",
"Prefix",
"Via",
"Identity",
VTY_NEWLINE);
}
ctx->count++;
c = s->cache;
vty_out(ctx->vty, "%-8s %-24s %-24s %s%s",
nhrp_cache_type_str[s->type],
prefix2str(s->p, buf1, sizeof buf1),
c ? sockunion2str(&c->remote_addr, buf2, sizeof buf2) : "",
(c && c->cur.peer) ? c->cur.peer->vc->remote.id : "",
VTY_NEWLINE);
}
static void show_ip_opennhrp_cache(struct nhrp_cache *c, void *pctx)
{
struct info_ctx *ctx = pctx;
@ -631,38 +707,13 @@ static void show_ip_opennhrp_cache(struct nhrp_cache *c, void *pctx)
vty_out(ctx->vty, "%s", VTY_NEWLINE);
}
static void show_ip_nhrp_shortcut(struct nhrp_shortcut *s, void *pctx)
{
struct info_ctx *ctx = pctx;
struct nhrp_cache *c;
struct vty *vty = ctx->vty;
char buf1[PREFIX_STRLEN], buf2[SU_ADDRSTRLEN];
if (!ctx->count) {
vty_out(vty, "%-8s %-24s %-24s %s%s",
"Type",
"Prefix",
"Via",
"Identity",
VTY_NEWLINE);
}
ctx->count++;
c = s->cache;
vty_out(ctx->vty, "%-8s %-24s %-24s %s%s",
nhrp_cache_type_str[s->type],
prefix2str(s->p, buf1, sizeof buf1),
c ? sockunion2str(&c->remote_addr, buf2, sizeof buf2) : "",
(c && c->cur.peer) ? c->cur.peer->vc->remote.id : "",
VTY_NEWLINE);
}
DEFUN(show_ip_nhrp, show_ip_nhrp_cmd,
"show " AFI_CMD " nhrp [cache|shortcut|opennhrp]",
"show " AFI_CMD " nhrp [cache|nhs|shortcut|opennhrp]",
SHOW_STR
AFI_STR
"NHRP information\n"
"Forwarding cache information\n"
"Next hop server information\n"
"Shortcut information\n"
"opennhrpctl style cache dump\n")
{
@ -676,13 +727,16 @@ DEFUN(show_ip_nhrp, show_ip_nhrp_cmd,
if (argc <= 3 || argv[3]->text[0] == 'c') {
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
nhrp_cache_foreach(ifp, show_ip_nhrp_cache, &ctx);
} else if (argv[3]->text[0] == 'o') {
} else if (argv[3]->text[0] == 'n') {
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
nhrp_nhs_foreach(ifp, ctx.afi, show_ip_nhrp_nhs, &ctx);
} else if (argv[3]->text[0] == 's') {
nhrp_shortcut_foreach(ctx.afi, show_ip_nhrp_shortcut, &ctx);
} else {
vty_out(vty, "Status: ok%s%s", VTY_NEWLINE, VTY_NEWLINE);
ctx.count++;
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp))
nhrp_cache_foreach(ifp, show_ip_opennhrp_cache, &ctx);
} else {
nhrp_shortcut_foreach(ctx.afi, show_ip_nhrp_shortcut, &ctx);
}
if (!ctx.count) {
@ -919,6 +973,7 @@ void nhrp_config_init(void)
install_element(INTERFACE_NODE, &if_nhrp_reg_flags_cmd);
install_element(INTERFACE_NODE, &if_no_nhrp_reg_flags_cmd);
install_element(INTERFACE_NODE, &if_nhrp_map_cmd);
install_element(INTERFACE_NODE, &if_no_nhrp_map_cmd);
install_element(INTERFACE_NODE, &if_nhrp_nhs_cmd);
install_element(INTERFACE_NODE, &if_no_nhrp_nhs_cmd);
}

View File

@ -254,6 +254,18 @@ struct nhrp_nhs {
struct list_head reglist_head;
};
struct nhrp_registration {
struct list_head reglist_entry;
struct thread *t_register;
struct nhrp_nhs *nhs;
struct nhrp_reqid reqid;
unsigned int timeout;
unsigned mark : 1;
union sockunion proto_addr;
struct nhrp_peer *peer;
struct notifier_block peer_notifier;
};
#define NHRP_IFF_SHORTCUT 0x0001
#define NHRP_IFF_REDIRECT 0x0002
#define NHRP_IFF_REG_NO_UNIQUE 0x0100
@ -311,6 +323,7 @@ int nhrp_nhs_add(struct interface *ifp, afi_t afi, union sockunion *proto_addr,
int nhrp_nhs_del(struct interface *ifp, afi_t afi, union sockunion *proto_addr, const char *nbma_fqdn);
int nhrp_nhs_free(struct nhrp_nhs *nhs);
void nhrp_nhs_terminate(void);
void nhrp_nhs_foreach(struct interface *ifp, afi_t afi, void (*cb)(struct nhrp_nhs *, struct nhrp_registration *, void *), void *ctx);
void nhrp_route_update_nhrp(const struct prefix *p, struct interface *ifp);
void nhrp_route_announce(int add, enum nhrp_cache_type type, const struct prefix *p, struct interface *ifp, const union sockunion *nexthop, uint32_t mtu);

View File

@ -220,6 +220,23 @@ static void parse_sa_message(
}
}
static void parse_cmd_response(
struct vici_message_ctx *ctx,
enum vici_type_t msgtype,
const struct blob *key, const struct blob *val)
{
char buf[512];
switch (msgtype) {
case VICI_KEY_VALUE:
if (blob_equal(key, "errmsg") && blob2buf(val, buf, sizeof(buf)))
zlog_err("VICI: strongSwan: %s", buf);
break;
default:
break;
}
}
static void vici_recv_sa(struct vici_conn *vici, struct zbuf *msg, int event)
{
char buf[32];
@ -265,11 +282,14 @@ static void vici_recv_message(struct vici_conn *vici, struct zbuf *msg)
else if (blob_equal(&name, "child-state-destroying"))
vici_recv_sa(vici, msg, 2);
break;
case VICI_CMD_RESPONSE:
vici_parse_message(vici, msg, parse_cmd_response, 0);
break;
case VICI_EVENT_UNKNOWN:
case VICI_CMD_UNKNOWN:
zlog_err("VICI: StrongSwan does not support mandatory events (unpatched?)");
break;
case VICI_EVENT_CONFIRM:
case VICI_CMD_RESPONSE:
break;
default:
zlog_notice("VICI: Unrecognized message type %d", msgtype);
@ -449,9 +469,9 @@ void vici_request_vc(const char *profile, union sockunion *src, union sockunion
vici_submit_request(
vici, "initiate",
VICI_KEY_VALUE, "child", strlen(profile), profile,
VICI_KEY_VALUE, "timeout", 2, "-1",
VICI_KEY_VALUE, "async", 1, "1",
VICI_KEY_VALUE, "init-limits", 1, prio ? "0" : "1",
VICI_KEY_VALUE, "timeout", (size_t) 2, "-1",
VICI_KEY_VALUE, "async", (size_t) 1, "1",
VICI_KEY_VALUE, "init-limits", (size_t) 1, prio ? "0" : "1",
VICI_KEY_VALUE, "my-host", strlen(buf[0]), buf[0],
VICI_KEY_VALUE, "other-host", strlen(buf[1]), buf[1],
VICI_END);

View File

@ -315,6 +315,14 @@ DEFUN (no_router_ospf6,
ROUTER_STR
OSPF6_STR)
{
if (ospf6 == NULL)
vty_out (vty, "OSPFv3 is not configured%s", VNL);
else
{
ospf6_delete (ospf6);
ospf6 = NULL;
}
/* return to config node . */
VTY_PUSH_CONTEXT_NULL(CONFIG_NODE);

View File

@ -47,7 +47,9 @@ Installing the snap
Connect the priviledged `network-control` plug to the snap:
snap connect frr:network-control ubuntu-core:network-control
snap connect frr:network-control core:network-control
See README.usage.md for more details on setting up and using the snap
DONE.

View File

@ -3,7 +3,7 @@ Using the FRRouting Snap
After installing the Snap, the priviledged plug need to be connected:
snap connect frr:network-control ubuntu-core:network-control
snap connect frr:network-control core:network-control
Enabling/Disabling FRRouting Daemons
-------------------------------------------
@ -30,6 +30,8 @@ Commands defined by this snap
options
- `frr.readme`:
Returns this document `cat README_usage.md`
- `frr.set`:
Allows to enable `FPM` module. See FPM section below
and for debugging defined at this time (May get removed later - do not
depend on them). These are mainly intended to debug the Snap
@ -53,25 +55,88 @@ depend on them). These are mainly intended to debug the Snap
- `frr.ldpd-debug`:
Starts ldpd daemon in foreground
MPLS (LDP)
----------
The MPLS forwarding requires a Linux Kernel version 4.5 or newer and
specific MPLS kernel modules loaded. It will be auto-detected by
FRR. You can check the detected setup with the `show mpls status`
command from within `frr.vtysh`
The following kernel modules `mpls-router` and `mpls-iptunnel`
need to be loaded. On Ubuntu 16.04, this can be done by editing
'/etc/modules-load.d/modules.conf' and add the following lines:
# Load MPLS Kernel Modules
mpls-router
mpls-iptunnel
For other distributions, please check the documentation on loading
modules. You need to either reboot or use `modprobe` to manually load
the modules as well before MPLS will be available.
In addition to this, the MPLS Label-Processing needs to be enabled
with `sysctl` on the required interfaces. Assuming the interfaces
are named `eth0`, `eth1` and `eth2`, then the additional lines in
`/etc/sysctl.conf` will enable it on a Ubuntu 16.04 system:
# Enable MPLS Label processing on all interfaces
net.mpls.conf.eth0.input=1
net.mpls.conf.eth1.input=1
net.mpls.conf.eth2.input=1
net.mpls.platform_labels=100000
These settings require either a reboot or a manual configuration with
`sysctl` as well.
FPM Module
----------
The `frr.set` allows to turn FPM module on or off.
frr.set fpm {disable|protobuf|netlink}
Disables FPM or enables FPM with selected mode
By default, the FPM module is disabled, but installed with netlink and
protobuf support. To enable the FPM module, use the `frr.set fpm protobuf`
or `frr.set fpm netlink` command. The command will only enable the mode
for the next restart of zebra. Please reboot or restart zebra after
changing the mode to become effective.
FAQ
---
- frr.vtysh displays `--MORE--` on long output. How to suppress this?
- Define `VTYSH_PAGER` to `cat` (default is `more`). (Ie add
`export VTYSH_PAGER=cat` to the end of your `.profile`)
- ospfd / ospf6d are not running after installation
- Installing a new snap starts the daemons, but at this time they
may not have the required priviledged access. Make sure you
issue the `snap connect` command as given above (can be verified
with `snap interfaces`) and **THEN** restart the daemons (or
reboot the system).
This is a limitation of any snap package at this time which
requires priviledged interfaces (ie to manipulate routing tables)
Sourcecode available
====================
The source for this SNAP is available as part of the FRRouting
Source Code Distribution.
Source Code Distribution under `GPLv2 or later`
https://github.com/frrouting/frr.git
<https://github.com/frrouting/frr.git>
Instructions for rebuilding the snap are in `README.snap_build.md`
Instructions for rebuilding the snap are in `snapcraft/README.snap_build.md`
*Please checkout the desired branch before following the instructions
as they may have changed between versions of FRR*
Official Webpage for FRR
========================
Official webpage for FRR is at <https://www.frrouting.org/>
Feedback welcome
================
Please send Feedback about this snap to Martin Winter at
`mwinter@opensourcerouting.org`

View File

View File

@ -11,4 +11,5 @@ install:
install -D -m 0755 isisd-service $(DESTDIR)/bin/
install -D -m 0755 pimd-service $(DESTDIR)/bin/
install -D -m 0755 ldpd-service $(DESTDIR)/bin/
install -D -m 0755 nhrpd-service $(DESTDIR)/bin/
install -D -m 0755 set-options $(DESTDIR)/bin/

View File

@ -0,0 +1,12 @@
#!/bin/sh
set -e -x
if ! [ -e $SNAP_DATA/nhrpd.conf ]; then
cp $SNAP/etc/frr/nhrpd.conf.default $SNAP_DATA/nhrpd.conf
fi
exec $SNAP/sbin/nhrpd \
-f $SNAP_DATA/nhrpd.conf \
--pid_file $SNAP_DATA/nhrpd.pid \
--socket $SNAP_DATA/zsock \
--vty_socket $SNAP_DATA

40
snapcraft/scripts/set-options Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
set -e
case $1 in
fpm)
case $2 in
disable)
rm -f $SNAP_DATA/fpm.conf
echo "FPM module disabled. Please restart FRR"
;;
protobuf)
echo "-M fpm:protobuf" > $SNAP_DATA/fpm.conf
echo "FPM enabled and set to protobuf mode. Please restart FRR"
;;
netlink)
echo "-M fpm:netlink" > $SNAP_DATA/fpm.conf
echo "FPM enabled and set to netlink mode. Please restart FRR"
;;
*)
echo "Usage:"
echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
echo ""
echo " Disables FPM module or enables it with specified mode"
echo " Mode will be saved for next restart of zebra, but zebra"
echo " is not automatically restarted"
exit 1
;;
esac
;;
*)
echo "Usage:"
echo " ${SNAP_NAME}.set fpm {disable|protobuf|netlink}"
echo ""
echo " Disables FPM or enables FPM with selected mode"
exit 1
;;
esac
exit 0

View File

@ -8,9 +8,13 @@ fi
if ! [ -e $SNAP_DATA/vtysh.conf ]; then
cp $SNAP/etc/frr/vtysh.conf.default $SNAP_DATA/vtysh.conf
fi
EXTRA_OPTIONS=""
if [ -e $SNAP_DATA/fpm.conf ]; then
EXTRA_OPTIONS="`cat $SNAP_DATA/fpm.conf`"
fi
exec $SNAP/sbin/zebra \
-f $SNAP_DATA/zebra.conf \
--pid_file $SNAP_DATA/zebra.pid \
--socket $SNAP_DATA/zsock \
--vty_socket $SNAP_DATA
--vty_socket $SNAP_DATA \
--moduledir $SNAP/lib/frr/modules $EXTRA_OPTIONS

View File

@ -83,6 +83,15 @@ apps:
- network
- network-bind
- network-control
nhrpd:
command: bin/nhrpd-service
daemon: simple
plugs:
- network
- network-bind
- network-control
set:
command: bin/set-options
zebra-debug:
command: sbin/zebra -f $SNAP_DATA/zebra.conf --pid_file $SNAP_DATA/zebra.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
plugs:
@ -132,7 +141,13 @@ apps:
- network-bind
- network-control
ldpd-debug:
command: sbin/ldpd -f $SNAP_DATA/pimd.conf --pid_file $SNAP_DATA/pimd.pid --socket $SNAP_DATA/zsock --ctl_socket $SNAP_DATA --vty_socket $SNAP_DATA
command: sbin/ldpd -f $SNAP_DATA/ldpd.conf --pid_file $SNAP_DATA/ldpd.pid --socket $SNAP_DATA/zsock --ctl_socket $SNAP_DATA --vty_socket $SNAP_DATA
plugs:
- network
- network-bind
- network-control
nhrpd-debug:
command: sbin/nhrpd -f $SNAP_DATA/nhrpd.conf --pid_file $SNAP_DATA/nhrpd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
plugs:
- network
- network-bind
@ -148,7 +163,6 @@ parts:
- gawk
- libreadline-dev
- texinfo
- dejagnu
- libncurses5-dev
- texlive-latex-base
- texlive-generic-recommended
@ -161,6 +175,11 @@ parts:
- chrpath
- pkg-config
- libjson-c-dev
- libc-ares-dev
- bison
- flex
- python3-dev
- protobuf-c-compiler
stage-packages:
- coreutils
- iproute2
@ -192,6 +211,8 @@ parts:
- --enable-group=root
- --enable-pimd
- --enable-ldpd
- --enable-fpm
- --enable-protobuf
- --enable-configfile-mask=0640
- --enable-logfile-mask=0640
- --localstatedir=/var/run
@ -212,6 +233,7 @@ parts:
ripd.conf.default: etc/frr/ripd.conf.default
ripngd.conf.default: etc/frr/ripngd.conf.default
ldpd.conf.default: etc/frr/ldpd.conf.default
nhrpd.conf.default: etc/frr/nhrpd.conf.default
vtysh.conf.default: etc/frr/vtysh.conf.default
frr-scripts:
plugin: make

View File

@ -2163,7 +2163,7 @@ DEFUNSH (VTYSH_ALL,
DEFUNSH (VTYSH_ALL,
vtysh_log_syslog,
vtysh_log_syslog_cmd,
"log syslog <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",
"log syslog [<emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>]",
"Logging control\n"
"Set syslog logging level\n"
LOG_LEVEL_DESC)