Changeset f94b24c8 in mainline
- Timestamp:
- 2013-07-29T13:54:20Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a1c95da
- Parents:
- 09d6695 (diff), ccdc63e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/netecho/netecho.c
r09d6695 rf94b24c8 225 225 uint8_t address_buf[sizeof(struct sockaddr_in6)]; 226 226 227 socklen_t addrlen ;227 socklen_t addrlen = sizeof(struct sockaddr_in6); 228 228 int socket_id; 229 229 ssize_t rcv_size; … … 240 240 if (type == SOCK_STREAM) { 241 241 /* Accept a socket if a stream socket is used */ 242 addrlen = sizeof(address_buf);243 242 if (verbose) 244 243 printf("accept()\n"); … … 280 279 case AF_INET6: 281 280 port = ntohs(address_in6->sin6_port); 282 address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;281 address_start = (uint8_t *) address_in6->sin6_addr.s6_addr; 283 282 break; 284 283 default: -
uspace/app/nettest1/nettest.c
r09d6695 rf94b24c8 41 41 #include "print_error.h" 42 42 43 44 43 /** Creates new sockets. 45 44 * … … 52 51 * @return Other error codes as defined for the socket() function. 53 52 */ 54 int sockets_create(int verbose, int *socket_ids, int sockets, int family, sock_type_t type) 55 { 56 int index; 57 53 int sockets_create(int verbose, int *socket_ids, unsigned int sockets, 54 uint16_t family, sock_type_t type) 55 { 58 56 if (verbose) 59 57 printf("Create\t"); 60 61 fflush(stdout); 62 63 for ( index = 0; index < sockets; index++) {58 59 fflush(stdout); 60 61 for (unsigned int index = 0; index < sockets; index++) { 64 62 socket_ids[index] = socket(family, type, 0); 65 63 if (socket_ids[index] < 0) { 66 printf("Socket % d(%d) error:\n", index, socket_ids[index]);64 printf("Socket %u (%d) error:\n", index, socket_ids[index]); 67 65 socket_print_error(stderr, socket_ids[index], "Socket create: ", "\n"); 68 66 return socket_ids[index]; 69 67 } 68 70 69 if (verbose) 71 70 print_mark(index); … … 83 82 * @return Other error codes as defined for the closesocket() function. 84 83 */ 85 int sockets_close(int verbose, int *socket_ids, int sockets) 86 { 87 int index; 88 int rc; 89 84 int sockets_close(int verbose, int *socket_ids, unsigned int sockets) 85 { 90 86 if (verbose) 91 87 printf("\tClose\t"); 92 93 fflush(stdout); 94 95 for ( index = 0; index < sockets; index++) {96 rc = closesocket(socket_ids[index]);88 89 fflush(stdout); 90 91 for (unsigned int index = 0; index < sockets; index++) { 92 int rc = closesocket(socket_ids[index]); 97 93 if (rc != EOK) { 98 printf("Socket % d(%d) error:\n", index, socket_ids[index]);94 printf("Socket %u (%d) error:\n", index, socket_ids[index]); 99 95 socket_print_error(stderr, rc, "Socket close: ", "\n"); 100 96 return rc; 101 97 } 98 102 99 if (verbose) 103 100 print_mark(index); … … 117 114 * @return Other error codes as defined for the connect() function. 118 115 */ 119 int sockets_connect(int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t addrlen) 120 { 121 int index; 122 int rc; 123 116 int sockets_connect(int verbose, int *socket_ids, unsigned int sockets, 117 struct sockaddr *address, socklen_t addrlen) 118 { 124 119 if (verbose) 125 120 printf("\tConnect\t"); … … 127 122 fflush(stdout); 128 123 129 for ( index = 0; index < sockets; index++) {130 rc = connect(socket_ids[index], address, addrlen);124 for (unsigned int index = 0; index < sockets; index++) { 125 int rc = connect(socket_ids[index], address, addrlen); 131 126 if (rc != EOK) { 132 127 socket_print_error(stderr, rc, "Socket connect: ", "\n"); 133 128 return rc; 134 129 } 135 if (verbose) 136 print_mark(index); 137 } 138 139 return EOK; 140 } 141 142 /** Sends data via sockets. 143 * 144 * @param[in] verbose A value indicating whether to print out verbose information. 145 * @param[in] socket_ids A field of stored socket identifiers. 146 * @param[in] sockets The number of sockets in the field. Should be at most the size of the field. 147 * @param[in] address The destination host address to send data to. 148 * @param[in] addrlen The length of the destination address in bytes. 149 * @param[in] data The data to be sent. 150 * @param[in] size The data size in bytes. 151 * @param[in] messages The number of datagrams per socket to be sent. 130 131 if (verbose) 132 print_mark(index); 133 } 134 135 return EOK; 136 } 137 138 /** Send data via sockets. 139 * 140 * @param[in] verbose Print out verbose information. 141 * @param[in] socket_ids Stored socket identifiers. 142 * @param[in] sockets Number of sockets. 143 * @param[in] address Destination host address to send data to. 144 * @param[in] addrlen Length of the destination address in bytes. 145 * @param[in] data Data to be sent. 146 * @param[in] size Size of the data in bytes. 147 * @param[in] messages Number of datagrams per socket to be sent. 148 * @param[in] type Socket type. 149 * 152 150 * @return EOK on success. 153 151 * @return Other error codes as defined for the sendto() function. 154 */ 155 int sockets_sendto(int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t addrlen, char *data, int size, int messages) 156 { 157 int index; 158 int message; 159 int rc; 160 152 * 153 */ 154 int sockets_sendto(int verbose, int *socket_ids, unsigned int sockets, 155 struct sockaddr *address, socklen_t addrlen, char *data, size_t size, 156 unsigned int messages, sock_type_t type) 157 { 161 158 if (verbose) 162 159 printf("\tSendto\t"); 163 164 fflush(stdout); 165 166 for (index = 0; index < sockets; index++) { 167 for (message = 0; message < messages; message++) { 168 rc = sendto(socket_ids[index], data, size, 0, address, addrlen); 160 161 fflush(stdout); 162 163 for (unsigned int index = 0; index < sockets; index++) { 164 for (unsigned int message = 0; message < messages; message++) { 165 int rc; 166 167 switch (type) { 168 case SOCK_STREAM: 169 rc = send(socket_ids[index], data, size, 0); 170 break; 171 case SOCK_DGRAM: 172 rc = sendto(socket_ids[index], data, size, 0, address, addrlen); 173 break; 174 default: 175 rc = EINVAL; 176 } 177 169 178 if (rc != EOK) { 170 printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message); 179 printf("Socket %u (%d), message %u error:\n", 180 index, socket_ids[index], message); 171 181 socket_print_error(stderr, rc, "Socket send: ", "\n"); 172 182 return rc; 173 183 } 174 184 } 175 if (verbose) 176 print_mark(index); 177 } 178 179 return EOK; 180 } 181 182 /** Receives data via sockets. 183 * 184 * @param[in] verbose A value indicating whether to print out verbose information. 185 * @param[in] socket_ids A field of stored socket identifiers. 186 * @param[in] sockets The number of sockets in the field. Should be at most the size of the field. 187 * @param[in] address The source host address of received datagrams. 188 * @param[in,out] addrlen The maximum length of the source address in bytes. The actual size of the source address is set instead. 189 * @param[out] data The received data. 190 * @param[in] size The maximum data size in bytes. 191 * @param[in] messages The number of datagrams per socket to be received. 185 186 if (verbose) 187 print_mark(index); 188 } 189 190 return EOK; 191 } 192 193 /** Receive data via sockets. 194 * 195 * @param[in] verbose Print out verbose information. 196 * @param[in] socket_ids Stored socket identifiers. 197 * @param[in] sockets Number of sockets. 198 * @param[in] address Source host address of received datagrams. 199 * @param[in,out] addrlen Maximum length of the source address in bytes. 200 * The actual size of the source address is set. 201 * @param[out] data Received data. 202 * @param[in] size Maximum data size in bytes. 203 * @param[in] messages Number of datagrams per socket to be received. 204 * 192 205 * @return EOK on success. 193 206 * @return Other error codes as defined for the recvfrom() function. 194 */ 195 int sockets_recvfrom(int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t *addrlen, char *data, int size, int messages) 196 { 197 int value; 198 int index; 199 int message; 200 207 * 208 */ 209 int sockets_recvfrom(int verbose, int *socket_ids, unsigned int sockets, 210 struct sockaddr *address, socklen_t *addrlen, char *data, size_t size, 211 unsigned int messages) 212 { 201 213 if (verbose) 202 214 printf("\tRecvfrom\t"); … … 204 216 fflush(stdout); 205 217 206 for (index = 0; index < sockets; index++) { 207 for (message = 0; message < messages; message++) { 208 value = recvfrom(socket_ids[index], data, size, 0, address, addrlen); 209 if (value < 0) { 210 printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message); 211 socket_print_error(stderr, value, "Socket receive: ", "\n"); 212 return value; 213 } 214 } 215 if (verbose) 216 print_mark(index); 217 } 218 return EOK; 219 } 220 221 /** Sends and receives data via sockets. 218 for (unsigned int index = 0; index < sockets; index++) { 219 for (unsigned int message = 0; message < messages; message++) { 220 int rc = recvfrom(socket_ids[index], data, size, 0, address, addrlen); 221 if (rc < 0) { 222 printf("Socket %u (%d), message %u error:\n", 223 index, socket_ids[index], message); 224 socket_print_error(stderr, rc, "Socket receive: ", "\n"); 225 return rc; 226 } 227 } 228 229 if (verbose) 230 print_mark(index); 231 } 232 233 return EOK; 234 } 235 236 /** Send and receive data via sockets. 222 237 * 223 238 * Each datagram is sent and a reply read consequently. 224 239 * The next datagram is sent after the reply is received. 225 240 * 226 * @param[in] verbose A value indicating whether to print out verbose information. 227 * @param[in] socket_ids A field of stored socket identifiers. 228 * @param[in] sockets The number of sockets in the field. Should be at most the size of the field. 229 * @param[in,out] address The destination host address to send data to. The source host address of received datagrams is set instead. 230 * @param[in] addrlen The length of the destination address in bytes. 231 * @param[in,out] data The data to be sent. The received data are set instead. 232 * @param[in] size The data size in bytes. 233 * @param[in] messages The number of datagrams per socket to be received. 241 * @param[in] verbose Print out verbose information. 242 * @param[in] socket_ids Stored socket identifiers. 243 * @param[in] sockets Number of sockets. 244 * @param[in,out] address Destination host address to send data to. 245 * The source host address of received datagrams is set. 246 * @param[in] addrlen Length of the destination address in bytes. 247 * @param[in,out] data Data to be sent. The received data are set. 248 * @param[in] size Size of the data in bytes. 249 * @param[in] messages Number of datagrams per socket to be received. 250 * @param[in] type Socket type. 251 * 234 252 * @return EOK on success. 235 253 * @return Other error codes as defined for the recvfrom() function. 236 */ 237 int sockets_sendto_recvfrom(int verbose, int *socket_ids, int sockets, struct sockaddr *address, socklen_t *addrlen, char *data, int size, int messages) 238 { 239 int value; 240 int index; 241 int message; 242 int rc; 243 254 * 255 */ 256 int sockets_sendto_recvfrom(int verbose, int *socket_ids, unsigned int sockets, 257 struct sockaddr *address, socklen_t *addrlen, char *data, 258 size_t size, unsigned int messages, sock_type_t type) 259 { 244 260 if (verbose) 245 261 printf("\tSendto and recvfrom\t"); 246 247 fflush(stdout); 248 249 for (index = 0; index < sockets; index++) { 250 for (message = 0; message < messages; message++) { 251 rc = sendto(socket_ids[index], data, size, 0, address, *addrlen); 262 263 fflush(stdout); 264 265 for (unsigned int index = 0; index < sockets; index++) { 266 for (unsigned int message = 0; message < messages; message++) { 267 int rc; 268 269 switch (type) { 270 case SOCK_STREAM: 271 rc = send(socket_ids[index], data, size, 0); 272 break; 273 case SOCK_DGRAM: 274 rc = sendto(socket_ids[index], data, size, 0, address, *addrlen); 275 break; 276 default: 277 rc = EINVAL; 278 } 279 252 280 if (rc != EOK) { 253 printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message); 281 printf("Socket %u (%d), message %u error:\n", 282 index, socket_ids[index], message); 254 283 socket_print_error(stderr, rc, "Socket send: ", "\n"); 255 284 return rc; 256 285 } 257 value = recvfrom(socket_ids[index], data, size, 0, address, addrlen); 258 if (value < 0) { 259 printf("Socket %d (%d), message %d error:\n", index, socket_ids[index], message); 260 socket_print_error(stderr, value, "Socket receive: ", "\n"); 261 return value; 262 } 263 } 286 287 rc = recvfrom(socket_ids[index], data, size, 0, address, addrlen); 288 if (rc < 0) { 289 printf("Socket %u (%d), message %u error:\n", 290 index, socket_ids[index], message); 291 socket_print_error(stderr, rc, "Socket receive: ", "\n"); 292 return rc; 293 } 294 } 295 264 296 if (verbose) 265 297 print_mark(index); … … 274 306 * 275 307 * @param[in] index The index of the mark to be printed. 276 */ 277 void print_mark(int index) 308 * 309 */ 310 void print_mark(unsigned int index) 278 311 { 279 312 if ((index + 1) % 10) … … 281 314 else 282 315 printf("|"); 316 283 317 fflush(stdout); 284 318 } -
uspace/app/nettest1/nettest.h
r09d6695 rf94b24c8 40 40 #include <net/socket.h> 41 41 42 extern void print_mark(int); 43 extern int sockets_create(int, int *, int, int, sock_type_t); 44 extern int sockets_close(int, int *, int); 45 extern int sockets_connect(int, int *, int, struct sockaddr *, socklen_t); 46 extern int sockets_sendto(int, int *, int, struct sockaddr *, socklen_t, char *, int, int); 47 extern int sockets_recvfrom(int, int *, int, struct sockaddr *, socklen_t *, char *, int, int); 48 extern int sockets_sendto_recvfrom(int, int *, int, struct sockaddr *, socklen_t *, char *, int, int); 42 extern void print_mark(unsigned int); 43 extern int sockets_create(int, int *, unsigned int, uint16_t, sock_type_t); 44 extern int sockets_close(int, int *, unsigned int); 45 extern int sockets_connect(int, int *, unsigned int, struct sockaddr *, 46 socklen_t); 47 extern int sockets_sendto(int, int *, unsigned int, struct sockaddr *, 48 socklen_t, char *, size_t, unsigned int, sock_type_t); 49 extern int sockets_recvfrom(int, int *, unsigned int, struct sockaddr *, 50 socklen_t *, char *, size_t, unsigned int); 51 extern int sockets_sendto_recvfrom(int, int *, unsigned int, struct sockaddr *, 52 socklen_t *, char *, size_t, unsigned int, sock_type_t); 49 53 50 54 #endif -
uspace/app/nettest1/nettest1.c
r09d6695 rf94b24c8 253 253 254 254 rc = sockets_sendto_recvfrom(verbose, socket_ids, nsockets, address, 255 &addrlen, data, size, nmessages );255 &addrlen, data, size, nmessages, type); 256 256 if (rc != EOK) 257 257 return rc; … … 278 278 279 279 rc = sockets_sendto(verbose, socket_ids, nsockets, address, addrlen, 280 data, size, nmessages );280 data, size, nmessages, type); 281 281 if (rc != EOK) 282 282 return rc; -
uspace/app/nettest2/nettest2.c
r09d6695 rf94b24c8 375 375 376 376 rc = sockets_sendto_recvfrom(verbose, socket_ids, sockets, address, 377 &addrlen, data, size, messages );377 &addrlen, data, size, messages, type); 378 378 if (rc != EOK) 379 379 return rc; … … 399 399 400 400 rc = sockets_sendto(verbose, socket_ids, sockets, address, addrlen, 401 data, size, messages );401 data, size, messages, type); 402 402 if (rc != EOK) 403 403 return rc; -
uspace/app/ping/ping.c
r09d6695 rf94b24c8 42 42 #include <inet/inetping.h> 43 43 #include <io/console.h> 44 #include <getopt.h> 44 45 #include <stdio.h> 45 46 #include <stdlib.h> 47 #include <str.h> 48 #include <str_error.h> 46 49 #include <sys/types.h> 47 50 … … 54 57 #define PING_TIMEOUT (1000 * 1000) 55 58 59 typedef enum { 60 RECEIVED_NONE, 61 RECEIVED_SUCCESS, 62 RECEIVED_INTERRUPT 63 } received_t; 64 65 static received_t received; 66 static FIBRIL_CONDVAR_INITIALIZE(received_cv); 67 static FIBRIL_MUTEX_INITIALIZE(received_lock); 68 69 static bool quit = false; 70 static FIBRIL_CONDVAR_INITIALIZE(quit_cv); 71 static FIBRIL_MUTEX_INITIALIZE(quit_lock); 72 56 73 static int ping_ev_recv(inetping_sdu_t *); 57 58 static bool done = false;59 static FIBRIL_CONDVAR_INITIALIZE(done_cv);60 static FIBRIL_MUTEX_INITIALIZE(done_lock);61 74 62 75 static inetping_ev_ops_t ev_ops = { … … 67 80 static addr32_t dest; 68 81 69 static bool ping_repeat = false; 82 static bool repeat_forever = false; 83 static size_t repeat_count = 1; 84 85 static const char *short_options = "rn:"; 70 86 71 87 static void print_syntax(void) 72 88 { 73 printf("syntax: " NAME " [-r] <host>\n"); 74 } 75 76 static void ping_signal_done(void) 77 { 78 fibril_mutex_lock(&done_lock); 79 done = true; 80 fibril_mutex_unlock(&done_lock); 81 fibril_condvar_broadcast(&done_cv); 89 printf("Syntax: %s [-n <count>|-r] <host>\n", NAME); 90 } 91 92 static void ping_signal_received(received_t value) 93 { 94 fibril_mutex_lock(&received_lock); 95 received = value; 96 fibril_mutex_unlock(&received_lock); 97 fibril_condvar_broadcast(&received_cv); 98 } 99 100 static void ping_signal_quit(void) 101 { 102 fibril_mutex_lock(&quit_lock); 103 quit = true; 104 fibril_mutex_unlock(&quit_lock); 105 fibril_condvar_broadcast(&quit_cv); 82 106 } 83 107 … … 105 129 "payload size %zu\n", asrc, adest, sdu->seq_no, sdu->size); 106 130 107 if (!ping_repeat) 108 ping_signal_done(); 131 ping_signal_received(RECEIVED_SUCCESS); 109 132 110 133 free(asrc); … … 116 139 { 117 140 inetping_sdu_t sdu; 118 int rc; 119 141 120 142 sdu.src = src; 121 143 sdu.dest = dest; … … 123 145 sdu.data = (void *) "foo"; 124 146 sdu.size = 3; 125 126 rc = inetping_send(&sdu); 127 if (rc != EOK) { 128 printf(NAME ": Failed sending echo request (%d).\n", rc); 129 return rc; 130 } 131 132 return EOK; 147 148 int rc = inetping_send(&sdu); 149 if (rc != EOK) 150 printf("Failed sending echo request: %s (%d).\n", 151 str_error(rc), rc); 152 153 return rc; 133 154 } 134 155 … … 136 157 { 137 158 uint16_t seq_no = 0; 138 159 160 while ((repeat_count--) || (repeat_forever)) { 161 fibril_mutex_lock(&received_lock); 162 received = RECEIVED_NONE; 163 fibril_mutex_unlock(&received_lock); 164 165 (void) ping_send(++seq_no); 166 167 fibril_mutex_lock(&received_lock); 168 int rc = fibril_condvar_wait_timeout(&received_cv, &received_lock, 169 PING_TIMEOUT); 170 received_t recv = received; 171 fibril_mutex_unlock(&received_lock); 172 173 if ((rc == ETIMEOUT) || (recv == RECEIVED_NONE)) 174 printf("Echo request timed out (seq. no %u)\n", seq_no); 175 176 if (recv == RECEIVED_INTERRUPT) 177 break; 178 179 if ((repeat_count > 0) || (repeat_forever)) { 180 fibril_mutex_lock(&received_lock); 181 rc = fibril_condvar_wait_timeout(&received_cv, &received_lock, 182 PING_DELAY); 183 recv = received; 184 fibril_mutex_unlock(&received_lock); 185 186 if (recv == RECEIVED_INTERRUPT) 187 break; 188 } 189 } 190 191 ping_signal_quit(); 192 return 0; 193 } 194 195 static int input_fibril(void *arg) 196 { 197 console_ctrl_t *con = console_init(stdin, stdout); 198 139 199 while (true) { 140 fibril_mutex_lock(&done_lock); 141 if (done) { 142 fibril_mutex_unlock(&done_lock); 143 return 0; 144 } 145 fibril_mutex_unlock(&done_lock); 146 147 (void) ping_send(++seq_no); 148 async_usleep(PING_DELAY); 149 } 150 151 return 0; 152 } 153 154 static int input_fibril(void *arg) 155 { 156 console_ctrl_t *con; 157 cons_event_t ev; 158 159 con = console_init(stdin, stdout); 160 printf("[Press Ctrl-Q to quit]\n"); 161 162 while (true) { 200 cons_event_t ev; 163 201 if (!console_get_event(con, &ev)) 164 202 break; 165 166 if ( ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS&&167 ( ev.ev.key.mods & (KM_ALT | KM_SHIFT)) ==168 0 && (ev.ev.key.mods & KM_CTRL) != 0) {203 204 if ((ev.type == CEV_KEY) && (ev.ev.key.type == KEY_PRESS) && 205 ((ev.ev.key.mods & (KM_ALT | KM_SHIFT)) == 0) && 206 ((ev.ev.key.mods & KM_CTRL) != 0)) { 169 207 /* Ctrl+key */ 170 208 if (ev.ev.key.key == KC_Q) { 171 ping_signal_ done();172 return 0;209 ping_signal_received(RECEIVED_INTERRUPT); 210 break; 173 211 } 174 212 } 175 213 } 176 214 177 215 return 0; 178 216 } … … 184 222 char *adest = NULL; 185 223 char *sdest = NULL; 186 int rc; 187 int argi; 188 189 rc = inetping_init(&ev_ops); 190 if (rc != EOK) { 191 printf(NAME ": Failed connecting to internet ping service " 192 "(%d).\n", rc); 193 goto error; 194 } 195 196 argi = 1; 197 if (argi < argc && str_cmp(argv[argi], "-r") == 0) { 198 ping_repeat = true; 199 ++argi; 200 } else { 201 ping_repeat = false; 202 } 203 204 if (argc - argi != 1) { 224 225 int rc = inetping_init(&ev_ops); 226 if (rc != EOK) { 227 printf("Failed connecting to internet ping service: " 228 "%s (%d).\n", str_error(rc), rc); 229 goto error; 230 } 231 232 int c; 233 while ((c = getopt(argc, argv, short_options)) != -1) { 234 switch (c) { 235 case 'r': 236 repeat_forever = true; 237 break; 238 case 'n': 239 rc = str_size_t(optarg, NULL, 10, true, &repeat_count); 240 if (rc != EOK) { 241 printf("Invalid repeat count.\n"); 242 print_syntax(); 243 goto error; 244 } 245 break; 246 default: 247 printf("Unknown option passed.\n"); 248 print_syntax(); 249 goto error; 250 } 251 } 252 253 if (optind >= argc) { 254 printf("IP address or host name not supplied.\n"); 205 255 print_syntax(); 206 256 goto error; 207 257 } 208 258 209 259 /* Parse destination address */ 210 260 inet_addr_t dest_addr; 211 rc = inet_addr_parse(argv[ argi], &dest_addr);261 rc = inet_addr_parse(argv[optind], &dest_addr); 212 262 if (rc != EOK) { 213 263 /* Try interpreting as a host name */ 214 rc = dnsr_name2host(argv[ argi], &hinfo, AF_INET);264 rc = dnsr_name2host(argv[optind], &hinfo, AF_INET); 215 265 if (rc != EOK) { 216 printf( NAME ": Error resolving host '%s'.\n", argv[argi]);266 printf("Error resolving host '%s'.\n", argv[optind]); 217 267 goto error; 218 268 } … … 223 273 uint16_t af = inet_addr_get(&dest_addr, &dest, NULL); 224 274 if (af != AF_INET) { 225 printf( NAME ":Destination '%s' is not an IPv4 address.\n",226 argv[ argi]);275 printf("Destination '%s' is not an IPv4 address.\n", 276 argv[optind]); 227 277 goto error; 228 278 } … … 231 281 rc = inetping_get_srcaddr(dest, &src); 232 282 if (rc != EOK) { 233 printf( NAME ":Failed determining source address.\n");283 printf("Failed determining source address.\n"); 234 284 goto error; 235 285 } … … 240 290 rc = inet_addr_format(&src_addr, &asrc); 241 291 if (rc != EOK) { 242 printf( NAME ":Out of memory.\n");292 printf("Out of memory.\n"); 243 293 goto error; 244 294 } … … 246 296 rc = inet_addr_format(&dest_addr, &adest); 247 297 if (rc != EOK) { 248 printf( NAME ":Out of memory.\n");298 printf("Out of memory.\n"); 249 299 goto error; 250 300 } … … 253 303 rc = asprintf(&sdest, "%s (%s)", hinfo->cname, adest); 254 304 if (rc < 0) { 255 printf( NAME ":Out of memory.\n");305 printf("Out of memory.\n"); 256 306 goto error; 257 307 } … … 260 310 adest = NULL; 261 311 } 262 263 printf("Sending ICMP echo request from %s to %s .\n",312 313 printf("Sending ICMP echo request from %s to %s (Ctrl+Q to quit)\n", 264 314 asrc, sdest); 265 266 fid_t fid; 267 268 if (ping_repeat) { 269 fid = fibril_create(transmit_fibril, NULL); 270 if (fid == 0) { 271 printf(NAME ": Failed creating transmit fibril.\n"); 272 goto error; 273 } 274 275 fibril_add_ready(fid); 276 277 fid = fibril_create(input_fibril, NULL); 278 if (fid == 0) { 279 printf(NAME ": Failed creating input fibril.\n"); 280 goto error; 281 } 282 283 fibril_add_ready(fid); 284 } else { 285 ping_send(1); 286 } 287 288 fibril_mutex_lock(&done_lock); 289 rc = EOK; 290 while (!done && rc != ETIMEOUT) { 291 rc = fibril_condvar_wait_timeout(&done_cv, &done_lock, 292 ping_repeat ? 0 : PING_TIMEOUT); 293 } 294 fibril_mutex_unlock(&done_lock); 295 296 if (rc == ETIMEOUT) { 297 printf(NAME ": Echo request timed out.\n"); 298 goto error; 299 } 300 315 316 fid_t fid = fibril_create(transmit_fibril, NULL); 317 if (fid == 0) { 318 printf("Failed creating transmit fibril.\n"); 319 goto error; 320 } 321 322 fibril_add_ready(fid); 323 324 fid = fibril_create(input_fibril, NULL); 325 if (fid == 0) { 326 printf("Failed creating input fibril.\n"); 327 goto error; 328 } 329 330 fibril_add_ready(fid); 331 332 fibril_mutex_lock(&quit_lock); 333 while (!quit) 334 fibril_condvar_wait(&quit_cv, &quit_lock); 335 fibril_mutex_unlock(&quit_lock); 336 301 337 free(asrc); 302 338 free(adest); -
uspace/app/ping6/ping6.c
r09d6695 rf94b24c8 42 42 #include <inet/inetping6.h> 43 43 #include <io/console.h> 44 #include <getopt.h> 44 45 #include <stdio.h> 45 46 #include <stdlib.h> 47 #include <str.h> 48 #include <str_error.h> 46 49 #include <sys/types.h> 47 50 … … 54 57 #define PING_TIMEOUT (1000 * 1000) 55 58 59 typedef enum { 60 RECEIVED_NONE, 61 RECEIVED_SUCCESS, 62 RECEIVED_INTERRUPT 63 } received_t; 64 65 static received_t received; 66 static FIBRIL_CONDVAR_INITIALIZE(received_cv); 67 static FIBRIL_MUTEX_INITIALIZE(received_lock); 68 69 static bool quit = false; 70 static FIBRIL_CONDVAR_INITIALIZE(quit_cv); 71 static FIBRIL_MUTEX_INITIALIZE(quit_lock); 72 56 73 static int ping_ev_recv(inetping6_sdu_t *); 57 58 static bool done = false;59 static FIBRIL_CONDVAR_INITIALIZE(done_cv);60 static FIBRIL_MUTEX_INITIALIZE(done_lock);61 74 62 75 static inetping6_ev_ops_t ev_ops = { … … 67 80 static addr128_t dest; 68 81 69 static bool ping_repeat = false; 82 static bool repeat_forever = false; 83 static size_t repeat_count = 1; 84 85 static const char *short_options = "rn:"; 70 86 71 87 static void print_syntax(void) 72 88 { 73 printf("syntax: " NAME " [-r] <host>\n"); 74 } 75 76 static void ping_signal_done(void) 77 { 78 fibril_mutex_lock(&done_lock); 79 done = true; 80 fibril_mutex_unlock(&done_lock); 81 fibril_condvar_broadcast(&done_cv); 89 printf("Syntax: %s [-n <count>|-r] <host>\n", NAME); 90 } 91 92 static void ping_signal_received(received_t value) 93 { 94 fibril_mutex_lock(&received_lock); 95 received = value; 96 fibril_mutex_unlock(&received_lock); 97 fibril_condvar_broadcast(&received_cv); 98 } 99 100 static void ping_signal_quit(void) 101 { 102 fibril_mutex_lock(&quit_lock); 103 quit = true; 104 fibril_mutex_unlock(&quit_lock); 105 fibril_condvar_broadcast(&quit_cv); 82 106 } 83 107 … … 105 129 "payload size %zu\n", asrc, adest, sdu->seq_no, sdu->size); 106 130 107 if (!ping_repeat) 108 ping_signal_done(); 131 ping_signal_received(RECEIVED_SUCCESS); 109 132 110 133 free(asrc); … … 116 139 { 117 140 inetping6_sdu_t sdu; 118 int rc; 119 141 120 142 addr128(src, sdu.src); 121 143 addr128(dest, sdu.dest); … … 123 145 sdu.data = (void *) "foo"; 124 146 sdu.size = 3; 125 126 rc = inetping6_send(&sdu); 127 if (rc != EOK) { 128 printf(NAME ": Failed sending echo request (%d).\n", rc); 129 return rc; 130 } 131 132 return EOK; 147 148 int rc = inetping6_send(&sdu); 149 if (rc != EOK) 150 printf("Failed sending echo request: %s (%d).\n", 151 str_error(rc), rc); 152 153 return rc; 133 154 } 134 155 … … 136 157 { 137 158 uint16_t seq_no = 0; 138 159 160 while ((repeat_count--) || (repeat_forever)) { 161 fibril_mutex_lock(&received_lock); 162 received = RECEIVED_NONE; 163 fibril_mutex_unlock(&received_lock); 164 165 (void) ping_send(++seq_no); 166 167 fibril_mutex_lock(&received_lock); 168 int rc = fibril_condvar_wait_timeout(&received_cv, &received_lock, 169 PING_TIMEOUT); 170 received_t recv = received; 171 fibril_mutex_unlock(&received_lock); 172 173 if ((rc == ETIMEOUT) || (recv == RECEIVED_NONE)) 174 printf("Echo request timed out (seq. no %u)\n", seq_no); 175 176 if (recv == RECEIVED_INTERRUPT) 177 break; 178 179 if ((repeat_count > 0) || (repeat_forever)) { 180 fibril_mutex_lock(&received_lock); 181 rc = fibril_condvar_wait_timeout(&received_cv, &received_lock, 182 PING_DELAY); 183 recv = received; 184 fibril_mutex_unlock(&received_lock); 185 186 if (recv == RECEIVED_INTERRUPT) 187 break; 188 } 189 } 190 191 ping_signal_quit(); 192 return 0; 193 } 194 195 static int input_fibril(void *arg) 196 { 197 console_ctrl_t *con = console_init(stdin, stdout); 198 139 199 while (true) { 140 fibril_mutex_lock(&done_lock); 141 if (done) { 142 fibril_mutex_unlock(&done_lock); 143 return 0; 144 } 145 fibril_mutex_unlock(&done_lock); 146 147 (void) ping_send(++seq_no); 148 async_usleep(PING_DELAY); 149 } 150 151 return 0; 152 } 153 154 static int input_fibril(void *arg) 155 { 156 console_ctrl_t *con; 157 cons_event_t ev; 158 159 con = console_init(stdin, stdout); 160 printf("[Press Ctrl-Q to quit]\n"); 161 162 while (true) { 200 cons_event_t ev; 163 201 if (!console_get_event(con, &ev)) 164 202 break; 165 166 if ( ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS&&167 ( ev.ev.key.mods & (KM_ALT | KM_SHIFT)) ==168 0 && (ev.ev.key.mods & KM_CTRL) != 0) {203 204 if ((ev.type == CEV_KEY) && (ev.ev.key.type == KEY_PRESS) && 205 ((ev.ev.key.mods & (KM_ALT | KM_SHIFT)) == 0) && 206 ((ev.ev.key.mods & KM_CTRL) != 0)) { 169 207 /* Ctrl+key */ 170 208 if (ev.ev.key.key == KC_Q) { 171 ping_signal_ done();172 return 0;209 ping_signal_received(RECEIVED_INTERRUPT); 210 break; 173 211 } 174 212 } 175 213 } 176 214 177 215 return 0; 178 216 } … … 184 222 char *adest = NULL; 185 223 char *sdest = NULL; 186 int rc; 187 int argi; 188 189 rc = inetping6_init(&ev_ops); 190 if (rc != EOK) { 191 printf(NAME ": Failed connecting to internet ping service " 192 "(%d).\n", rc); 193 goto error; 194 } 195 196 argi = 1; 197 if (argi < argc && str_cmp(argv[argi], "-r") == 0) { 198 ping_repeat = true; 199 ++argi; 200 } else { 201 ping_repeat = false; 202 } 203 204 if (argc - argi != 1) { 224 225 int rc = inetping6_init(&ev_ops); 226 if (rc != EOK) { 227 printf("Failed connecting to internet ping service: " 228 "%s (%d).\n", str_error(rc), rc); 229 goto error; 230 } 231 232 int c; 233 while ((c = getopt(argc, argv, short_options)) != -1) { 234 switch (c) { 235 case 'r': 236 repeat_forever = true; 237 break; 238 case 'n': 239 rc = str_size_t(optarg, NULL, 10, true, &repeat_count); 240 if (rc != EOK) { 241 printf("Invalid repeat count.\n"); 242 print_syntax(); 243 goto error; 244 } 245 break; 246 default: 247 printf("Unknown option passed.\n"); 248 print_syntax(); 249 goto error; 250 } 251 } 252 253 if (optind >= argc) { 254 printf("IP address or host name not supplied.\n"); 205 255 print_syntax(); 206 256 goto error; 207 257 } 208 258 209 259 /* Parse destination address */ 210 260 inet_addr_t dest_addr; 211 rc = inet_addr_parse(argv[ argi], &dest_addr);261 rc = inet_addr_parse(argv[optind], &dest_addr); 212 262 if (rc != EOK) { 213 263 /* Try interpreting as a host name */ 214 rc = dnsr_name2host(argv[ argi], &hinfo, AF_INET6);264 rc = dnsr_name2host(argv[optind], &hinfo, AF_INET); 215 265 if (rc != EOK) { 216 printf( NAME ": Error resolving host '%s'.\n", argv[argi]);266 printf("Error resolving host '%s'.\n", argv[optind]); 217 267 goto error; 218 268 } … … 223 273 uint16_t af = inet_addr_get(&dest_addr, NULL, &dest); 224 274 if (af != AF_INET6) { 225 printf( NAME ":Destination '%s' is not an IPv6 address.\n",226 argv[ argi]);275 printf("Destination '%s' is not an IPv6 address.\n", 276 argv[optind]); 227 277 goto error; 228 278 } … … 231 281 rc = inetping6_get_srcaddr(dest, src); 232 282 if (rc != EOK) { 233 printf( NAME ":Failed determining source address.\n");283 printf("Failed determining source address.\n"); 234 284 goto error; 235 285 } … … 240 290 rc = inet_addr_format(&src_addr, &asrc); 241 291 if (rc != EOK) { 242 printf( NAME ":Out of memory.\n");292 printf("Out of memory.\n"); 243 293 goto error; 244 294 } … … 246 296 rc = inet_addr_format(&dest_addr, &adest); 247 297 if (rc != EOK) { 248 printf( NAME ":Out of memory.\n");298 printf("Out of memory.\n"); 249 299 goto error; 250 300 } … … 253 303 rc = asprintf(&sdest, "%s (%s)", hinfo->cname, adest); 254 304 if (rc < 0) { 255 printf( NAME ":Out of memory.\n");305 printf("Out of memory.\n"); 256 306 goto error; 257 307 } … … 260 310 adest = NULL; 261 311 } 262 263 printf("Sending ICMP echo request from %s to %s .\n",312 313 printf("Sending ICMP echo request from %s to %s (Ctrl+Q to quit)\n", 264 314 asrc, sdest); 265 266 fid_t fid; 267 268 if (ping_repeat) { 269 fid = fibril_create(transmit_fibril, NULL); 270 if (fid == 0) { 271 printf(NAME ": Failed creating transmit fibril.\n"); 272 goto error; 273 } 274 275 fibril_add_ready(fid); 276 277 fid = fibril_create(input_fibril, NULL); 278 if (fid == 0) { 279 printf(NAME ": Failed creating input fibril.\n"); 280 goto error; 281 } 282 283 fibril_add_ready(fid); 284 } else { 285 ping_send(1); 286 } 287 288 fibril_mutex_lock(&done_lock); 289 rc = EOK; 290 while (!done && rc != ETIMEOUT) { 291 rc = fibril_condvar_wait_timeout(&done_cv, &done_lock, 292 ping_repeat ? 0 : PING_TIMEOUT); 293 } 294 fibril_mutex_unlock(&done_lock); 295 296 if (rc == ETIMEOUT) { 297 printf(NAME ": Echo request timed out.\n"); 298 goto error; 299 } 300 315 316 fid_t fid = fibril_create(transmit_fibril, NULL); 317 if (fid == 0) { 318 printf("Failed creating transmit fibril.\n"); 319 goto error; 320 } 321 322 fibril_add_ready(fid); 323 324 fid = fibril_create(input_fibril, NULL); 325 if (fid == 0) { 326 printf("Failed creating input fibril.\n"); 327 goto error; 328 } 329 330 fibril_add_ready(fid); 331 332 fibril_mutex_lock(&quit_lock); 333 while (!quit) 334 fibril_condvar_wait(&quit_cv, &quit_lock); 335 fibril_mutex_unlock(&quit_lock); 336 301 337 free(asrc); 302 338 free(adest); -
uspace/lib/c/generic/inet/addr.c
r09d6695 rf94b24c8 52 52 }; 53 53 54 static const addr48_t inet_addr48_solicited_node = { 55 0x33, 0x33, 0xff, 0, 0, 0 56 }; 57 54 58 static const inet_addr_t inet_addr_any_addr = { 55 59 .family = AF_INET, … … 72 76 } 73 77 78 int addr48_compare(const addr48_t a, const addr48_t b) 79 { 80 return memcmp(a, b, 6); 81 } 82 74 83 int addr128_compare(const addr128_t a, const addr128_t b) 75 84 { 76 85 return memcmp(a, b, 16); 86 } 87 88 /** Compute solicited node MAC multicast address from target IPv6 address 89 * 90 * @param ip Target IPv6 address 91 * @param mac Solicited MAC address to be assigned 92 * 93 */ 94 void addr48_solicited_node(const addr128_t ip, addr48_t mac) 95 { 96 memcpy(mac, inet_addr48_solicited_node, 3); 97 memcpy(mac + 3, ip + 13, 3); 77 98 } 78 99 -
uspace/lib/c/include/inet/addr.h
r09d6695 rf94b24c8 73 73 extern void addr128(const addr128_t, addr128_t); 74 74 75 extern int addr48_compare(const addr48_t, const addr48_t); 75 76 extern int addr128_compare(const addr128_t, const addr128_t); 77 78 extern void addr48_solicited_node(const addr128_t, addr48_t); 76 79 77 80 extern void host2addr128_t_be(const addr128_t, addr128_t); -
uspace/srv/net/dnsrsrv/dns_msg.h
r09d6695 rf94b24c8 52 52 extern void dns_addr128_t_decode(uint8_t *, size_t, addr128_t); 53 53 54 55 54 #endif 56 55 -
uspace/srv/net/ethip/ethip.h
r09d6695 rf94b24c8 46 46 47 47 typedef struct { 48 link_t addr_list;48 link_t link; 49 49 inet_addr_t addr; 50 50 } ethip_link_addr_t; 51 51 52 52 typedef struct ethip_nic { 53 link_t nic_list;53 link_t link; 54 54 service_id_t svc_id; 55 55 char *svc_name; … … 61 61 /** MAC address */ 62 62 addr48_t mac_addr; 63 /** List of IP addresses configured on this link */ 64 list_t addr_list; /* of ethip_link_addr_t */ 63 64 /** 65 * List of IP addresses configured on this link 66 * (of the type ethip_link_addr_t) 67 */ 68 list_t addr_list; 65 69 } ethip_nic_t; 66 70 -
uspace/srv/net/ethip/ethip_nic.c
r09d6695 rf94b24c8 45 45 #include <device/nic.h> 46 46 #include <stdlib.h> 47 47 #include <net/socket_codes.h> 48 #include <mem.h> 48 49 #include "ethip.h" 49 50 #include "ethip_nic.h" … … 83 84 already_known = false; 84 85 85 list_foreach(ethip_nic_list, nic_link) {86 ethip_nic_t *nic = list_get_instance( nic_link,87 ethip_nic_t, nic_list);86 list_foreach(ethip_nic_list, link) { 87 ethip_nic_t *nic = list_get_instance(link, 88 ethip_nic_t, link); 88 89 if (nic->svc_id == svcs[i]) { 89 90 already_known = true; … … 108 109 { 109 110 ethip_nic_t *nic = calloc(1, sizeof(ethip_nic_t)); 110 111 111 if (nic == NULL) { 112 112 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating NIC structure. " … … 114 114 return NULL; 115 115 } 116 117 link_initialize(&nic-> nic_list);116 117 link_initialize(&nic->link); 118 118 list_initialize(&nic->addr_list); 119 119 120 120 return nic; 121 121 } … … 130 130 } 131 131 132 link_initialize(&laddr-> addr_list);132 link_initialize(&laddr->link); 133 133 laddr->addr = *addr; 134 134 … … 140 140 if (nic->svc_name != NULL) 141 141 free(nic->svc_name); 142 142 143 free(nic); 143 144 } … … 180 181 181 182 log_msg(LOG_DEFAULT, LVL_DEBUG, "Opened NIC '%s'", nic->svc_name); 182 list_append(&nic-> nic_list, ðip_nic_list);183 list_append(&nic->link, ðip_nic_list); 183 184 in_list = true; 184 185 … … 209 210 error: 210 211 if (in_list) 211 list_remove(&nic->nic_list); 212 list_remove(&nic->link); 213 212 214 if (nic->sess != NULL) 213 215 async_hangup(nic->sess); 216 214 217 ethip_nic_delete(nic); 215 218 return rc; … … 312 315 list_foreach(ethip_nic_list, link) { 313 316 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_find_by_iplink_sid - element"); 314 ethip_nic_t *nic = list_get_instance(link, ethip_nic_t, 315 nic_list); 317 ethip_nic_t *nic = list_get_instance(link, ethip_nic_t, link); 316 318 317 319 if (nic->iplink_sid == iplink_sid) { … … 334 336 } 335 337 338 /** Setup accepted multicast addresses 339 * 340 * Currently the set of accepted multicast addresses is 341 * determined only based on IPv6 addresses. 342 * 343 */ 344 static int ethip_nic_setup_multicast(ethip_nic_t *nic) 345 { 346 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_setup_multicast()"); 347 348 /* Count the number of multicast addresses */ 349 350 size_t count = 0; 351 352 list_foreach(nic->addr_list, link) { 353 ethip_link_addr_t *laddr = list_get_instance(link, 354 ethip_link_addr_t, link); 355 356 uint16_t af = inet_addr_get(&laddr->addr, NULL, NULL); 357 if (af == AF_INET6) 358 count++; 359 } 360 361 if (count == 0) 362 return nic_multicast_set_mode(nic->sess, NIC_MULTICAST_BLOCKED, 363 NULL, 0); 364 365 nic_address_t *mac_list = calloc(count, sizeof(nic_address_t)); 366 if (mac_list == NULL) 367 return ENOMEM; 368 369 /* Create the multicast MAC list */ 370 371 size_t i = 0; 372 373 list_foreach(nic->addr_list, link) { 374 assert(i < count); 375 376 ethip_link_addr_t *laddr = list_get_instance(link, 377 ethip_link_addr_t, link); 378 379 addr128_t v6; 380 uint16_t af = inet_addr_get(&laddr->addr, NULL, &v6); 381 if (af != AF_INET6) 382 continue; 383 384 addr48_t mac; 385 addr48_solicited_node(v6, mac); 386 387 /* Avoid duplicate addresses in the list */ 388 389 bool found = false; 390 391 for (size_t j = 0; j < i; j++) { 392 if (addr48_compare(mac_list[j].address, mac)) { 393 found = true; 394 break; 395 } 396 } 397 398 if (!found) { 399 addr48(mac, mac_list[i].address); 400 i++; 401 } else 402 count--; 403 } 404 405 /* Setup the multicast MAC list */ 406 407 int rc = nic_multicast_set_mode(nic->sess, NIC_MULTICAST_LIST, 408 mac_list, count); 409 410 free(mac_list); 411 return rc; 412 } 413 336 414 int ethip_nic_addr_add(ethip_nic_t *nic, inet_addr_t *addr) 337 415 { … … 342 420 return ENOMEM; 343 421 344 list_append(&laddr->addr_list, &nic->addr_list); 345 return EOK; 422 list_append(&laddr->link, &nic->addr_list); 423 424 return ethip_nic_setup_multicast(nic); 346 425 } 347 426 … … 354 433 return ENOENT; 355 434 356 list_remove(&laddr-> addr_list);435 list_remove(&laddr->link); 357 436 ethip_link_addr_delete(laddr); 358 return EOK; 437 438 return ethip_nic_setup_multicast(nic); 359 439 } 360 440 … … 366 446 list_foreach(nic->addr_list, link) { 367 447 ethip_link_addr_t *laddr = list_get_instance(link, 368 ethip_link_addr_t, addr_list);448 ethip_link_addr_t, link); 369 449 370 450 if (inet_addr_compare(addr, &laddr->addr)) -
uspace/srv/net/inetsrv/inetsrv.c
r09d6695 rf94b24c8 69 69 70 70 static inet_addr_t multicast_all_nodes = { 71 .family = AF_INET ,71 .family = AF_INET6, 72 72 .addr6 = {0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01} 73 73 }; -
uspace/srv/net/inetsrv/ndp.c
r09d6695 rf94b24c8 49 49 #define NDP_REQUEST_TIMEOUT (3 * 1000 * 1000) 50 50 51 static addr48_t solicited_node_mac =52 {0x33, 0x33, 0xff, 0, 0, 0};53 54 51 static addr128_t solicited_node_ip = 55 52 {0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0xff, 0, 0, 0}; 56 57 /** Compute solicited node MAC multicast address from target IPv6 address58 *59 * @param ip_addr Target IPv6 address60 * @param mac_addr Solicited MAC address to be assigned61 *62 */63 static void ndp_solicited_node_mac(addr128_t ip_addr, addr48_t mac_addr)64 {65 memcpy(mac_addr, solicited_node_mac, 3);66 memcpy(mac_addr + 3, ip_addr + 13, 3);67 }68 53 69 54 /** Compute solicited node IPv6 multicast address from target IPv6 address … … 186 171 addr128(src_addr, packet.sender_proto_addr); 187 172 addr128(ip_addr, packet.solicited_ip); 188 ndp_solicited_node_mac(ip_addr, packet.target_hw_addr);173 addr48_solicited_node(ip_addr, packet.target_hw_addr); 189 174 ndp_solicited_node_ip(ip_addr, packet.target_proto_addr); 190 175
Note:
See TracChangeset
for help on using the changeset viewer.