summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-11-25 23:43:51 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-11-25 23:43:51 +0100
commit9a54c5affeb836b64a1952d0ef75fd88301ae899 (patch)
tree810bbccfd617970602a5154a9193aa8e4a417819
parent3f0b72910882bd6cbb02302f198a4ab70f0b2927 (diff)
parentba01a6f2e66d03eb5d9426fdf4973f30e09c5710 (diff)
Merge commit 'ba01a6f2' into wireguard-next-tmp7-1
-rw-r--r--nest/mpls.Y6
-rw-r--r--nest/protocol.h2
-rw-r--r--proto/static/static.c4
3 files changed, 10 insertions, 2 deletions
diff --git a/nest/mpls.Y b/nest/mpls.Y
index 0e755fec..726a834a 100644
--- a/nest/mpls.Y
+++ b/nest/mpls.Y
@@ -99,7 +99,11 @@ mpls_channel_start: MPLS
$$ = this_channel = channel_config_get(&channel_mpls, net_label[NET_MPLS], NET_MPLS, this_proto);
if (EMPTY_LIST(new_config->mpls_domains))
- cf_error("No MPLS domain defined");
+ {
+ int counter = 0;
+ mpls_domain_config_new(cf_default_name(new_config, "mpls%d", &counter));
+ cf_warn("No MPLS domain defined");
+ }
/* Default values for new channel */
if (!MPLS_CC->domain)
diff --git a/nest/protocol.h b/nest/protocol.h
index 3ef3913a..ee55d316 100644
--- a/nest/protocol.h
+++ b/nest/protocol.h
@@ -627,7 +627,7 @@ struct channel_config *proto_cf_find_channel(struct proto_config *p, uint net_ty
static inline struct channel_config *proto_cf_main_channel(struct proto_config *pc)
{ return proto_cf_find_channel(pc, pc->net_type); }
static inline struct channel_config *proto_cf_mpls_channel(struct proto_config *pc)
-{ return proto_cf_find_channel(pc, NET_MPLS); }
+{ return (pc->net_type != NET_MPLS) ? proto_cf_find_channel(pc, NET_MPLS) : NULL; }
struct channel *proto_find_channel_by_table(struct proto *p, struct rtable *t);
struct channel *proto_find_channel_by_name(struct proto *p, const char *n);
diff --git a/proto/static/static.c b/proto/static/static.c
index 0e80ad64..071803a8 100644
--- a/proto/static/static.c
+++ b/proto/static/static.c
@@ -472,6 +472,10 @@ static_postconfig(struct proto_config *CF)
struct static_config *cf = (void *) CF;
struct static_route *r;
+ /* If there is just a MPLS channel, use it as a main channel */
+ if (!CF->net_type && proto_cf_mpls_channel(CF))
+ CF->net_type = NET_MPLS;
+
if (! proto_cf_main_channel(CF))
cf_error("Channel not specified");