diff options
| author | Ted Ross <tross@apache.org> | 2013-10-07 21:20:20 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2013-10-07 21:20:20 +0000 |
| commit | a4a2f3f4c0986c74d4cf9277b649f498c8b1aae3 (patch) | |
| tree | 5c4162ec757024151febd9029cb7224c2d77adfa /qpid/extras/dispatch/src | |
| parent | ee5511f752a7316760ed74f6493a7433ffed4923 (diff) | |
| download | qpid-python-a4a2f3f4c0986c74d4cf9277b649f498c8b1aae3.tar.gz | |
QPID-5213 - Added a CLI tool to access management data in the router.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1530071 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/extras/dispatch/src')
| -rw-r--r-- | qpid/extras/dispatch/src/router_node.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/qpid/extras/dispatch/src/router_node.c b/qpid/extras/dispatch/src/router_node.c index 90e2e0c9dc..244a438667 100644 --- a/qpid/extras/dispatch/src/router_node.c +++ b/qpid/extras/dispatch/src/router_node.c @@ -429,6 +429,12 @@ static void router_rx_handler(void* context, dx_link_t *link, dx_delivery_t *del if (addr) { // + // If the incoming link is an endpoint link, count this as an ingress delivery. + // + if (rlink->link_type == DX_LINK_ENDPOINT) + addr->deliveries_ingress++; + + // // To field is valid and contains a known destination. Handle the various // cases for forwarding. // @@ -678,6 +684,7 @@ static int router_outgoing_link_handler(void* context, dx_link_t *link) const char *r_src = pn_terminus_get_address(dx_link_remote_source(link)); int is_dynamic = pn_terminus_is_dynamic(dx_link_remote_source(link)); int is_router = dx_router_terminus_is_router(dx_link_remote_target(link)); + dx_field_iterator_t *iter = 0; // // If this link is not a router link and it has no source address, we can't @@ -688,6 +695,25 @@ static int router_outgoing_link_handler(void* context, dx_link_t *link) return 0; } + + // + // If this is an endpoint link with a source address, make sure the address is + // appropriate for endpoint links. If it is not a local or mobile address, (i.e. + // a router or area address), it cannot be bound to an endpoint link. + // + if(r_src && !is_router && !is_dynamic) { + iter = dx_field_iterator_string(r_src, ITER_VIEW_ADDRESS_HASH); + unsigned char prefix = dx_field_iterator_octet(iter); + dx_field_iterator_reset(iter); + + if (prefix != 'L' && prefix != 'M') { + dx_field_iterator_free(iter); + pn_link_close(pn_link); + dx_log(module, LOG_WARNING, "Rejected an outgoing endpoint link with a router address: %s", r_src); + return 0; + } + } + // // Create a router_link record for this link. Some of the fields will be // modified in the different cases below. @@ -725,19 +751,16 @@ static int router_outgoing_link_handler(void* context, dx_link_t *link) // assign it an ephemeral and routable address. If it has a non-dymanic // address, that address needs to be set up in the address list. // - dx_field_iterator_t *iter; - char temp_addr[1000]; // FIXME - dx_address_t *addr; + char temp_addr[1000]; // FIXME + dx_address_t *addr; if (is_dynamic) { dx_router_generate_temp_addr(router, temp_addr, 1000); iter = dx_field_iterator_string(temp_addr, ITER_VIEW_ADDRESS_HASH); pn_terminus_set_address(dx_link_source(link), temp_addr); dx_log(module, LOG_INFO, "Assigned temporary routable address: %s", temp_addr); - } else { - iter = dx_field_iterator_string(r_src, ITER_VIEW_ADDRESS_HASH); + } else dx_log(module, LOG_INFO, "Registered local address: %s", r_src); - } hash_retrieve(router->addr_hash, iter, (void**) &addr); if (!addr) { |
