Changeset 9749e47 in mainline
- Timestamp:
- 2013-10-04T19:23:43Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1d04b2
- Parents:
- 26de91a
- Files:
-
- 7 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r26de91a r9749e47 202 202 $(USPACE_PATH)/app/nterm/nterm \ 203 203 $(USPACE_PATH)/app/ping/ping \ 204 $(USPACE_PATH)/app/ping6/ping6 \205 204 $(USPACE_PATH)/app/stats/stats \ 206 205 $(USPACE_PATH)/app/sysinfo/sysinfo \ -
uspace/Makefile
r26de91a r9749e47 76 76 app/nettest3 \ 77 77 app/ping \ 78 app/ping6 \79 78 app/sysinfo \ 80 79 app/mkbd \ -
uspace/app/ping/ping.c
r26de91a r9749e47 76 76 }; 77 77 78 static addr32_t src;79 static addr32_t dest;78 static inet_addr_t src_addr; 79 static inet_addr_t dest_addr; 80 80 81 81 static bool repeat_forever = false; 82 82 static size_t repeat_count = 1; 83 83 84 static const char *short_options = " rn:";84 static const char *short_options = "46rn:"; 85 85 86 86 static void print_syntax(void) 87 87 { 88 printf("Syntax: %s [-n <count>|-r] <host>\n", NAME); 88 printf("Syntax: %s [<options>] <host>\n", NAME); 89 printf("\t-n <count> Repeat the specified number of times\n"); 90 printf("\t-r Repeat forever\n"); 91 printf("\t-4|-6 Use IPv4 or IPv6 destination host address\n"); 89 92 } 90 93 … … 107 110 static int ping_ev_recv(inetping_sdu_t *sdu) 108 111 { 109 inet_addr_t src_addr;110 inet_addr_set(sdu->src, &src_addr);111 112 inet_addr_t dest_addr;113 inet_addr_set(sdu->dest, &dest_addr);114 115 112 char *asrc; 116 113 int rc = inet_addr_format(&src_addr, &asrc); … … 139 136 inetping_sdu_t sdu; 140 137 141 sdu.src = src ;142 sdu.dest = dest ;138 sdu.src = src_addr; 139 sdu.dest = dest_addr; 143 140 sdu.seq_no = seq_no; 144 141 sdu.data = (void *) "foo"; … … 221 218 char *adest = NULL; 222 219 char *sdest = NULL; 220 ip_ver_t ip_ver = ip_any; 223 221 224 222 int rc = inetping_init(&ev_ops); … … 243 241 } 244 242 break; 243 case '4': 244 ip_ver = ip_v4; 245 break; 246 case '6': 247 ip_ver = ip_v6; 248 break; 245 249 default: 246 250 printf("Unknown option passed.\n"); … … 257 261 258 262 /* Parse destination address */ 259 inet_addr_t dest_addr;260 263 rc = inet_addr_parse(argv[optind], &dest_addr); 261 264 if (rc != EOK) { 262 265 /* Try interpreting as a host name */ 263 rc = dnsr_name2host(argv[optind], &hinfo, ip_v 4);266 rc = dnsr_name2host(argv[optind], &hinfo, ip_ver); 264 267 if (rc != EOK) { 265 268 printf("Error resolving host '%s'.\n", argv[optind]); … … 270 273 } 271 274 272 ip_ver_t ver = inet_addr_get(&dest_addr, &dest, NULL);273 if (ver != ip_v4) {274 printf("Destination '%s' is not an IPv4 address.\n",275 argv[optind]);276 goto error;277 }278 279 275 /* Determine source address */ 280 rc = inetping_get_srcaddr( dest, &src);276 rc = inetping_get_srcaddr(&dest_addr, &src_addr); 281 277 if (rc != EOK) { 282 278 printf("Failed determining source address.\n"); 283 279 goto error; 284 280 } 285 286 inet_addr_t src_addr;287 inet_addr_set(src, &src_addr);288 281 289 282 rc = inet_addr_format(&src_addr, &asrc); -
uspace/lib/c/Makefile
r26de91a r9749e47 100 100 generic/inetcfg.c \ 101 101 generic/inetping.c \ 102 generic/inetping6.c \103 102 generic/io/asprintf.c \ 104 103 generic/io/input.c \ -
uspace/lib/c/generic/inetping.c
r26de91a r9749e47 1 1 /* 2 * Copyright (c) 2012 Jiri Svoboda 2 * Copyright (c) 2013 Jiri Svoboda 3 * Copyright (c) 2013 Martin Decky 3 4 * All rights reserved. 4 5 * … … 49 50 50 51 assert(inetping_sess == NULL); 51 52 52 53 inetping_ev_ops = ev_ops; 53 54 54 55 rc = loc_service_get_id(SERVICE_NAME_INETPING, &inetping_svc, 55 56 IPC_FLAG_BLOCKING); 56 57 if (rc != EOK) 57 58 return ENOENT; 58 59 59 60 inetping_sess = loc_service_connect(EXCHANGE_SERIALIZE, inetping_svc, 60 61 IPC_FLAG_BLOCKING); 61 62 if (inetping_sess == NULL) 62 63 return ENOENT; 63 64 64 65 async_exch_t *exch = async_exchange_begin(inetping_sess); 65 66 66 67 rc = async_connect_to_me(exch, 0, 0, 0, inetping_cb_conn, NULL); 67 68 async_exchange_end(exch); 68 69 69 70 if (rc != EOK) { 70 71 async_hangup(inetping_sess); … … 72 73 return rc; 73 74 } 74 75 75 76 return EOK; 76 77 } … … 79 80 { 80 81 async_exch_t *exch = async_exchange_begin(inetping_sess); 81 82 82 83 ipc_call_t answer; 83 aid_t req = async_send_3(exch, INETPING_SEND, (sysarg_t) sdu->src, 84 (sysarg_t) sdu->dest, sdu->seq_no, &answer); 85 sysarg_t retval = async_data_write_start(exch, sdu->data, sdu->size); 86 84 aid_t req = async_send_1(exch, INETPING_SEND, sdu->seq_no, &answer); 85 86 int rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src)); 87 if (rc != EOK) { 88 async_exchange_end(exch); 89 async_forget(req); 90 return rc; 91 } 92 93 rc = async_data_write_start(exch, &sdu->dest, sizeof(sdu->dest)); 94 if (rc != EOK) { 95 async_exchange_end(exch); 96 async_forget(req); 97 return rc; 98 } 99 100 rc = async_data_write_start(exch, sdu->data, sdu->size); 101 87 102 async_exchange_end(exch); 88 89 if (retval != EOK) { 90 async_forget(req); 91 return retval; 92 } 93 103 104 if (rc != EOK) { 105 async_forget(req); 106 return rc; 107 } 108 109 sysarg_t retval; 94 110 async_wait_for(req, &retval); 95 return retval; 96 } 97 98 int inetping_get_srcaddr(uint32_t remote, uint32_t *local) 111 112 return (int) retval; 113 } 114 115 int inetping_get_srcaddr(const inet_addr_t *remote, inet_addr_t *local) 99 116 { 100 117 async_exch_t *exch = async_exchange_begin(inetping_sess); 101 102 sysarg_t local_addr; 103 int rc = async_req_1_1(exch, INETPING_GET_SRCADDR, (sysarg_t) remote, 104 &local_addr); 105 118 119 ipc_call_t answer; 120 aid_t req = async_send_0(exch, INETPING_GET_SRCADDR, &answer); 121 122 int rc = async_data_write_start(exch, remote, sizeof(*remote)); 123 if (rc != EOK) { 124 async_exchange_end(exch); 125 async_forget(req); 126 return rc; 127 } 128 129 ipc_call_t answer_local; 130 aid_t req_local = async_data_read(exch, local, sizeof(*local), 131 &answer_local); 132 106 133 async_exchange_end(exch); 107 108 if (rc != EOK) 109 return rc; 110 111 *local = (uint32_t) local_addr; 112 return EOK; 113 } 114 115 static void inetping_ev_recv(ipc_callid_t callid, ipc_call_t *call) 134 135 sysarg_t retval_local; 136 async_wait_for(req_local, &retval_local); 137 138 if (retval_local != EOK) { 139 async_forget(req); 140 return (int) retval_local; 141 } 142 143 sysarg_t retval; 144 async_wait_for(req, &retval); 145 146 return (int) retval; 147 } 148 149 static void inetping_ev_recv(ipc_callid_t iid, ipc_call_t *icall) 116 150 { 117 151 inetping_sdu_t sdu; 118 119 sdu.src = IPC_GET_ARG1(*call); 120 sdu.dest = IPC_GET_ARG2(*call); 121 sdu.seq_no = IPC_GET_ARG3(*call); 122 123 int rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size); 152 153 sdu.seq_no = IPC_GET_ARG1(*icall); 154 155 ipc_callid_t callid; 156 size_t size; 157 if (!async_data_write_receive(&callid, &size)) { 158 async_answer_0(callid, EREFUSED); 159 async_answer_0(iid, EREFUSED); 160 return; 161 } 162 163 if (size != sizeof(sdu.src)) { 164 async_answer_0(callid, EINVAL); 165 async_answer_0(iid, EINVAL); 166 return; 167 } 168 169 int rc = async_data_write_finalize(callid, &sdu.src, size); 124 170 if (rc != EOK) { 125 171 async_answer_0(callid, rc); 126 return; 127 } 128 172 async_answer_0(iid, rc); 173 return; 174 } 175 176 if (!async_data_write_receive(&callid, &size)) { 177 async_answer_0(callid, EREFUSED); 178 async_answer_0(iid, EREFUSED); 179 return; 180 } 181 182 if (size != sizeof(sdu.dest)) { 183 async_answer_0(callid, EINVAL); 184 async_answer_0(iid, EINVAL); 185 return; 186 } 187 188 rc = async_data_write_finalize(callid, &sdu.dest, size); 189 if (rc != EOK) { 190 async_answer_0(callid, rc); 191 async_answer_0(iid, rc); 192 return; 193 } 194 195 rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size); 196 if (rc != EOK) { 197 async_answer_0(iid, rc); 198 return; 199 } 200 129 201 rc = inetping_ev_ops->recv(&sdu); 130 202 free(sdu.data); 131 async_answer_0( callid, rc);203 async_answer_0(iid, rc); 132 204 } 133 205 -
uspace/lib/c/include/inet/inetping.h
r26de91a r9749e47 1 1 /* 2 * Copyright (c) 201 2Jiri Svoboda2 * Copyright (c) 2013 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 46 46 extern int inetping_init(inetping_ev_ops_t *); 47 47 extern int inetping_send(inetping_sdu_t *); 48 extern int inetping_get_srcaddr( uint32_t, uint32_t *);48 extern int inetping_get_srcaddr(const inet_addr_t *, inet_addr_t *); 49 49 50 50 #endif -
uspace/lib/c/include/ipc/inet.h
r26de91a r9749e47 92 92 } inetping_request_t; 93 93 94 /** Events on Inet ping6 port */95 typedef enum {96 INETPING6_EV_RECV = IPC_FIRST_USER_METHOD97 } inetping6_event_t;98 99 /** Requests on Inet ping6 port */100 typedef enum {101 INETPING6_SEND = IPC_FIRST_USER_METHOD,102 INETPING6_GET_SRCADDR103 } inetping6_request_t;104 105 94 #endif 106 95 -
uspace/lib/c/include/types/inetping.h
r26de91a r9749e47 38 38 #define LIBC_TYPES_INETPING_H_ 39 39 40 #include <inet/addr.h> 40 41 #include <sys/types.h> 41 42 42 43 typedef struct { 43 uint32_t src;44 uint32_t dest;44 inet_addr_t src; 45 inet_addr_t dest; 45 46 uint16_t seq_no; 46 47 void *data; -
uspace/srv/net/inetsrv/Makefile
r26de91a r9749e47 38 38 inetcfg.c \ 39 39 inetping.c \ 40 inetping6.c \41 40 ndp.c \ 42 41 ntrans.c \ -
uspace/srv/net/inetsrv/icmp.c
r26de91a r9749e47 130 130 inetping_sdu_t sdu; 131 131 132 ip_ver_t ver = inet_addr_get(&dgram->src, &sdu.src, NULL); 133 if (ver != ip_v4) 134 return EINVAL; 135 136 ver = inet_addr_get(&dgram->dest, &sdu.dest, NULL); 137 if (ver != ip_v4) 138 return EINVAL; 139 132 sdu.src = dgram->src; 133 sdu.dest = dgram->dest; 140 134 sdu.seq_no = uint16_t_be2host(reply->seq_no); 141 135 sdu.data = reply + sizeof(icmp_echo_t); … … 169 163 inet_dgram_t dgram; 170 164 171 inet_addr_set(sdu->src, &dgram.src); 172 inet_addr_set(sdu->dest, &dgram.dest); 173 165 dgram.src = sdu->src; 166 dgram.dest = sdu->dest; 174 167 dgram.iplink = 0; 175 168 dgram.tos = ICMP_TOS; -
uspace/srv/net/inetsrv/icmpv6.c
r26de91a r9749e47 40 40 #include <mem.h> 41 41 #include <stdlib.h> 42 #include <types/inetping 6.h>42 #include <types/inetping.h> 43 43 #include "icmpv6.h" 44 44 #include "icmpv6_std.h" 45 45 #include "inetsrv.h" 46 #include "inetping 6.h"46 #include "inetping.h" 47 47 #include "pdu.h" 48 48 … … 116 116 return EINVAL; 117 117 118 inetping6_sdu_t sdu; 119 120 ip_ver_t src_ver = inet_addr_get(&dgram->src, NULL, &sdu.src); 121 ip_ver_t dest_ver = inet_addr_get(&dgram->dest, NULL, &sdu.dest); 122 123 if ((src_ver != dest_ver) || (src_ver != ip_v6)) 124 return EINVAL; 118 inetping_sdu_t sdu; 119 120 sdu.src = dgram->src; 121 sdu.dest = dgram->dest; 125 122 126 123 icmpv6_message_t *reply = (icmpv6_message_t *) dgram->data; … … 132 129 uint16_t ident = uint16_t_be2host(reply->un.echo.ident); 133 130 134 return inetping 6_recv(ident, &sdu);131 return inetping_recv(ident, &sdu); 135 132 } 136 133 … … 160 157 } 161 158 162 int icmpv6_ping_send(uint16_t ident, inetping 6_sdu_t *sdu)159 int icmpv6_ping_send(uint16_t ident, inetping_sdu_t *sdu) 163 160 { 164 161 size_t rsize = sizeof(icmpv6_message_t) + sdu->size; … … 179 176 inet_dgram_t dgram; 180 177 181 inet_addr_set6(sdu->src, &dgram.src);182 inet_addr_set6(sdu->dest, &dgram.dest);178 dgram.src = sdu->src; 179 dgram.dest = sdu->dest; 183 180 dgram.iplink = 0; 184 181 dgram.tos = 0; … … 188 185 icmpv6_phdr_t phdr; 189 186 190 host2addr128_t_be(sdu->src, phdr.src_addr); 191 host2addr128_t_be(sdu->dest, phdr.dest_addr); 187 assert(sdu->src.version == ip_v6); 188 assert(sdu->dest.version == ip_v6); 189 190 host2addr128_t_be(sdu->src.addr6, phdr.src_addr); 191 host2addr128_t_be(sdu->dest.addr6, phdr.dest_addr); 192 192 phdr.length = host2uint32_t_be(dgram.size); 193 193 memset(phdr.zeroes, 0, 3); -
uspace/srv/net/inetsrv/icmpv6.h
r26de91a r9749e47 38 38 #define ICMPV6_H_ 39 39 40 #include <types/inetping 6.h>40 #include <types/inetping.h> 41 41 #include "inetsrv.h" 42 42 43 43 extern int icmpv6_recv(inet_dgram_t *); 44 extern int icmpv6_ping_send(uint16_t, inetping 6_sdu_t *);44 extern int icmpv6_ping_send(uint16_t, inetping_sdu_t *); 45 45 46 46 #endif -
uspace/srv/net/inetsrv/inetping.c
r26de91a r9749e47 1 1 /* 2 * Copyright (c) 2012 Jiri Svoboda 2 * Copyright (c) 2013 Jiri Svoboda 3 * Copyright (c) 2013 Martin Decky 3 4 * All rights reserved. 4 5 * … … 45 46 #include <types/inetping.h> 46 47 #include "icmp.h" 48 #include "icmpv6.h" 47 49 #include "icmp_std.h" 48 50 #include "inetsrv.h" … … 57 59 static int inetping_send(inetping_client_t *client, inetping_sdu_t *sdu) 58 60 { 59 return icmp_ping_send(client->ident, sdu); 60 } 61 62 static int inetping_get_srcaddr(inetping_client_t *client, addr32_t remote, 63 addr32_t *local) 64 { 65 inet_addr_t remote_addr; 66 inet_addr_set(remote, &remote_addr); 67 68 inet_addr_t local_addr; 69 int rc = inet_get_srcaddr(&remote_addr, ICMP_TOS, &local_addr); 70 if (rc != EOK) 71 return rc; 72 73 ip_ver_t ver = inet_addr_get(&local_addr, local, NULL); 74 if (ver != ip_v4) 61 if (sdu->src.version != sdu->dest.version) 75 62 return EINVAL; 76 77 return EOK; 63 64 switch (sdu->src.version) { 65 case ip_v4: 66 return icmp_ping_send(client->ident, sdu); 67 case ip_v6: 68 return icmpv6_ping_send(client->ident, sdu); 69 default: 70 return EINVAL; 71 } 72 } 73 74 static int inetping_get_srcaddr(inetping_client_t *client, 75 inet_addr_t *remote, inet_addr_t *local) 76 { 77 return inet_get_srcaddr(remote, ICMP_TOS, local); 78 78 } 79 79 … … 81 81 { 82 82 fibril_mutex_lock(&client_list_lock); 83 83 84 84 list_foreach(client_list, client_list, inetping_client_t, client) { 85 85 if (client->ident == ident) { … … 88 88 } 89 89 } 90 90 91 91 fibril_mutex_unlock(&client_list_lock); 92 92 return NULL; … … 100 100 return ENOENT; 101 101 } 102 102 103 103 async_exch_t *exch = async_exchange_begin(client->sess); 104 104 105 105 ipc_call_t answer; 106 aid_t req = async_send_3(exch, INETPING_EV_RECV, (sysarg_t) sdu->src, 107 (sysarg_t) sdu->dest, sdu->seq_no, &answer); 108 int rc = async_data_write_start(exch, sdu->data, sdu->size); 109 110 async_exchange_end(exch); 111 112 if (rc != EOK) { 106 aid_t req = async_send_1(exch, INETPING_EV_RECV, sdu->seq_no, &answer); 107 108 int rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src)); 109 if (rc != EOK) { 110 async_exchange_end(exch); 113 111 async_forget(req); 114 112 return rc; 115 113 } 116 114 115 rc = async_data_write_start(exch, &sdu->dest, sizeof(sdu->dest)); 116 if (rc != EOK) { 117 async_exchange_end(exch); 118 async_forget(req); 119 return rc; 120 } 121 122 rc = async_data_write_start(exch, sdu->data, sdu->size); 123 124 async_exchange_end(exch); 125 126 if (rc != EOK) { 127 async_forget(req); 128 return rc; 129 } 130 117 131 sysarg_t retval; 118 132 async_wait_for(req, &retval); 119 133 120 134 return (int) retval; 121 135 } 122 136 123 static void inetping_send_srv(inetping_client_t *client, ipc_callid_t callid, 124 ipc_call_t *call) 125 { 137 static void inetping_send_srv(inetping_client_t *client, ipc_callid_t iid, 138 ipc_call_t *icall) 139 { 140 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetping_send_srv()"); 141 126 142 inetping_sdu_t sdu; 127 143 int rc; 128 144 129 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetping_send_srv()"); 145 sdu.seq_no = IPC_GET_ARG1(*icall); 146 147 ipc_callid_t callid; 148 size_t size; 149 if (!async_data_write_receive(&callid, &size)) { 150 async_answer_0(callid, EREFUSED); 151 async_answer_0(iid, EREFUSED); 152 return; 153 } 154 155 if (size != sizeof(sdu.src)) { 156 async_answer_0(callid, EINVAL); 157 async_answer_0(iid, EINVAL); 158 return; 159 } 160 161 rc = async_data_write_finalize(callid, &sdu.src, size); 162 if (rc != EOK) { 163 async_answer_0(callid, rc); 164 async_answer_0(iid, rc); 165 return; 166 } 167 168 if (!async_data_write_receive(&callid, &size)) { 169 async_answer_0(callid, EREFUSED); 170 async_answer_0(iid, EREFUSED); 171 return; 172 } 173 174 if (size != sizeof(sdu.dest)) { 175 async_answer_0(callid, EINVAL); 176 async_answer_0(iid, EINVAL); 177 return; 178 } 179 180 rc = async_data_write_finalize(callid, &sdu.dest, size); 181 if (rc != EOK) { 182 async_answer_0(callid, rc); 183 async_answer_0(iid, rc); 184 return; 185 } 130 186 131 187 rc = async_data_write_accept((void **) &sdu.data, false, 0, 0, 0, 132 188 &sdu.size); 133 189 if (rc != EOK) { 134 async_answer_0(callid, rc); 135 return; 136 } 137 138 sdu.src = IPC_GET_ARG1(*call); 139 sdu.dest = IPC_GET_ARG2(*call); 140 sdu.seq_no = IPC_GET_ARG3(*call); 190 async_answer_0(iid, rc); 191 return; 192 } 141 193 142 194 rc = inetping_send(client, &sdu); 143 195 free(sdu.data); 144 196 145 async_answer_0( callid, rc);197 async_answer_0(iid, rc); 146 198 } 147 199 148 200 static void inetping_get_srcaddr_srv(inetping_client_t *client, 149 ipc_callid_t callid, ipc_call_t *call)201 ipc_callid_t iid, ipc_call_t *icall) 150 202 { 151 203 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetping_get_srcaddr_srv()"); 152 153 uint32_t remote = IPC_GET_ARG1(*call); 154 uint32_t local = 0; 155 156 int rc = inetping_get_srcaddr(client, remote, &local); 157 async_answer_1(callid, rc, (sysarg_t) local); 204 205 ipc_callid_t callid; 206 size_t size; 207 208 inet_addr_t local; 209 inet_addr_t remote; 210 211 if (!async_data_write_receive(&callid, &size)) { 212 async_answer_0(callid, EREFUSED); 213 async_answer_0(iid, EREFUSED); 214 return; 215 } 216 217 if (size != sizeof(remote)) { 218 async_answer_0(callid, EINVAL); 219 async_answer_0(iid, EINVAL); 220 return; 221 } 222 223 int rc = async_data_write_finalize(callid, &remote, size); 224 if (rc != EOK) { 225 async_answer_0(callid, rc); 226 async_answer_0(iid, rc); 227 return; 228 } 229 230 rc = inetping_get_srcaddr(client, &remote, &local); 231 if (rc != EOK) { 232 async_answer_0(iid, rc); 233 return; 234 } 235 236 if (!async_data_read_receive(&callid, &size)) { 237 async_answer_0(callid, EREFUSED); 238 async_answer_0(iid, EREFUSED); 239 return; 240 } 241 242 if (size != sizeof(local)) { 243 async_answer_0(callid, EINVAL); 244 async_answer_0(iid, EINVAL); 245 return; 246 } 247 248 rc = async_data_read_finalize(callid, &local, size); 249 if (rc != EOK) 250 async_answer_0(callid, rc); 251 252 async_answer_0(iid, rc); 158 253 } 159 254 … … 163 258 if (sess == NULL) 164 259 return ENOMEM; 165 260 166 261 client->sess = sess; 167 262 link_initialize(&client->client_list); 168 263 169 264 fibril_mutex_lock(&client_list_lock); 170 265 client->ident = ++inetping_ident; 171 266 list_append(&client->client_list, &client_list); 172 267 fibril_mutex_unlock(&client_list_lock); 173 268 174 269 return EOK; 175 270 } … … 179 274 async_hangup(client->sess); 180 275 client->sess = NULL; 181 276 182 277 fibril_mutex_lock(&client_list_lock); 183 278 list_remove(&client->client_list); … … 188 283 { 189 284 log_msg(LOG_DEFAULT, LVL_DEBUG, "inetping_conn()"); 190 285 191 286 /* Accept the connection */ 192 287 async_answer_0(iid, EOK); 193 288 194 289 inetping_client_t client; 195 290 int rc = inetping_client_init(&client); 196 291 if (rc != EOK) 197 292 return; 198 293 199 294 while (true) { 200 295 ipc_call_t call; 201 296 ipc_callid_t callid = async_get_call(&call); 202 297 sysarg_t method = IPC_GET_IMETHOD(call); 203 298 204 299 if (!method) { 205 300 /* The other side has hung up */ … … 207 302 break; 208 303 } 209 304 210 305 switch (method) { 211 306 case INETPING_SEND: … … 219 314 } 220 315 } 221 316 222 317 inetping_client_fini(&client); 223 318 } -
uspace/srv/net/inetsrv/inetsrv.c
r26de91a r9749e47 54 54 #include "inetcfg.h" 55 55 #include "inetping.h" 56 #include "inetping6.h"57 56 #include "inet_link.h" 58 57 #include "reass.h" … … 111 110 rc = loc_service_register_with_iface(SERVICE_NAME_INETPING, &sid, 112 111 INET_PORT_PING); 113 if (rc != EOK) {114 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc);115 return EEXIST;116 }117 118 rc = loc_service_register_with_iface(SERVICE_NAME_INETPING6, &sid,119 INET_PORT_PING6);120 112 if (rc != EOK) { 121 113 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service (%d).", rc); … … 452 444 inetping_conn(iid, icall, arg); 453 445 break; 454 case INET_PORT_PING6:455 inetping6_conn(iid, icall, arg);456 break;457 446 default: 458 447 async_answer_0(iid, ENOTSUP);
Note:
See TracChangeset
for help on using the changeset viewer.