You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2015/09/04 18:14:06 UTC

[3/3] qpid-dispatch git commit: DISPATCH-148 - Strip qpid-dispatch-specific message annotations on ingress/egress Applied patch from Ganesh Murthy

DISPATCH-148 - Strip qpid-dispatch-specific message annotations on ingress/egress
    Applied patch from Ganesh Murthy


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/4d22cb87
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/4d22cb87
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/4d22cb87

Branch: refs/heads/master
Commit: 4d22cb876964558ffa9e48dac780940da2fb6c4e
Parents: 5ad29d6 4acb752
Author: Ted Ross <tr...@redhat.com>
Authored: Fri Sep 4 12:04:43 2015 -0400
Committer: Ted Ross <tr...@redhat.com>
Committed: Fri Sep 4 12:04:43 2015 -0400

----------------------------------------------------------------------
 .gitignore                                    |   4 +
 include/qpid/dispatch/message.h               |   2 +-
 include/qpid/dispatch/server.h                |  12 +
 python/qpid_dispatch/management/qdrouter.json |  12 +
 src/connection_manager.c                      |  38 +++
 src/message.c                                 |   9 +-
 src/router_node.c                             |  78 +++--
 src/router_private.h                          |   7 +
 src/waypoint.c                                |  14 +-
 tests/system_tests_one_router.py              | 289 ++++++++++++++++-
 tests/system_tests_two_routers.py             | 346 ++++++++++++++++++++-
 11 files changed, 751 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4d22cb87/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4d22cb87/src/connection_manager.c
----------------------------------------------------------------------
diff --cc src/connection_manager.c
index 9483287,1e3cabf..218597c
--- a/src/connection_manager.c
+++ b/src/connection_manager.c
@@@ -97,28 -131,41 +131,31 @@@ static qd_error_t load_server_config(qd
  {
      qd_error_clear();
  
 -    char *authenticatePeer   = qd_entity_opt_string(entity, "authenticatePeer",  0);     CHECK();
 -    char *stripAnnotations   = qd_entity_opt_string(entity, "stripAnnotations",  0);     CHECK();
 -    bool  requireEncryption  = qd_entity_opt_bool(entity,   "requireEncryption", false); CHECK();
 -    bool  requireSsl         = qd_entity_opt_bool(entity,   "requireSsl",        false); CHECK();
 -    bool  depRequirePeerAuth = qd_entity_opt_bool(entity,   "requirePeerAuth",   false); CHECK();
 -    bool  depAllowUnsecured  = qd_entity_opt_bool(entity,   "allowUnsecured", !requireSsl); CHECK();
 -    bool  depAllowNoSasl     = qd_entity_opt_bool(entity,   "allowNoSasl",       false); CHECK();
 +    bool authenticatePeer   = qd_entity_opt_bool(entity, "authenticatePeer",  false); CHECK();
++    char *stripAnnotations  = qd_entity_opt_string(entity, "stripAnnotations", 0);    CHECK();
 +    bool requireEncryption  = qd_entity_opt_bool(entity, "requireEncryption", false); CHECK();
 +    bool requireSsl         = qd_entity_opt_bool(entity, "requireSsl",        false); CHECK();
 +    bool depRequirePeerAuth = qd_entity_opt_bool(entity, "requirePeerAuth",   false); CHECK();
 +    bool depAllowUnsecured  = qd_entity_opt_bool(entity, "allowUnsecured", !requireSsl); CHECK();
  
      memset(config, 0, sizeof(*config));
 -    config->host           = qd_entity_get_string(entity, "addr"); CHECK();
 -    config->port           = qd_entity_get_string(entity, "port"); CHECK();
 -    config->role           = qd_entity_get_string(entity, "role"); CHECK();
 -    config->max_frame_size = qd_entity_get_long(entity, "maxFrameSize"); CHECK();
 -    config->sasl_mechanisms = qd_entity_get_string(entity, "saslMechanisms"); CHECK();
 +    config->host            = qd_entity_get_string(entity, "addr"); CHECK();
 +    config->port            = qd_entity_get_string(entity, "port"); CHECK();
 +    config->role            = qd_entity_get_string(entity, "role"); CHECK();
 +    config->max_frame_size  = qd_entity_get_long(entity, "maxFrameSize"); CHECK();
 +    config->sasl_mechanisms = qd_entity_opt_string(entity, "saslMechanisms", 0); CHECK();
      config->ssl_enabled = has_attrs(entity, ssl_attributes, ssl_attributes_count);
  
 -    load_strip_annotations(config, stripAnnotations);
 +    //
 +    // For now we are hardwiring this attribute to true.  If there's an outcry from the
 +    // user community, we can revisit this later.
 +    //
 +    config->allowInsecureAuthentication = true;
  
 -    if (authenticatePeer) {
 -    	if (strcmp(authenticatePeer, "yes") == 0) {
 -            config->requireAuthentication       = true;
 -            config->allowInsecureAuthentication = false;
 -        } else if (strcmp(authenticatePeer, "insecureOk") == 0) {
 -            config->requireAuthentication       = true;
 -            config->allowInsecureAuthentication = true;
 -        } else {
 -            config->requireAuthentication       = false;
 -            config->allowInsecureAuthentication = true;
 -        }
 -    } else {
 -        config->requireAuthentication       = !depAllowNoSasl;
 -        config->allowInsecureAuthentication = !depRequirePeerAuth;
 -    }
++    load_strip_annotations(config, stripAnnotations);
+ 
 -    config->requireEncryption = requireEncryption || !depAllowUnsecured;
 +    config->requireAuthentication = authenticatePeer || depRequirePeerAuth;
 +    config->requireEncryption     = requireEncryption || !depAllowUnsecured;
  
      if (config->ssl_enabled) {
          config->ssl_required = requireSsl || !depAllowUnsecured;
@@@ -136,6 -182,8 +173,7 @@@
              qd_entity_opt_string(entity, "trustedCerts", 0); CHECK();
      }
  
+     free(stripAnnotations);
 -    free(authenticatePeer);
      return QD_ERROR_NONE;
  
    error:

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4d22cb87/src/router_node.c
----------------------------------------------------------------------
diff --cc src/router_node.c
index 07fcc62,5ef83e0..7ba5097
--- a/src/router_node.c
+++ b/src/router_node.c
@@@ -1183,6 -1183,39 +1183,44 @@@ link_attach_result_t qd_router_link_rou
  }
  
  
 -qd_router_link_t* qd_router_link(qd_link_t *link, qd_link_type_t link_type, qd_direction_t direction, qd_address_t *owning_addr) {
++qd_router_link_t* qd_router_link(qd_link_t *link, qd_link_type_t link_type, qd_direction_t direction, qd_address_t *owning_addr, qd_waypoint_t *wp) {
+     qd_router_link_t *rlink = new_qd_router_link_t();
+     DEQ_ITEM_INIT(rlink);
+     rlink->link_type      = link_type;
+     rlink->link_direction = direction;
+     rlink->owning_addr    = owning_addr;
 -    rlink->waypoint       = 0;
++    rlink->waypoint       = wp;
+     rlink->link           = link;
+     rlink->connected_link = 0;
+     rlink->ref            = 0;
+     rlink->target         = 0;
+     rlink->strip_inbound_annotations  = false;
+     rlink->strip_outbound_annotations = false;
+     DEQ_INIT(rlink->event_fifo);
+     DEQ_INIT(rlink->msg_fifo);
+     DEQ_INIT(rlink->deliveries);
+ 
+     //Get the configuration via the connection's listener.
+ 	qd_connection_t *connection = qd_link_connection(link);
 -	const qd_server_config_t *config = connection->listener->config;
 -
 -	//strip_inbound_annotations and strip_outbound_annotations don't apply to inter router links.
 -	if (rlink->link_type != QD_LINK_ROUTER) {
 -		if (rlink->link_direction == QD_INCOMING) {
 -		    	rlink->strip_inbound_annotations  = config->strip_inbound_annotations;
 -		} else {
 -		        rlink->strip_outbound_annotations = config->strip_outbound_annotations;
 -		}
 -	}
++    if (connection) {
++        const qd_server_config_t *config = connection->listener ?
++            connection->listener->config : connection->connector->config;
++
++        if (config) {
++            //strip_inbound_annotations and strip_outbound_annotations don't apply to inter router links.
++            if (rlink->link_type != QD_LINK_ROUTER) {
++                if (rlink->link_direction == QD_INCOMING) {
++                    rlink->strip_inbound_annotations  = config->strip_inbound_annotations;
++                } else {
++                    rlink->strip_outbound_annotations = config->strip_outbound_annotations;
++                }
++            }
++        }
++    }
+ 
+     return rlink;
+ }
+ 
  /**
   * New Incoming Link Handler
   */
@@@ -1200,19 -1233,7 +1238,7 @@@ static int router_incoming_link_handler
          return 0;
      }
  
-     qd_router_link_t *rlink = new_qd_router_link_t();
-     DEQ_ITEM_INIT(rlink);
-     rlink->link_type      = is_router ? QD_LINK_ROUTER : QD_LINK_ENDPOINT;
-     rlink->link_direction = QD_INCOMING;
-     rlink->owning_addr    = 0;
-     rlink->waypoint       = 0;
-     rlink->link           = link;
-     rlink->connected_link = 0;
-     rlink->ref            = 0;
-     rlink->target         = 0;
-     DEQ_INIT(rlink->event_fifo);
-     DEQ_INIT(rlink->msg_fifo);
-     DEQ_INIT(rlink->deliveries);
 -    qd_router_link_t *rlink = qd_router_link(link, is_router ? QD_LINK_ROUTER : QD_LINK_ENDPOINT, QD_INCOMING, 0);
++    qd_router_link_t *rlink = qd_router_link(link, is_router ? QD_LINK_ROUTER : QD_LINK_ENDPOINT, QD_INCOMING, 0, 0);
  
      if (!is_router && r_tgt) {
          rlink->target = (char*) malloc(strlen(r_tgt) + 1);
@@@ -1327,19 -1348,7 +1353,7 @@@ static int router_outgoing_link_handler
      // Create a router_link record for this link.  Some of the fields will be
      // modified in the different cases below.
      //
-     qd_router_link_t *rlink = new_qd_router_link_t();
-     DEQ_ITEM_INIT(rlink);
-     rlink->link_type      = is_router ? QD_LINK_ROUTER : QD_LINK_ENDPOINT;
-     rlink->link_direction = QD_OUTGOING;
-     rlink->owning_addr    = 0;
-     rlink->waypoint       = 0;
-     rlink->link           = link;
-     rlink->connected_link = 0;
-     rlink->ref            = 0;
-     rlink->target         = 0;
-     DEQ_INIT(rlink->event_fifo);
-     DEQ_INIT(rlink->msg_fifo);
-     DEQ_INIT(rlink->deliveries);
 -    qd_router_link_t *rlink = qd_router_link(link, is_router ? QD_LINK_ROUTER : QD_LINK_ENDPOINT, QD_OUTGOING, 0);
++    qd_router_link_t *rlink = qd_router_link(link, is_router ? QD_LINK_ROUTER : QD_LINK_ENDPOINT, QD_OUTGOING, 0, 0);
  
      qd_link_set_context(link, rlink);
      pn_terminus_copy(qd_link_source(link), qd_link_remote_source(link));

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4d22cb87/src/router_private.h
----------------------------------------------------------------------
diff --cc src/router_private.h
index 04e1bdf,bf566cc..a22ec36
--- a/src/router_private.h
+++ b/src/router_private.h
@@@ -318,4 -320,9 +320,9 @@@ bool qd_router_delivery_disp_changed(qd
  uint64_t qd_router_delivery_disp(qd_router_delivery_t *delivery);
  qd_router_link_t *qd_router_delivery_link(qd_router_delivery_t *delivery);
  
+ /**
+  * Instanciates, initializes and returns a pointer to qd_router_link_t.
+  */
 -qd_router_link_t* qd_router_link(qd_link_t *link, qd_link_type_t link_type, qd_direction_t direction, qd_address_t *owning_addr);
++qd_router_link_t* qd_router_link(qd_link_t *link, qd_link_type_t link_type, qd_direction_t direction, qd_address_t *owning_addr, qd_waypoint_t *wp);
+ 
  #endif

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4d22cb87/src/waypoint.c
----------------------------------------------------------------------
diff --cc src/waypoint.c
index ffe21af,96982e5..556124b
--- a/src/waypoint.c
+++ b/src/waypoint.c
@@@ -85,19 -85,7 +85,7 @@@ static void qd_waypoint_visit_sink_LH(q
          wp->out_link = qd_link(router->node, wp->connection, QD_OUTGOING, wp->address);
          pn_terminus_set_address(qd_link_target(wp->out_link), wp->address);
  
-         qd_router_link_t *rlink = new_qd_router_link_t();
-         DEQ_ITEM_INIT(rlink);
-         rlink->link_type      = QD_LINK_WAYPOINT;
-         rlink->link_direction = QD_OUTGOING;
-         rlink->owning_addr    = addr;
-         rlink->waypoint       = wp;
-         rlink->link           = wp->out_link;
-         rlink->connected_link = 0;
-         rlink->ref            = 0;
-         rlink->target         = 0;
-         DEQ_INIT(rlink->event_fifo);
-         DEQ_INIT(rlink->msg_fifo);
-         DEQ_INIT(rlink->deliveries);
 -        qd_router_link_t *rlink = qd_router_link(wp->out_link, QD_LINK_WAYPOINT, QD_OUTGOING, addr);
++        qd_router_link_t *rlink = qd_router_link(wp->out_link, QD_LINK_WAYPOINT, QD_OUTGOING, addr, wp);
  
          qd_entity_cache_add(QD_ROUTER_LINK_TYPE, rlink);
          DEQ_INSERT_TAIL(router->links, rlink);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org