From f0646875d0bc941e339d305d0c68b13543cd6f2a Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Tue, 25 Oct 2016 13:22:51 +0200 Subject: lib, irmd, ipcpd: Add name querying to IPCPs This adds the ability to query IPCPs if a name can be reached through them, e.g. if a name is available in a DIF. This means that in the shim-udp a DNS query is performed, in the shim-eth-llc an ARP-like query has been added, in the local a check is done to see if the name is registered, and in the normal currently no application is reachable through it. --- src/irmd/ipcp.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'src/irmd/ipcp.c') diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c index 33f7650a..29327df4 100644 --- a/src/irmd/ipcp.c +++ b/src/irmd/ipcp.c @@ -20,15 +20,14 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define OUROBOROS_PREFIX "irmd/ipcp" + #include +#include #include #include #include -#define OUROBOROS_PREFIX "irmd/ipcp" - -#include - #include "ipcp.h" #include @@ -302,6 +301,31 @@ int ipcp_name_unreg(pid_t api, return ret; } +int ipcp_name_query(pid_t api, + char * name) +{ + ipcp_msg_t msg = IPCP_MSG__INIT; + ipcp_msg_t * recv_msg = NULL; + int ret = -1; + + msg.code = IPCP_MSG_CODE__IPCP_NAME_QUERY; + msg.name = name; + + recv_msg = send_recv_ipcp_msg(api, &msg); + if (recv_msg == NULL) + return -1; + + if (recv_msg->has_result == false) { + ipcp_msg__free_unpacked(recv_msg, NULL); + return -1; + } + + ret = recv_msg->result; + ipcp_msg__free_unpacked(recv_msg, NULL); + + return ret; +} + int ipcp_flow_alloc(pid_t api, int port_id, pid_t n_api, -- cgit v1.2.3