struct iface_patt *router_id_from; /* Configured list of router ID iface patterns */
u32 router_id; /* Our Router ID */
+ const char *hostname; /* Hostname */
u32 proto_default_debug; /* Default protocol debug mask */
u32 proto_default_mrtdump; /* Default protocol mrtdump mask */
u32 channel_default_debug; /* Default channel debug mask */
struct timeformat tf_log; /* Time format for the logfile */
struct timeformat tf_base; /* Time format for other purposes */
u32 gr_wait; /* Graceful restart wait timeout (sec) */
- const char *hostname; /* Hostname */
int cli_debug; /* Tracing of CLI connections and commands */
int latency_debug; /* I/O loop tracks duration of each event */
This option can be used to override global router id for a given
protocol. Default: uses global router id.
+ <tag><label id="proto-hostname">hostname "<m/name/"</tag>
+ This option can be used to override global hostname for a given
+ protocol. Default: uses global hostname.
+
<tag><label id="proto-description">description "<m/text/"</tag>
This is an optional description of the protocol. It is displayed as a
part of the output of 'show protocols all' command.
| DEBUG debug_mask { this_proto->debug = $2; }
| MRTDUMP mrtdump_mask { this_proto->mrtdump = $2; }
| ROUTER ID idval { this_proto->router_id = $3; }
+ | HOSTNAME text { this_proto->hostname = $2; }
| DESCRIPTION text { this_proto->dsc = $2; }
| VRF text { this_proto->vrf = if_get_by_name($2); this_proto->vrf_set = 1; }
| VRF DEFAULT { this_proto->vrf = NULL; this_proto->vrf_set = 1; }
u8 vrf_set; /* Related VRF instance (below) is defined */
u32 debug, mrtdump; /* Debugging bitfields, both use D_* constants */
u32 router_id; /* Protocol specific router ID */
+ const char *hostname; /* Protocol specific hostname */
list channels; /* List of channel configs (struct channel_config) */
struct iface *vrf; /* Related VRF instance, NULL if global */
return pc->router_id ? pc->router_id : pc->global->router_id;
}
+static inline const char*
+proto_get_hostname(struct proto_config *pc)
+{
+ return pc->hostname ? pc->hostname : pc->global->hostname;
+}
+
extern pool *proto_pool;
extern list proto_list;
p->startup_timer = tm_new_init(p->p.pool, bgp_startup_timeout, p, 0, 0);
p->gr_timer = tm_new_init(p->p.pool, bgp_graceful_restart_timeout, p, 0, 0);
+ p->hostname = proto_get_hostname(P->cf);
+
p->local_id = proto_get_router_id(P->cf);
if (p->rr_client)
p->rr_cluster_id = p->cf->rr_cluster_id ? p->cf->rr_cluster_id : p->local_id;
if (proto_get_router_id(CF) != p->local_id)
return 0;
+ if (proto_get_hostname(CF) != p->hostname)
+ return 0;
+
int same = !memcmp(((byte *) old) + sizeof(struct proto_config),
((byte *) new) + sizeof(struct proto_config),
// password item is last and must be checked separately
struct bgp_proto {
struct proto p;
const struct bgp_config *cf; /* Shortcut to BGP configuration */
+ const char *hostname; /* Hostname for this BGP protocol */
ip_addr local_ip, remote_ip;
u32 local_as, remote_as;
u32 public_as; /* Externally visible ASN (local_as or confederation id) */
if (p->cf->llgr_mode)
caps->llgr_aware = 1;
- if (p->cf->enable_hostname && config->hostname)
+ if (p->cf->enable_hostname && p->hostname)
{
- size_t length = strlen(config->hostname);
+ size_t length = strlen(p->hostname);
char *hostname = mb_allocz(p->p.pool, length+1);
- memcpy(hostname, config->hostname, length+1);
+ memcpy(hostname, p->hostname, length+1);
caps->hostname = hostname;
}