diff options
author | Mark Bryars <mbryars@ibahn.com> | 2012-10-03 09:34:13 +0000 |
---|---|---|
committer | Mark Bryars <mbryars@ibahn.com> | 2012-10-03 09:34:13 +0000 |
commit | 45a19baf6186eef492387bef915a9db1e3555aed (patch) | |
tree | 20de540e3183301a68d8738f4ae9f45d48f2d715 | |
parent | 1ce1ec32ab086973eda4c62388e6915f305d604c (diff) | |
parent | ea90649a1415c16294b6744685875ae66486e814 (diff) | |
download | vyos-opennhrp-45a19baf6186eef492387bef915a9db1e3555aed.tar.gz vyos-opennhrp-45a19baf6186eef492387bef915a9db1e3555aed.zip |
Merge commit 'upstream/0.13.1'
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | NEWS | 8 | ||||
-rw-r--r-- | nhrp/admin.c | 24 | ||||
-rw-r--r-- | nhrp/nhrp_interface.c | 15 | ||||
-rw-r--r-- | nhrp/nhrp_peer.c | 6 | ||||
-rw-r--r-- | nhrp/nhrp_peer.h | 2 | ||||
-rw-r--r-- | nhrp/sysdep_netlink.c | 5 |
7 files changed, 44 insertions, 18 deletions
@@ -2,7 +2,7 @@ # Building opennhrp PACKAGE := opennhrp -VERSION := 0.13 +VERSION := 0.13.1 ## # Default directories @@ -6,6 +6,14 @@ Detailed changelog is available via Git history via web: http://opennhrp.git.sf.net/git/gitweb.cgi?p=opennhrp;a=blob;f=NEWS;hb=HEAD ----------------------------------------------------------------------------- + opennhrp 0.13.1 - released 22/Jun/2012 +----------------------------------------------------------------------------- + - fix: make "local-nbma" selector work properly if there are multiple gre + interfaces (reported by Alex Levit) + - fix: do not call opennhrp-script "interface-up" hook if the interface + being created and in down state (reported by Alex Levit) + +----------------------------------------------------------------------------- opennhrp 0.13 - released 25/Dec/2011 ----------------------------------------------------------------------------- - feature: add admin "interfaces show" command to display information about diff --git a/nhrp/admin.c b/nhrp/admin.c index 68a3e9e..d89fa87 100644 --- a/nhrp/admin.c +++ b/nhrp/admin.c @@ -54,10 +54,16 @@ static int parse_word(const char **bufptr, size_t len, char *word) return TRUE; } +static void admin_raw_write(void *ctx, const void *buf, size_t len) +{ + struct admin_remote *rmt = (struct admin_remote *) ctx; + + if (write(rmt->io.fd, buf, len) != len) { + } +} static void admin_write(void *ctx, const char *format, ...) { - struct admin_remote *rmt = (struct admin_remote *) ctx; char msg[1024]; va_list ap; size_t len; @@ -66,8 +72,7 @@ static void admin_write(void *ctx, const char *format, ...) len = vsnprintf(msg, sizeof(msg), format, ap); va_end(ap); - if (write(rmt->io.fd, msg, len) != len) { - } + admin_raw_write(ctx, msg, len); } static void admin_free_remote(struct admin_remote *rm) @@ -148,8 +153,8 @@ static int admin_show_peer(void *ctx, struct nhrp_peer *peer) rel / 60, rel % 60); } } - - admin_write(ctx, "%s\n", buf); + i += snprintf(&buf[i], len - i, "\n"); + admin_raw_write(ctx, buf, i); return 0; } @@ -223,9 +228,9 @@ static int admin_parse_selector(void *ctx, const char *cmd, } else if (strcmp(keyword, "local-nbma") == 0) { if (sel->interface != NULL) goto err_conflict; - sel->interface = nhrp_interface_get_by_nbma(&address); + sel->local_nbma_address = address; if (sel->interface == NULL) - goto err_noiface; + sel->interface = nhrp_interface_get_by_nbma(&address); } else { admin_write(ctx, "Status: failed\n" @@ -406,7 +411,8 @@ static int admin_show_interface(void *ctx, struct nhrp_interface *iface) nhrp_address_format(&iface->nat_cie.nbma_address, sizeof(tmp), tmp)); } done: - admin_write(ctx, "%s\n", buf); + i += snprintf(&buf[i], len - i, "\n"); + admin_raw_write(ctx, buf, i); return 0; } @@ -420,7 +426,7 @@ static void admin_redirect_purge(void *ctx, const char *cmd) { char keyword[64]; struct nhrp_address addr; - uint8_t prefix; + uint8_t prefix = 0; int count; nhrp_address_set_type(&addr, PF_UNSPEC); diff --git a/nhrp/nhrp_interface.c b/nhrp/nhrp_interface.c index 32c2383..05f0e80 100644 --- a/nhrp/nhrp_interface.c +++ b/nhrp/nhrp_interface.c @@ -123,20 +123,23 @@ struct nhrp_interface *nhrp_interface_get_by_index(unsigned int index, int creat struct nhrp_interface *nhrp_interface_get_by_nbma(struct nhrp_address *addr) { + struct nhrp_interface *match = NULL; struct nhrp_interface *iface; list_for_each_entry(iface, &name_list, name_list_entry) { if (!(iface->flags & NHRP_INTERFACE_FLAG_CONFIGURED)) continue; - if (nhrp_address_cmp(addr, &iface->nbma_address) == 0) - return iface; - - if (iface->nbma_address.type == PF_UNSPEC && !iface->link_index) - return iface; + if ((nhrp_address_cmp(addr, &iface->nbma_address) == 0) || + (iface->nbma_address.type == PF_UNSPEC && !iface->link_index)) { + /* ambiguous match - return null */ + if (match != NULL) + return NULL; + match = iface; + } } - return NULL; + return match; } struct nhrp_interface *nhrp_interface_get_by_protocol(struct nhrp_address *addr) diff --git a/nhrp/nhrp_peer.c b/nhrp/nhrp_peer.c index c53d4c4..7bd1a79 100644 --- a/nhrp/nhrp_peer.c +++ b/nhrp/nhrp_peer.c @@ -1833,6 +1833,12 @@ int nhrp_peer_match(struct nhrp_peer *p, struct nhrp_peer_selector *sel) p->parent != sel->parent) return FALSE; + if (sel->local_nbma_address.type != PF_UNSPEC) { + if (nhrp_address_cmp(&p->my_nbma_address, + &sel->local_nbma_address) != 0) + return FALSE; + } + if (sel->protocol_address.type != PF_UNSPEC) { if (sel->prefix_length == 0) sel->prefix_length = sel->protocol_address.addr_len * 8; diff --git a/nhrp/nhrp_peer.h b/nhrp/nhrp_peer.h index dea8d66..1df5fa9 100644 --- a/nhrp/nhrp_peer.h +++ b/nhrp/nhrp_peer.h @@ -136,6 +136,8 @@ struct nhrp_peer_selector { int prefix_length; struct nhrp_address protocol_address; struct nhrp_address next_hop_address; + + struct nhrp_address local_nbma_address; }; const char * const nhrp_peer_type[NHRP_PEER_TYPE_MAX]; diff --git a/nhrp/sysdep_netlink.c b/nhrp/sysdep_netlink.c index d058a98..0dce865 100644 --- a/nhrp/sysdep_netlink.c +++ b/nhrp/sysdep_netlink.c @@ -461,8 +461,9 @@ static void netlink_link_new(struct nlmsghdr *msg) if (rta[IFLA_MTU]) iface->mtu = *((unsigned*)RTA_DATA(rta[IFLA_MTU])); - if (iface->index == 0 || (ifi->ifi_flags & ifi->ifi_change & IFF_UP)) { - nhrp_info("Interface %s: new or configured up, mtu=%d", + if (((ifi->ifi_change & IFF_UP) || (iface->index == 0)) && + (ifi->ifi_flags & IFF_UP)) { + nhrp_info("Interface %s: configured UP, mtu=%d", ifname, iface->mtu); nhrp_interface_run_script(iface, "interface-up"); } else { |