}
/* Make network statement's attribute. */
-struct attr *bgp_attr_default_set(struct attr *attr, uint8_t origin)
+struct attr *bgp_attr_default_set(struct attr *attr, struct bgp *bgp,
+ uint8_t origin)
{
memset(attr, 0, sizeof(struct attr));
attr->label = MPLS_INVALID_LABEL;
attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP);
attr->mp_nexthop_len = IPV6_MAX_BYTELEN;
+ attr->local_pref = bgp->default_local_pref;
return attr;
}
struct attr *new;
int ret;
- memset(&attr, 0, sizeof(struct attr));
+ memset(&attr, 0, sizeof(attr));
/* Origin attribute. */
attr.origin = origin;
struct attr attr_tmp = attr;
struct bgp_path_info rmap_path;
- memset(&rmap_path, 0, sizeof(struct bgp_path_info));
+ memset(&rmap_path, 0, sizeof(rmap_path));
rmap_path.peer = bgp->peer_self;
rmap_path.attr = &attr_tmp;
in_addr_t nexthop_h;
nexthop_h = ntohl(attr->nexthop.s_addr);
- if ((IPV4_NET0(nexthop_h) || IPV4_NET127(nexthop_h)
- || IPV4_CLASS_DE(nexthop_h))
- && !BGP_DEBUG(allow_martians, ALLOW_MARTIANS)) {
+ if ((IPV4_NET0(nexthop_h) || IPV4_NET127(nexthop_h) ||
+ !ipv4_unicast_valid(&attr->nexthop)) &&
+ !BGP_DEBUG(allow_martians, ALLOW_MARTIANS)) {
uint8_t data[7]; /* type(2) + length(1) + nhop(4) */
char buf[INET_ADDRSTRLEN];
bool addpath_capable, uint32_t addpath_tx_id,
struct attr *attr)
{
- uint8_t wlabel[3] = {0x80, 0x00, 0x00};
+ uint8_t wlabel[4] = {0x80, 0x00, 0x00};
if (safi == SAFI_LABELED_UNICAST) {
label = (mpls_label_t *)wlabel;