mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
BMP: Add local address option
Also remove unused local and ip_post_policy options. Co-authored with Pawel Maslanka <pmaslank@akamai.com>. Minor changes by committer.
This commit is contained in:
parent
ae4d934c53
commit
62d8fbdc1c
@ -892,6 +892,7 @@ bmp_connect(struct bmp_proto *p)
|
|||||||
|
|
||||||
sock *sk = sk_new(p->p.pool);
|
sock *sk = sk_new(p->p.pool);
|
||||||
sk->type = SK_TCP_ACTIVE;
|
sk->type = SK_TCP_ACTIVE;
|
||||||
|
sk->saddr = p->local_addr;
|
||||||
sk->daddr = p->station_ip;
|
sk->daddr = p->station_ip;
|
||||||
sk->dport = p->station_port;
|
sk->dport = p->station_port;
|
||||||
sk->ttl = IP4_MAX_TTL;
|
sk->ttl = IP4_MAX_TTL;
|
||||||
@ -970,26 +971,26 @@ bmp_init(struct proto_config *CF)
|
|||||||
struct proto *P = proto_new(CF);
|
struct proto *P = proto_new(CF);
|
||||||
struct bmp_proto *p = (void *) P;
|
struct bmp_proto *p = (void *) P;
|
||||||
struct bmp_config *cf = (void *) CF;
|
struct bmp_config *cf = (void *) CF;
|
||||||
|
|
||||||
p->cf = cf;
|
p->cf = cf;
|
||||||
|
p->local_addr = cf->local_addr;
|
||||||
p->station_ip = cf->station_ip;
|
p->station_ip = cf->station_ip;
|
||||||
p->station_port = cf->station_port;
|
p->station_port = cf->station_port;
|
||||||
strcpy(p->sys_descr, cf->sys_descr);
|
strcpy(p->sys_descr, cf->sys_descr);
|
||||||
strcpy(p->sys_name, cf->sys_name);
|
strcpy(p->sys_name, cf->sys_name);
|
||||||
p->monitoring_rib.in_pre_policy = cf->monitoring_rib_in_pre_policy;
|
p->monitoring_rib.in_pre_policy = cf->monitoring_rib_in_pre_policy;
|
||||||
p->monitoring_rib.in_post_policy = cf->monitoring_rib_in_post_policy;
|
|
||||||
p->monitoring_rib.local = cf->monitoring_rib_local;
|
|
||||||
|
|
||||||
return P;
|
return P;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bmp_start - initialize internal resources of BMP implementation.
|
||||||
|
* NOTE: It does not connect to BMP collector yet.
|
||||||
|
*/
|
||||||
static int
|
static int
|
||||||
bmp_start(struct proto *P)
|
bmp_start(struct proto *P)
|
||||||
{
|
{
|
||||||
struct bmp_proto *p = (void *) P;
|
struct bmp_proto *p = (void *) P;
|
||||||
|
|
||||||
log(L_DEBUG "Init BMP");
|
|
||||||
|
|
||||||
p->buffer_mpool = rp_new(P->pool, "BMP Buffer");
|
p->buffer_mpool = rp_new(P->pool, "BMP Buffer");
|
||||||
p->map_mem_pool = rp_new(P->pool, "BMP Map");
|
p->map_mem_pool = rp_new(P->pool, "BMP Map");
|
||||||
p->tx_mem_pool = rp_new(P->pool, "BMP Tx");
|
p->tx_mem_pool = rp_new(P->pool, "BMP Tx");
|
||||||
|
@ -35,11 +35,10 @@ struct bmp_config {
|
|||||||
struct proto_config c;
|
struct proto_config c;
|
||||||
const char *sys_descr; // sysDescr MIB-II [RFC1213] object
|
const char *sys_descr; // sysDescr MIB-II [RFC1213] object
|
||||||
const char *sys_name; // sysName MIB-II [RFC1213] object
|
const char *sys_name; // sysName MIB-II [RFC1213] object
|
||||||
|
ip_addr local_addr; // Local IP address
|
||||||
ip_addr station_ip; // Monitoring station address
|
ip_addr station_ip; // Monitoring station address
|
||||||
u16 station_port; // Monitoring station TCP port
|
u16 station_port; // Monitoring station TCP port
|
||||||
bool monitoring_rib_in_pre_policy; // Route monitoring pre-policy Adj-Rib-In
|
bool monitoring_rib_in_pre_policy; // Route monitoring pre-policy Adj-Rib-In
|
||||||
bool monitoring_rib_in_post_policy; // Route monitoring post-policy Adj-Rib-In
|
|
||||||
bool monitoring_rib_local; // Route monitoring Local Rib
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
@ -59,9 +58,10 @@ struct bmp_proto {
|
|||||||
struct proto p; // Parent proto
|
struct proto p; // Parent proto
|
||||||
const struct bmp_config *cf; // Shortcut to BMP configuration
|
const struct bmp_config *cf; // Shortcut to BMP configuration
|
||||||
sock *sk; // TCP connection
|
sock *sk; // TCP connection
|
||||||
event *tx_ev; // TX event
|
event *tx_ev; // TX event
|
||||||
char sys_descr[MIB_II_STR_LEN]; // sysDescr MIB-II [RFC1213] object
|
char sys_descr[MIB_II_STR_LEN]; // sysDescr MIB-II [RFC1213] object
|
||||||
char sys_name[MIB_II_STR_LEN]; // sysName MIB-II [RFC1213] object
|
char sys_name[MIB_II_STR_LEN]; // sysName MIB-II [RFC1213] object
|
||||||
|
ip_addr local_addr; // Source local IP address
|
||||||
ip_addr station_ip; // Monitoring station IP address
|
ip_addr station_ip; // Monitoring station IP address
|
||||||
u16 station_port; // Monitoring station TCP port
|
u16 station_port; // Monitoring station TCP port
|
||||||
struct monitoring_rib monitoring_rib;
|
struct monitoring_rib monitoring_rib;
|
||||||
|
@ -25,13 +25,12 @@ proto: bmp_proto '}' ;
|
|||||||
|
|
||||||
bmp_proto_start: proto_start BMP {
|
bmp_proto_start: proto_start BMP {
|
||||||
this_proto = proto_config_new(&proto_bmp, $1);
|
this_proto = proto_config_new(&proto_bmp, $1);
|
||||||
|
BMP_CFG->local_addr = IPA_NONE4;
|
||||||
BMP_CFG->station_ip = IPA_NONE4;
|
BMP_CFG->station_ip = IPA_NONE4;
|
||||||
BMP_CFG->station_port = 0;
|
BMP_CFG->station_port = 0;
|
||||||
BMP_CFG->sys_descr = "Not defined";
|
BMP_CFG->sys_descr = "Not defined";
|
||||||
BMP_CFG->sys_name = "Not defined";
|
BMP_CFG->sys_name = "Not defined";
|
||||||
BMP_CFG->monitoring_rib_in_pre_policy = false;
|
BMP_CFG->monitoring_rib_in_pre_policy = false;
|
||||||
BMP_CFG->monitoring_rib_in_post_policy = false;
|
|
||||||
BMP_CFG->monitoring_rib_local = false;
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -52,6 +51,9 @@ bmp_station_address:
|
|||||||
bmp_proto:
|
bmp_proto:
|
||||||
bmp_proto_start proto_name '{'
|
bmp_proto_start proto_name '{'
|
||||||
| bmp_proto proto_item ';'
|
| bmp_proto proto_item ';'
|
||||||
|
| bmp_proto LOCAL ADDRESS ipa ';' {
|
||||||
|
BMP_CFG->local_addr = $4;
|
||||||
|
}
|
||||||
| bmp_proto STATION ADDRESS bmp_station_address ';'
|
| bmp_proto STATION ADDRESS bmp_station_address ';'
|
||||||
| bmp_proto SYSTEM DESCRIPTION text ';' {
|
| bmp_proto SYSTEM DESCRIPTION text ';' {
|
||||||
if (!$4 || (strlen($4) == 0))
|
if (!$4 || (strlen($4) == 0))
|
||||||
@ -70,12 +72,6 @@ bmp_proto:
|
|||||||
| bmp_proto MONITORING RIB IN PRE_POLICY bool ';' {
|
| bmp_proto MONITORING RIB IN PRE_POLICY bool ';' {
|
||||||
BMP_CFG->monitoring_rib_in_pre_policy = $6;
|
BMP_CFG->monitoring_rib_in_pre_policy = $6;
|
||||||
}
|
}
|
||||||
| bmp_proto MONITORING RIB IN POST_POLICY bool ';' {
|
|
||||||
BMP_CFG->monitoring_rib_in_post_policy = $6;
|
|
||||||
}
|
|
||||||
| bmp_proto MONITORING RIB LOCAL bool ';' {
|
|
||||||
BMP_CFG->monitoring_rib_local = $5;
|
|
||||||
}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
CF_CODE
|
CF_CODE
|
||||||
|
Loading…
Reference in New Issue
Block a user