RDMA/core: Enable the iWarp Port Mapper to provide the actual address of the remote connecting peer
PATCH 1/3 RDMA/core: Enable the iWarp Port Mapper to provide the actual address of the remote connecting peer
This patch series was first submitted for inclusion upstream on 10/13/14, but it seems to have slipped through the cracks.
Add functionality to allow the port mapper to provide to its client the actual (non-mapped) ip/tcp address information of the remote connecting peer
1) Adding remote_info_cb() to process the address info of the remote peer when it initiates the connection
2) Adding a hash list to store the remote address info
3) Adding functionality to add/remove the remote address info After the info has been provided to the port mapper client, it is removed from the hash list
The port mapper client needs to know the actual (non-mapped) address info of the remote peer for each connection, because it is reporting it to the user space application which isn't aware of the port mapper service. (The clients already know the local non-mapped address info)
--- drivers/infiniband/core/iwpm_msg.c | 73 ++++++++++++- drivers/infiniband/core/iwpm_util.c | 208 +++++++++++++++++++++++++++++------ drivers/infiniband/core/iwpm_util.h | 15 +++ include/rdma/iw_portmap.h | 25 ++++ include/uapi/rdma/rdma_netlink.h | 1 + 5 files changed, 288 insertions(+), 34 deletions(-)
drivers/infiniband/core/iwpm_msg.c +72 -1
@@ -468,7 +468,8 @@ add_mapping_response_exit: }EXPORT_SYMBOL (iwpm_add_mapping_cb); -/* netlink attribute policy for the response to add and query mapping request */ +/* netlink attribute policy for the response to add and query mapping request +* and response with remote address info */ static const struct nla_policy resp_query_policy[IWPM_NLA_RQUERY_MAPPING_MAX ] = { [IWPM_NLA_QUERY_MAPPING_SEQ ] = { .type =NLA_U32 }, [IWPM_NLA_QUERY_LOCAL_ADDR ] = { .len =sizeof (struct sockaddr_storage ) },
@@ -559,6 +560,76 @@ query_mapping_response_exit: }EXPORT_SYMBOL (iwpm_add_and_query_mapping_cb); +/* +* iwpm_remote_info_cb - Process a port mapper message, containing +* the remote connecting peer address info +*/ +int iwpm_remote_info_cb (struct sk_buff *skb,struct netlink_callback *cb) +{ +struct nlattr *nltb[IWPM_NLA_RQUERY_MAPPING_MAX ]; +struct sockaddr_storage *local_sockaddr, *remote_sockaddr; +struct sockaddr_storage *mapped_loc_sockaddr, *mapped_rem_sockaddr; +struct iwpm_remote_info *rem_info; +const char *msg_type; +u8 nl_client; +int ret = -EINVAL ; + + msg_type ="Remote Mapping info" ; +if (iwpm_parse_nlmsg (cb,IWPM_NLA_RQUERY_MAPPING_MAX , + resp_query_policy, nltb, msg_type)) +return ret; + + nl_client =RDMA_NL_GET_CLIENT (cb->nlh->nlmsg_type); +if (!iwpm_valid_client (nl_client)) { +pr_info ("%s: Invalid port mapper client = %d\n" , + __func__, nl_client); +return ret; + } +atomic_set (&echo_nlmsg_seq, cb->nlh->nlmsg_seq); + + local_sockaddr = (struct sockaddr_storage *) +nla_data (nltb[IWPM_NLA_QUERY_LOCAL_ADDR ]); + remote_sockaddr = (struct sockaddr_storage *) +nla_data (nltb[IWPM_NLA_QUERY_REMOTE_ADDR ]); + mapped_loc_sockaddr = (struct sockaddr_storage *) +nla_data (nltb[IWPM_NLA_RQUERY_MAPPED_LOC_ADDR ]); + mapped_rem_sockaddr = (struct sockaddr_storage *) +nla_data (nltb[IWPM_NLA_RQUERY_MAPPED_REM_ADDR ]); + +if (mapped_loc_sockaddr->ss_family != local_sockaddr->ss_family || + mapped_rem_sockaddr->ss_family != remote_sockaddr->ss_family) { +pr_info ("%s: Sockaddr family doesn't match the requested one\n" , + __func__); +return ret; + } + rem_info =kzalloc (sizeof (struct iwpm_remote_info ),GFP_ATOMIC ); +if (!rem_info) { +pr_err ("%s: Unable to allocate a remote info\n" , __func__); + ret = -ENOMEM ; +return ret; + } +memcpy (&rem_info->mapped_loc_sockaddr, mapped_loc_sockaddr, +sizeof (struct sockaddr_storage )); +memcpy (&rem_info->remote_sockaddr, remote_sockaddr, +sizeof (struct sockaddr_storage )); +memcpy (&rem_info->mapped_rem_sockaddr, mapped_rem_sockaddr, +sizeof (struct sockaddr_storage )); + rem_info->nl_client = nl_client; + +iwpm_add_remote_info (rem_info); + +iwpm_print_sockaddr (local_sockaddr, +"remote_info: Local sockaddr:" ); +iwpm_print_sockaddr (mapped_loc_sockaddr, +"remote_info: Mapped local sockaddr:" ); +iwpm_print_sockaddr (remote_sockaddr, +"remote_info: Remote sockaddr:" ); +iwpm_print_sockaddr (mapped_rem_sockaddr, +"remote_info: Mapped remote sockaddr:" ); +return ret; +} +EXPORT_SYMBOL (iwpm_remote_info_cb); +/* netlink attribute policy for the received request for mapping info */ static const struct nla_policy resp_mapinfo_policy[IWPM_NLA_MAPINFO_REQ_MAX ] = { [IWPM_NLA_MAPINFO_ULIB_NAME ] = { .type =NLA_STRING ,
drivers/infiniband/core/iwpm_util.c +175 -33
323 lines not on this page · raw message
drivers/infiniband/core/iwpm_util.h +15 -0
@@ -76,6 +76,14 @@ struct iwpm_mapping_info {u8 nl_client; }; +struct iwpm_remote_info { +struct hlist_node hlist_node; +struct sockaddr_storage remote_sockaddr; +struct sockaddr_storage mapped_loc_sockaddr; +struct sockaddr_storage mapped_rem_sockaddr; +u8 nl_client; +}; +struct iwpm_admin_data {atomic_t refcount;atomic_t nlmsg_seq;
@@ -128,6 +136,13 @@ int iwpm_wait_complete_req(struct iwpm_nlmsg_request *nlmsg_request);int iwpm_get_nlmsg_seq (void );/** +* iwpm_add_reminfo - Add remote address info of the connecting peer +* to the remote info hash table +* @reminfo: The remote info to be added +*/ +void iwpm_add_remote_info (struct iwpm_remote_info *reminfo); + +/** * iwpm_valid_client - Check if the port mapper client is valid * @nl_client: The index of the netlink client *
include/rdma/iw_portmap.h +25 -0
@@ -148,6 +148,16 @@ int iwpm_add_mapping_cb(struct sk_buff *, struct netlink_callback *);int iwpm_add_and_query_mapping_cb (struct sk_buff *,struct netlink_callback *);/** +* iwpm_remote_info_cb - Process remote connecting peer address info, which +* the port mapper has received from the connecting peer +* +* @cb: Contains the received message (payload and netlink header) +* +* Stores the IPv4/IPv6 address info in a hash table +*/ +int iwpm_remote_info_cb (struct sk_buff *,struct netlink_callback *); + +/** * iwpm_mapping_error_cb - Process port mapper notification for error * * @skb:
@@ -175,6 +185,21 @@ int iwpm_mapping_info_cb(struct sk_buff *, struct netlink_callback *);int iwpm_ack_mapping_info_cb (struct sk_buff *,struct netlink_callback *);/** +* iwpm_get_remote_info - Get the remote connecting peer address info +* +* @mapped_loc_addr: Mapped local address of the listening peer +* @mapped_rem_addr: Mapped remote address of the connecting peer +* @remote_addr: To store the remote address of the connecting peer +* @nl_client: The index of the netlink client +* +* The remote address info is retrieved and provided to the client in +* the remote_addr. After that it is removed from the hash table +*/ +int iwpm_get_remote_info (struct sockaddr_storage *mapped_loc_addr, +struct sockaddr_storage *mapped_rem_addr, +struct sockaddr_storage *remote_addr,u8 nl_client); + +/** * iwpm_create_mapinfo - Store local and mapped IPv4/IPv6 address * info in a hash table * @local_addr: Local ip/tcp address
include/uapi/rdma/rdma_netlink.h +1 -0
@@ -37,6 +37,7 @@ enum {RDMA_NL_IWPM_ADD_MAPPING ,RDMA_NL_IWPM_QUERY_MAPPING ,RDMA_NL_IWPM_REMOVE_MAPPING , +RDMA_NL_IWPM_REMOTE_INFO ,RDMA_NL_IWPM_HANDLE_ERR ,RDMA_NL_IWPM_MAPINFO , RDMA_NL_IWPM_MAPINFO_NUM,
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Tatyana Nikolova
This patch series was first submitted for inclusion upstream on 10/13/14, but it seems to have slipped through the cracks.
The above text is irrelevant for the kernel git logs, can you re-send with proper cover letter explaining what this series is about.
Quoted 3 lines
Add functionality to allow the port mapper to provide to its client the actual (non-mapped) ip/tcp address information of the remote connecting peer
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html