Changeset 8a9a41e in mainline for uspace/srv
- Timestamp:
- 2021-10-24T08:28:43Z (4 years ago)
- Children:
- 08d81ae
- Parents:
- 2ce943a (diff), cd981f2a (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. - git-author:
- Erik Kučák <35500848+Riko196@…> (2021-10-24 08:28:43)
- git-committer:
- GitHub <noreply@…> (2021-10-24 08:28:43)
- Location:
- uspace/srv
- Files:
-
- 31 edited
-
hid/console/console.c (modified) (18 diffs)
-
hid/display/display.c (modified) (3 diffs)
-
hid/display/window.c (modified) (2 diffs)
-
hid/input/input.c (modified) (1 diff)
-
hid/output/meson.build (modified) (1 diff)
-
hid/output/port/chardev.c (modified) (2 diffs)
-
hid/output/port/ega.c (modified) (3 diffs)
-
hid/output/proto/vt100.c (modified) (2 diffs)
-
net/dhcp/dhcp.c (modified) (4 diffs)
-
net/ethip/arp.c (modified) (7 diffs)
-
net/ethip/arp.h (modified) (2 diffs)
-
net/ethip/atrans.c (modified) (7 diffs)
-
net/ethip/atrans.h (modified) (2 diffs)
-
net/ethip/ethip.c (modified) (7 diffs)
-
net/ethip/ethip.h (modified) (6 diffs)
-
net/ethip/ethip_nic.c (modified) (6 diffs)
-
net/ethip/pdu.c (modified) (5 diffs)
-
net/ethip/pdu.h (modified) (1 diff)
-
net/ethip/std.h (modified) (4 diffs)
-
net/inetsrv/addrobj.c (modified) (4 diffs)
-
net/inetsrv/inet_link.c (modified) (8 diffs)
-
net/inetsrv/inet_link.h (modified) (3 diffs)
-
net/inetsrv/inetcfg.c (modified) (2 diffs)
-
net/inetsrv/inetsrv.h (modified) (3 diffs)
-
net/inetsrv/ndp.c (modified) (8 diffs)
-
net/inetsrv/ndp.h (modified) (4 diffs)
-
net/inetsrv/ntrans.c (modified) (6 diffs)
-
net/inetsrv/ntrans.h (modified) (3 diffs)
-
net/inetsrv/pdu.c (modified) (4 diffs)
-
net/loopip/loopip.c (modified) (4 diffs)
-
net/slip/slip.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/console/console.c
r2ce943a r8a9a41e 63 63 typedef struct { 64 64 atomic_flag refcnt; /**< Connection reference count */ 65 prodcons_t input_pc; /**< Incoming keyboardevents */65 prodcons_t input_pc; /**< Incoming console events */ 66 66 67 67 /** … … 99 99 static sysarg_t cols; 100 100 static sysarg_t rows; 101 102 /** Mouse pointer X coordinate */ 103 static int pointer_x; 104 /** Mouse pointer Y coordinate */ 105 static int pointer_y; 106 /** Character under mouse cursor */ 107 static charfield_t pointer_bg; 108 109 static int mouse_scale_x = 4; 110 static int mouse_scale_y = 8; 101 111 102 112 /** Array of data for virtual consoles */ … … 166 176 }; 167 177 178 static void pointer_draw(void); 179 static void pointer_undraw(void); 180 168 181 static console_t *srv_to_console(con_srv_t *srv) 169 182 { … … 231 244 232 245 fibril_mutex_lock(&switch_mtx); 246 pointer_undraw(); 233 247 234 248 if (cons == active_console) { … … 239 253 active_console = cons; 240 254 255 pointer_draw(); 241 256 fibril_mutex_unlock(&switch_mtx); 242 257 243 258 cons_damage(cons); 259 } 260 261 /** Draw mouse pointer. */ 262 static void pointer_draw(void) 263 { 264 charfield_t *ch; 265 int col, row; 266 267 /* Downscale coordinates to text resolution */ 268 col = pointer_x / mouse_scale_x; 269 row = pointer_y / mouse_scale_y; 270 271 /* Make sure they are in range */ 272 if (col < 0 || row < 0 || col >= (int)cols || row >= (int)rows) 273 return; 274 275 ch = chargrid_charfield_at(active_console->frontbuf, col, row); 276 277 /* 278 * Store background attributes for undrawing the pointer. 279 * This is necessary as styles cannot be inverted with 280 * round trip (unlike RGB or INDEX) 281 */ 282 pointer_bg = *ch; 283 284 /* In general the color should be a one's complement of the background */ 285 if (ch->attrs.type == CHAR_ATTR_INDEX) { 286 ch->attrs.val.index.bgcolor ^= 0xf; 287 ch->attrs.val.index.fgcolor ^= 0xf; 288 } else if (ch->attrs.type == CHAR_ATTR_RGB) { 289 ch->attrs.val.rgb.fgcolor ^= 0xffffff; 290 ch->attrs.val.rgb.bgcolor ^= 0xffffff; 291 } else if (ch->attrs.type == CHAR_ATTR_STYLE) { 292 /* Don't have a proper inverse for each style */ 293 if (ch->attrs.val.style == STYLE_INVERTED) 294 ch->attrs.val.style = STYLE_NORMAL; 295 else 296 ch->attrs.val.style = STYLE_INVERTED; 297 } 298 299 /* Make sure the cell gets updated */ 300 ch->flags |= CHAR_FLAG_DIRTY; 301 } 302 303 /** Undraw mouse pointer. */ 304 static void pointer_undraw(void) 305 { 306 charfield_t *ch; 307 int col, row; 308 309 col = pointer_x / mouse_scale_x; 310 row = pointer_y / mouse_scale_y; 311 if (col < 0 || row < 0 || col >= (int)cols || row >= (int)rows) 312 return; 313 314 ch = chargrid_charfield_at(active_console->frontbuf, col, row); 315 *ch = pointer_bg; 316 ch->flags |= CHAR_FLAG_DIRTY; 317 } 318 319 /** Queue console event. 320 * 321 * @param cons Console 322 * @param ev Console event 323 */ 324 static void console_queue_cons_event(console_t *cons, cons_event_t *ev) 325 { 326 /* Got key press/release event */ 327 cons_event_t *event = 328 (cons_event_t *) malloc(sizeof(cons_event_t)); 329 if (event == NULL) 330 return; 331 332 *event = *ev; 333 link_initialize(&event->link); 334 335 prodcons_produce(&cons->input_pc, &event->link); 244 336 } 245 337 … … 264 356 keymod_t mods, char32_t c) 265 357 { 358 cons_event_t event; 359 266 360 if ((key >= KC_F1) && (key <= KC_F1 + CONSOLE_COUNT) && 267 361 ((mods & KM_CTRL) == 0)) { … … 269 363 } else { 270 364 /* Got key press/release event */ 271 kbd_event_t *event = 272 (kbd_event_t *) malloc(sizeof(kbd_event_t)); 273 if (event == NULL) { 274 return ENOMEM; 275 } 276 277 link_initialize(&event->link); 278 event->type = type; 279 event->key = key; 280 event->mods = mods; 281 event->c = c; 282 283 prodcons_produce(&active_console->input_pc, 284 &event->link); 285 } 286 287 return EOK; 365 event.type = CEV_KEY; 366 367 event.ev.key.type = type; 368 event.ev.key.key = key; 369 event.ev.key.mods = mods; 370 event.ev.key.c = c; 371 372 console_queue_cons_event(active_console, &event); 373 } 374 375 return EOK; 376 } 377 378 /** Update pointer position. 379 * 380 * @param new_x New X coordinate (in pixels) 381 * @param new_y New Y coordinate (in pixels) 382 */ 383 static void pointer_update(int new_x, int new_y) 384 { 385 bool upd_pointer; 386 387 /* Make sure coordinates are in range */ 388 389 if (new_x < 0) 390 new_x = 0; 391 if (new_x >= (int)cols * mouse_scale_x) 392 new_x = cols * mouse_scale_x - 1; 393 if (new_y < 0) 394 new_y = 0; 395 if (new_y >= (int)rows * mouse_scale_y) 396 new_y = rows * mouse_scale_y - 1; 397 398 /* Determine if pointer moved to a different character cell */ 399 upd_pointer = (new_x / mouse_scale_x != pointer_x / mouse_scale_x) || 400 (new_y / mouse_scale_y != pointer_y / mouse_scale_y); 401 402 if (upd_pointer) 403 pointer_undraw(); 404 405 /* Store new pointer position */ 406 pointer_x = new_x; 407 pointer_y = new_y; 408 409 if (upd_pointer) { 410 pointer_draw(); 411 cons_update(active_console); 412 } 288 413 } 289 414 290 415 static errno_t input_ev_move(input_t *input, int dx, int dy) 291 416 { 417 pointer_update(pointer_x + dx, pointer_y + dy); 292 418 return EOK; 293 419 } … … 296 422 unsigned max_x, unsigned max_y) 297 423 { 424 pointer_update(mouse_scale_x * cols * x / max_x, mouse_scale_y * rows * y / max_y); 298 425 return EOK; 299 426 } … … 301 428 static errno_t input_ev_button(input_t *input, int bnum, int bpress) 302 429 { 430 cons_event_t event; 431 432 event.type = CEV_POS; 433 event.ev.pos.type = bpress ? POS_PRESS : POS_RELEASE; 434 event.ev.pos.btn_num = bnum; 435 event.ev.pos.hpos = pointer_x / mouse_scale_x; 436 event.ev.pos.vpos = pointer_y / mouse_scale_y; 437 438 console_queue_cons_event(active_console, &event); 303 439 return EOK; 304 440 } … … 310 446 311 447 fibril_mutex_lock(&cons->mtx); 448 pointer_undraw(); 312 449 313 450 switch (ch) { … … 327 464 } 328 465 466 pointer_draw(); 329 467 fibril_mutex_unlock(&cons->mtx); 330 468 … … 336 474 { 337 475 fibril_mutex_lock(&cons->mtx); 476 pointer_undraw(); 338 477 chargrid_set_cursor_visibility(cons->frontbuf, visible); 478 pointer_draw(); 339 479 fibril_mutex_unlock(&cons->mtx); 340 480 … … 379 519 if (pos < size) { 380 520 link_t *link = prodcons_consume(&cons->input_pc); 381 kbd_event_t *event = list_get_instance(link, kbd_event_t, link); 521 cons_event_t *event = list_get_instance(link, 522 cons_event_t, link); 382 523 383 524 /* Accept key presses of printable chars only. */ 384 if ((event->type == KEY_PRESS) && (event->c != 0)) { 385 char32_t tmp[2] = { event->c, 0 }; 525 if (event->type == CEV_KEY && event->ev.key.type == KEY_PRESS && 526 (event->ev.key.c != 0)) { 527 char32_t tmp[2] = { event->ev.key.c, 0 }; 386 528 wstr_to_str(cons->char_remains, UTF8_CHAR_BUFFER_SIZE, tmp); 387 529 cons->char_remains_len = str_size(cons->char_remains); … … 420 562 421 563 fibril_mutex_lock(&cons->mtx); 564 pointer_undraw(); 422 565 chargrid_clear(cons->frontbuf); 566 pointer_draw(); 423 567 fibril_mutex_unlock(&cons->mtx); 424 568 … … 431 575 432 576 fibril_mutex_lock(&cons->mtx); 577 pointer_undraw(); 433 578 chargrid_set_cursor(cons->frontbuf, col, row); 579 pointer_draw(); 434 580 fibril_mutex_unlock(&cons->mtx); 435 581 … … 511 657 console_t *cons = srv_to_console(srv); 512 658 link_t *link = prodcons_consume(&cons->input_pc); 513 kbd_event_t *kevent = list_get_instance(link, kbd_event_t, link); 514 515 event->type = CEV_KEY; 516 event->ev.key = *kevent; 517 518 free(kevent); 659 cons_event_t *cevent = list_get_instance(link, cons_event_t, link); 660 661 *event = *cevent; 662 free(cevent); 519 663 return EOK; 520 664 } … … 621 765 /* Update front buffer from user buffer */ 622 766 767 pointer_undraw(); 768 623 769 for (row = r0; row < r1; row++) { 624 770 for (col = c0; col < c1; col++) { … … 628 774 } 629 775 776 pointer_draw(); 630 777 fibril_mutex_unlock(&cons->mtx); 631 778 -
uspace/srv/hid/display/display.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 53 53 static void ds_display_update_cb(void *); 54 54 55 static mem_gc_cb_t ds_display_mem_gc_cb = { 56 .invalidate = ds_display_invalidate_cb, 57 .update = ds_display_update_cb 58 }; 59 55 60 /** Create display. 56 61 * … … 459 464 goto error; 460 465 461 rc = mem_gc_create(&disp->rect, &alloc, 462 ds_display_invalidate_cb, ds_display_update_cb, (void *) disp, 463 &disp->bbgc); 466 rc = mem_gc_create(&disp->rect, &alloc, &ds_display_mem_gc_cb, 467 (void *) disp, &disp->bbgc); 464 468 if (rc != EOK) 465 469 goto error; -
uspace/srv/hid/display/window.c
r2ce943a r8a9a41e 53 53 static void ds_window_get_preview_rect(ds_window_t *, gfx_rect_t *); 54 54 55 static mem_gc_cb_t ds_window_mem_gc_cb = { 56 .invalidate = ds_window_invalidate_cb, 57 .update = ds_window_update_cb 58 }; 59 55 60 /** Create window. 56 61 * … … 108 113 } 109 114 110 rc = mem_gc_create(¶ms->rect, &alloc, ds_window_invalidate_cb,111 ds_window_update_cb,(void *)wnd, &wnd->mgc);115 rc = mem_gc_create(¶ms->rect, &alloc, &ds_window_mem_gc_cb, 116 (void *)wnd, &wnd->mgc); 112 117 if (rc != EOK) 113 118 goto error; -
uspace/srv/hid/input/input.c
r2ce943a r8a9a41e 641 641 kbd_add_dev(&chardev_port, &stty_ctl); 642 642 #endif 643 #if defined(UARCH_arm64) && defined(MACHINE_hikey960) 644 kbd_add_dev(&chardev_port, &stty_ctl); 645 #endif 643 646 /* Silence warning on abs32le about kbd_add_dev() being unused */ 644 647 (void) kbd_add_dev; -
uspace/srv/hid/output/meson.build
r2ce943a r8a9a41e 28 28 # 29 29 30 deps = [ ' drv', 'fbfont', 'pixconv', 'ddev' ]30 deps = [ 'codepage', 'drv', 'fbfont', 'pixconv', 'ddev' ] 31 31 src = files( 32 32 'ctl/serial.c', -
uspace/srv/hid/output/port/chardev.c
r2ce943a r8a9a41e 78 78 } 79 79 80 static void chardev_put uchar(char32_tch)80 static void chardev_putchar(char ch) 81 81 { 82 82 if (chardev_bused == chardev_buf_size) 83 83 chardev_flush(); 84 if (!ascii_check(ch))85 ch = '?';86 84 chardev_buf[chardev_bused++] = (uint8_t) ch; 85 } 86 87 static void chardev_putuchar(char32_t ch) 88 { 89 char buf[STR_BOUNDS(1)]; 90 size_t off; 91 size_t i; 92 errno_t rc; 93 94 off = 0; 95 rc = chr_encode(ch, buf, &off, sizeof(buf)); 96 if (rc != EOK) 97 return; 98 99 for (i = 0; i < off; i++) 100 chardev_putchar(buf[i]); 87 101 } 88 102 … … 218 232 #elif defined(UARCH_arm64) && defined(MACHINE_virt) 219 233 /* OK */ 234 #elif defined(UARCH_arm64) && defined(MACHINE_hikey960) 235 /* OK */ 220 236 #else 221 237 return EOK; -
uspace/srv/hid/output/port/ega.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 2021 Jiri Svoboda 2 3 * Copyright (c) 2011 Martin Decky 3 4 * All rights reserved. … … 31 32 */ 32 33 34 #include <codepage/cp437.h> 33 35 #include <errno.h> 34 36 #include <sysinfo.h> … … 106 108 { 107 109 uint8_t glyph; 108 109 if (ascii_check(field->ch)) 110 glyph = field->ch;111 else110 errno_t rc; 111 112 rc = cp437_encode(field->ch, &glyph); 113 if (rc != EOK) 112 114 glyph = '?'; 113 115 -
uspace/srv/hid/output/proto/vt100.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 2021 Jiri Svoboda 2 3 * Copyright (c) 2011 Martin Decky 3 4 * All rights reserved. … … 65 66 static sgr_color_index_t color_map[] = { 66 67 [COLOR_BLACK] = CI_BLACK, 67 [COLOR_BLUE] = CI_ RED,68 [COLOR_BLUE] = CI_BLUE, 68 69 [COLOR_GREEN] = CI_GREEN, 69 70 [COLOR_CYAN] = CI_CYAN, -
uspace/srv/net/dhcp/dhcp.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 13Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 42 42 #include <fibril_synch.h> 43 43 #include <inet/addr.h> 44 #include <inet/eth_addr.h> 44 45 #include <inet/dnsr.h> 45 46 #include <inet/inetcfg.h> … … 157 158 hdr->op = op_bootrequest; 158 159 hdr->htype = 1; /* AHRD_ETHERNET */ 159 hdr->hlen = sizeof(addr48_t);160 hdr->hlen = ETH_ADDR_SIZE; 160 161 hdr->xid = host2uint32_t_be(42); 161 162 hdr->flags = flag_broadcast; 162 163 163 addr48(dlink->link_info.mac_addr, hdr->chaddr);164 eth_addr_encode(&dlink->link_info.mac_addr, hdr->chaddr); 164 165 hdr->opt_magic = host2uint32_t_be(dhcp_opt_magic); 165 166 … … 185 186 hdr->flags = flag_broadcast; 186 187 hdr->ciaddr = host2uint32_t_be(offer->oaddr.addr); 187 addr48(dlink->link_info.mac_addr, hdr->chaddr);188 eth_addr_encode(&dlink->link_info.mac_addr, hdr->chaddr); 188 189 hdr->opt_magic = host2uint32_t_be(dhcp_opt_magic); 189 190 -
uspace/srv/net/ethip/arp.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 36 36 37 37 #include <errno.h> 38 #include <io/log.h>39 38 #include <inet/iplink_srv.h> 40 39 #include <inet/addr.h> 40 #include <inet/eth_addr.h> 41 #include <io/log.h> 41 42 #include <stdlib.h> 42 43 #include "arp.h" … … 79 80 80 81 (void) atrans_add(packet.sender_proto_addr, 81 packet.sender_hw_addr);82 &packet.sender_hw_addr); 82 83 83 84 if (packet.opcode == aop_request) { … … 85 86 86 87 reply.opcode = aop_reply; 87 addr48(nic->mac_addr, reply.sender_hw_addr);88 reply.sender_hw_addr = nic->mac_addr; 88 89 reply.sender_proto_addr = laddr_v4; 89 addr48(packet.sender_hw_addr, reply.target_hw_addr);90 reply.target_hw_addr = packet.sender_hw_addr; 90 91 reply.target_proto_addr = packet.sender_proto_addr; 91 92 … … 95 96 96 97 errno_t arp_translate(ethip_nic_t *nic, addr32_t src_addr, addr32_t ip_addr, 97 addr48_tmac_addr)98 eth_addr_t *mac_addr) 98 99 { 99 100 /* Broadcast address */ 100 101 if (ip_addr == addr32_broadcast_all_hosts) { 101 addr48(addr48_broadcast, mac_addr);102 *mac_addr = eth_addr_broadcast; 102 103 return EOK; 103 104 } … … 110 111 111 112 packet.opcode = aop_request; 112 addr48(nic->mac_addr, packet.sender_hw_addr);113 packet.sender_hw_addr = nic->mac_addr; 113 114 packet.sender_proto_addr = src_addr; 114 addr48(addr48_broadcast, packet.target_hw_addr);115 packet.target_hw_addr = eth_addr_broadcast; 115 116 packet.target_proto_addr = ip_addr; 116 117 … … 138 139 return rc; 139 140 140 addr48(packet->target_hw_addr, frame.dest);141 addr48(packet->sender_hw_addr, frame.src);141 frame.dest = packet->target_hw_addr; 142 frame.src = packet->sender_hw_addr; 142 143 frame.etype_len = ETYPE_ARP; 143 144 frame.data = pdata; -
uspace/srv/net/ethip/arp.h
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 38 38 #define ARP_H_ 39 39 40 #include <inet/addr.h> 41 #include <inet/eth_addr.h> 40 42 #include <inet/iplink_srv.h> 41 #include <inet/addr.h>42 43 #include "ethip.h" 43 44 44 45 extern void arp_received(ethip_nic_t *, eth_frame_t *); 45 extern errno_t arp_translate(ethip_nic_t *, addr32_t, addr32_t, addr48_t);46 extern errno_t arp_translate(ethip_nic_t *, addr32_t, addr32_t, eth_addr_t *); 46 47 47 48 #endif -
uspace/srv/net/ethip/atrans.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 38 38 #include <errno.h> 39 39 #include <fibril_synch.h> 40 #include <inet/eth_addr.h> 40 41 #include <inet/iplink_srv.h> 41 42 #include <stdlib.h> … … 59 60 } 60 61 61 errno_t atrans_add(addr32_t ip_addr, addr48_tmac_addr)62 errno_t atrans_add(addr32_t ip_addr, eth_addr_t *mac_addr) 62 63 { 63 64 ethip_atrans_t *atrans; … … 69 70 70 71 atrans->ip_addr = ip_addr; 71 a ddr48(mac_addr, atrans->mac_addr);72 atrans->mac_addr = *mac_addr; 72 73 73 74 fibril_mutex_lock(&atrans_list_lock); … … 103 104 } 104 105 105 static errno_t atrans_lookup_locked(addr32_t ip_addr, addr48_tmac_addr)106 static errno_t atrans_lookup_locked(addr32_t ip_addr, eth_addr_t *mac_addr) 106 107 { 107 108 ethip_atrans_t *atrans = atrans_find(ip_addr); … … 109 110 return ENOENT; 110 111 111 addr48(atrans->mac_addr, mac_addr);112 *mac_addr = atrans->mac_addr; 112 113 return EOK; 113 114 } 114 115 115 errno_t atrans_lookup(addr32_t ip_addr, addr48_tmac_addr)116 errno_t atrans_lookup(addr32_t ip_addr, eth_addr_t *mac_addr) 116 117 { 117 118 errno_t rc; … … 135 136 136 137 errno_t atrans_lookup_timeout(addr32_t ip_addr, usec_t timeout, 137 addr48_tmac_addr)138 eth_addr_t *mac_addr) 138 139 { 139 140 fibril_timer_t *t; -
uspace/srv/net/ethip/atrans.h
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 38 38 #define ATRANS_H_ 39 39 40 #include <inet/addr.h> 41 #include <inet/eth_addr.h> 40 42 #include <inet/iplink_srv.h> 41 #include <inet/addr.h>42 43 #include "ethip.h" 43 44 44 extern errno_t atrans_add(addr32_t, addr48_t);45 extern errno_t atrans_add(addr32_t, eth_addr_t *); 45 46 extern errno_t atrans_remove(addr32_t); 46 extern errno_t atrans_lookup(addr32_t, addr48_t);47 extern errno_t atrans_lookup_timeout(addr32_t, usec_t, addr48_t);47 extern errno_t atrans_lookup(addr32_t, eth_addr_t *); 48 extern errno_t atrans_lookup_timeout(addr32_t, usec_t, eth_addr_t *); 48 49 49 50 #endif -
uspace/srv/net/ethip/ethip.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 39 39 #include <async.h> 40 40 #include <errno.h> 41 #include <inet/eth_addr.h> 41 42 #include <inet/iplink_srv.h> 42 43 #include <io/log.h> … … 58 59 static errno_t ethip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu); 59 60 static errno_t ethip_get_mtu(iplink_srv_t *srv, size_t *mtu); 60 static errno_t ethip_get_mac48(iplink_srv_t *srv, addr48_t *mac);61 static errno_t ethip_set_mac48(iplink_srv_t *srv, addr48_t *mac);61 static errno_t ethip_get_mac48(iplink_srv_t *srv, eth_addr_t *mac); 62 static errno_t ethip_set_mac48(iplink_srv_t *srv, eth_addr_t *mac); 62 63 static errno_t ethip_addr_add(iplink_srv_t *srv, inet_addr_t *addr); 63 64 static errno_t ethip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr); … … 177 178 eth_frame_t frame; 178 179 179 errno_t rc = arp_translate(nic, sdu->src, sdu->dest, frame.dest);180 errno_t rc = arp_translate(nic, sdu->src, sdu->dest, &frame.dest); 180 181 if (rc != EOK) { 181 182 log_msg(LOG_DEFAULT, LVL_WARN, "Failed to look up IPv4 address 0x%" … … 184 185 } 185 186 186 addr48(nic->mac_addr, frame.src);187 frame.src = nic->mac_addr; 187 188 frame.etype_len = ETYPE_IP; 188 189 frame.data = sdu->data; … … 208 209 eth_frame_t frame; 209 210 210 addr48(sdu->dest, frame.dest);211 addr48(nic->mac_addr, frame.src);211 frame.dest = sdu->dest; 212 frame.src = nic->mac_addr; 212 213 frame.etype_len = ETYPE_IPV6; 213 214 frame.data = sdu->data; … … 276 277 } 277 278 278 static errno_t ethip_get_mac48(iplink_srv_t *srv, addr48_t *mac)279 static errno_t ethip_get_mac48(iplink_srv_t *srv, eth_addr_t *mac) 279 280 { 280 281 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_get_mac48()"); 281 282 282 283 ethip_nic_t *nic = (ethip_nic_t *) srv->arg; 283 addr48(nic->mac_addr, *mac);284 285 return EOK; 286 } 287 288 static errno_t ethip_set_mac48(iplink_srv_t *srv, addr48_t *mac)284 *mac = nic->mac_addr; 285 286 return EOK; 287 } 288 289 static errno_t ethip_set_mac48(iplink_srv_t *srv, eth_addr_t *mac) 289 290 { 290 291 log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_set_mac48()"); 291 292 292 293 ethip_nic_t *nic = (ethip_nic_t *) srv->arg; 293 addr48(*mac, nic->mac_addr);294 nic->mac_addr = *mac; 294 295 295 296 return EOK; -
uspace/srv/net/ethip/ethip.h
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 40 40 #include <adt/list.h> 41 41 #include <async.h> 42 #include <inet/addr.h> 43 #include <inet/eth_addr.h> 42 44 #include <inet/iplink_srv.h> 43 #include <inet/addr.h>44 45 #include <loc.h> 45 46 #include <stddef.h> … … 61 62 62 63 /** MAC address */ 63 addr48_t mac_addr;64 eth_addr_t mac_addr; 64 65 65 66 /** … … 73 74 typedef struct { 74 75 /** Destination Address */ 75 addr48_t dest;76 eth_addr_t dest; 76 77 /** Source Address */ 77 addr48_t src;78 eth_addr_t src; 78 79 /** Ethertype or Length */ 79 80 uint16_t etype_len; … … 100 101 arp_opcode_t opcode; 101 102 /** Sender hardware address */ 102 addr48_t sender_hw_addr;103 eth_addr_t sender_hw_addr; 103 104 /** Sender protocol address */ 104 105 addr32_t sender_proto_addr; 105 106 /** Target hardware address */ 106 addr48_t target_hw_addr;107 eth_addr_t target_hw_addr; 107 108 /** Target protocol address */ 108 109 addr32_t target_proto_addr; … … 113 114 link_t atrans_list; 114 115 addr32_t ip_addr; 115 addr48_t mac_addr;116 eth_addr_t mac_addr; 116 117 } ethip_atrans_t; 117 118 -
uspace/srv/net/ethip/ethip_nic.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 37 37 #include <adt/list.h> 38 38 #include <async.h> 39 #include <stdbool.h>40 39 #include <errno.h> 41 #include <str_error.h>42 40 #include <fibril_synch.h> 41 #include <inet/eth_addr.h> 43 42 #include <inet/iplink_srv.h> 44 43 #include <io/log.h> 45 44 #include <loc.h> 45 #include <mem.h> 46 46 #include <nic_iface.h> 47 #include <stdbool.h> 47 48 #include <stdlib.h> 48 #include < mem.h>49 #include <str_error.h> 49 50 #include "ethip.h" 50 51 #include "ethip_nic.h" … … 193 194 } 194 195 195 addr48(nic_address.address,nic->mac_addr);196 eth_addr_decode(nic_address.address, &nic->mac_addr); 196 197 197 198 rc = nic_set_state(nic->sess, NIC_STATE_ACTIVE); … … 399 400 assert(i < count); 400 401 401 addr48_t mac;402 addr48_solicited_node(v6,mac);402 eth_addr_t mac; 403 eth_addr_solicited_node(v6, &mac); 403 404 404 405 /* Avoid duplicate addresses in the list */ … … 407 408 408 409 for (size_t j = 0; j < i; j++) { 409 if (addr48_compare(mac_list[j].address, mac)) { 410 eth_addr_t mac_entry; 411 eth_addr_decode(mac_list[j].address, &mac_entry); 412 if (eth_addr_compare(&mac_entry, &mac)) { 410 413 found = true; 411 414 break; … … 414 417 415 418 if (!found) { 416 addr48(mac, mac_list[i].address);419 eth_addr_encode(&mac, mac_list[i].address); 417 420 i++; 418 } else 421 } else { 419 422 count--; 423 } 420 424 } 421 425 -
uspace/srv/net/ethip/pdu.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 60 60 61 61 hdr = (eth_header_t *)data; 62 addr48(frame->src, hdr->src);63 addr48(frame->dest, hdr->dest);62 eth_addr_encode(&frame->src, hdr->src); 63 eth_addr_encode(&frame->dest, hdr->dest); 64 64 hdr->etype_len = host2uint16_t_be(frame->etype_len); 65 65 … … 93 93 return ENOMEM; 94 94 95 addr48(hdr->src,frame->src);96 addr48(hdr->dest,frame->dest);95 eth_addr_decode(hdr->src, &frame->src); 96 eth_addr_decode(hdr->dest, &frame->dest); 97 97 frame->etype_len = uint16_t_be2host(hdr->etype_len); 98 98 … … 140 140 pfmt->proto_addr_size = IPV4_ADDR_SIZE; 141 141 pfmt->opcode = host2uint16_t_be(fopcode); 142 addr48(packet->sender_hw_addr, pfmt->sender_hw_addr);142 eth_addr_encode(&packet->sender_hw_addr, pfmt->sender_hw_addr); 143 143 pfmt->sender_proto_addr = 144 144 host2uint32_t_be(packet->sender_proto_addr); 145 addr48(packet->target_hw_addr, pfmt->target_hw_addr);145 eth_addr_encode(&packet->target_hw_addr, pfmt->target_hw_addr); 146 146 pfmt->target_proto_addr = 147 147 host2uint32_t_be(packet->target_proto_addr); … … 203 203 } 204 204 205 addr48(pfmt->sender_hw_addr,packet->sender_hw_addr);205 eth_addr_decode(pfmt->sender_hw_addr, &packet->sender_hw_addr); 206 206 packet->sender_proto_addr = 207 207 uint32_t_be2host(pfmt->sender_proto_addr); 208 addr48(pfmt->target_hw_addr,packet->target_hw_addr);208 eth_addr_decode(pfmt->target_hw_addr, &packet->target_hw_addr); 209 209 packet->target_proto_addr = 210 210 uint32_t_be2host(pfmt->target_proto_addr); -
uspace/srv/net/ethip/pdu.h
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * -
uspace/srv/net/ethip/std.h
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 39 39 40 40 #include <stdint.h> 41 #include <inet/addr.h>42 41 43 42 #define ETH_ADDR_SIZE 6 … … 48 47 typedef struct { 49 48 /** Destination Address */ 50 addr48_t dest;49 uint8_t dest[ETH_ADDR_SIZE]; 51 50 /** Source Address */ 52 addr48_t src;51 uint8_t src[ETH_ADDR_SIZE]; 53 52 /** Ethertype or Length */ 54 53 uint16_t etype_len; … … 68 67 uint16_t opcode; 69 68 /** Sender hardware address */ 70 addr48_t sender_hw_addr;69 uint8_t sender_hw_addr[ETH_ADDR_SIZE]; 71 70 /** Sender protocol address */ 72 addr32_t sender_proto_addr;71 uint32_t sender_proto_addr; 73 72 /** Target hardware address */ 74 addr48_t target_hw_addr;73 uint8_t target_hw_addr[ETH_ADDR_SIZE]; 75 74 /** Target protocol address */ 76 addr32_t target_proto_addr;75 uint32_t target_proto_addr; 77 76 } __attribute__((packed)) arp_eth_packet_fmt_t; 78 77 -
uspace/srv/net/inetsrv/addrobj.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 38 38 #include <errno.h> 39 39 #include <fibril_synch.h> 40 #include <inet/eth_addr.h> 40 41 #include <io/log.h> 41 42 #include <ipc/loc.h> … … 229 230 230 231 errno_t rc; 231 addr48_t ldest_mac;232 eth_addr_t ldest_mac; 232 233 233 234 switch (ldest_ver) { … … 239 240 * Translate local destination IPv6 address. 240 241 */ 241 rc = ndp_translate(lsrc_v6, ldest_v6, ldest_mac, addr->ilink);242 rc = ndp_translate(lsrc_v6, ldest_v6, &ldest_mac, addr->ilink); 242 243 if (rc != EOK) 243 244 return rc; 244 245 245 return inet_link_send_dgram6(addr->ilink, ldest_mac, dgram,246 return inet_link_send_dgram6(addr->ilink, &ldest_mac, dgram, 246 247 proto, ttl, df); 247 248 default: -
uspace/srv/net/inetsrv/inet_link.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 35 35 */ 36 36 37 #include <stdbool.h>38 37 #include <errno.h> 39 #include <str_error.h>40 38 #include <fibril_synch.h> 39 #include <inet/eth_addr.h> 41 40 #include <inet/iplink.h> 42 41 #include <io/log.h> 43 42 #include <loc.h> 43 #include <stdbool.h> 44 44 #include <stdlib.h> 45 45 #include <str.h> 46 #include <str_error.h> 46 47 #include "addrobj.h" 47 48 #include "inetsrv.h" … … 56 57 57 58 static errno_t inet_iplink_recv(iplink_t *, iplink_recv_sdu_t *, ip_ver_t); 58 static errno_t inet_iplink_change_addr(iplink_t *, addr48_t);59 static errno_t inet_iplink_change_addr(iplink_t *, eth_addr_t *); 59 60 static inet_link_t *inet_link_get_by_id_locked(sysarg_t); 60 61 … … 70 71 { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xfe, 0, 0, 0 }; 71 72 72 static void inet_link_local_node_ip( addr48_tmac_addr,73 static void inet_link_local_node_ip(eth_addr_t *mac_addr, 73 74 addr128_t ip_addr) 74 75 { 76 uint8_t b[ETH_ADDR_SIZE]; 77 75 78 memcpy(ip_addr, link_local_node_ip, 16); 76 77 ip_addr[8] = mac_addr[0] ^ 0x02; 78 ip_addr[9] = mac_addr[1]; 79 ip_addr[10] = mac_addr[2]; 80 ip_addr[13] = mac_addr[3]; 81 ip_addr[14] = mac_addr[4]; 82 ip_addr[15] = mac_addr[5]; 79 eth_addr_encode(mac_addr, b); 80 81 ip_addr[8] = b[0] ^ 0x02; 82 ip_addr[9] = b[1]; 83 ip_addr[10] = b[2]; 84 ip_addr[13] = b[3]; 85 ip_addr[14] = b[4]; 86 ip_addr[15] = b[5]; 83 87 } 84 88 … … 121 125 } 122 126 123 static errno_t inet_iplink_change_addr(iplink_t *iplink, addr48_t mac) 124 { 127 static errno_t inet_iplink_change_addr(iplink_t *iplink, eth_addr_t *mac) 128 { 129 eth_addr_str_t saddr; 130 131 eth_addr_format(mac, &saddr); 125 132 log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_iplink_change_addr(): " 126 "new addr=%02x:%02x:%02x:%02x:%02x:%02x", 127 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); 133 "new addr=%s", saddr.str); 128 134 129 135 list_foreach(inet_links, link_list, inet_link_t, ilink) { 130 136 if (ilink->sess == iplink->sess) 131 memcpy(&ilink->mac, mac, sizeof(addr48_t));137 ilink->mac = *mac; 132 138 } 133 139 … … 261 267 262 268 addr128_t link_local; 263 inet_link_local_node_ip( ilink->mac, link_local);269 inet_link_local_node_ip(&ilink->mac, link_local); 264 270 265 271 inet_naddr_set6(link_local, 64, &addr6->naddr); … … 387 393 * 388 394 */ 389 errno_t inet_link_send_dgram6(inet_link_t *ilink, addr48_tldest,395 errno_t inet_link_send_dgram6(inet_link_t *ilink, eth_addr_t *ldest, 390 396 inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df) 391 397 { … … 401 407 402 408 iplink_sdu6_t sdu6; 403 addr48(ldest, sdu6.dest);409 sdu6.dest = *ldest; 404 410 405 411 /* -
uspace/srv/net/inetsrv/inet_link.h
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 38 38 #define INET_LINK_H_ 39 39 40 #include <inet/eth_addr.h> 40 41 #include <stddef.h> 41 42 #include <stdint.h> … … 45 46 extern errno_t inet_link_send_dgram(inet_link_t *, addr32_t, 46 47 addr32_t, inet_dgram_t *, uint8_t, uint8_t, int); 47 extern errno_t inet_link_send_dgram6(inet_link_t *, addr48_t, inet_dgram_t *,48 extern errno_t inet_link_send_dgram6(inet_link_t *, eth_addr_t *, inet_dgram_t *, 48 49 uint8_t, uint8_t, int); 49 50 extern inet_link_t *inet_link_get_by_id(sysarg_t); -
uspace/srv/net/inetsrv/inetcfg.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 13Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 177 177 linfo->def_mtu = ilink->def_mtu; 178 178 if (ilink->mac_valid) { 179 addr48(ilink->mac, linfo->mac_addr);179 linfo->mac_addr = ilink->mac; 180 180 } else { 181 memset( linfo->mac_addr, 0, sizeof(linfo->mac_addr));181 memset(&linfo->mac_addr, 0, sizeof(linfo->mac_addr)); 182 182 } 183 183 -
uspace/srv/net/inetsrv/inetsrv.h
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 #include <stdbool.h> 42 42 #include <inet/addr.h> 43 #include <inet/eth_addr.h> 43 44 #include <inet/iplink.h> 44 45 #include <ipc/loc.h> … … 109 110 iplink_t *iplink; 110 111 size_t def_mtu; 111 addr48_t mac;112 eth_addr_t mac; 112 113 bool mac_valid; 113 114 } inet_link_t; -
uspace/srv/net/inetsrv/ndp.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 2021 Jiri Svoboda 2 3 * Copyright (c) 2013 Antonin Steinhauser 3 4 * All rights reserved. … … 36 37 37 38 #include <errno.h> 39 #include <inet/eth_addr.h> 40 #include <io/log.h> 38 41 #include <mem.h> 39 42 #include <stdlib.h> 40 #include <io/log.h>41 43 #include "ntrans.h" 42 44 #include "addrobj.h" … … 69 71 ndp_pdu_encode(packet, &dgram); 70 72 71 inet_link_send_dgram6(link, packet->target_hw_addr, &dgram,73 inet_link_send_dgram6(link, &packet->target_hw_addr, &dgram, 72 74 IP_PROTO_ICMPV6, INET6_HOP_LIMIT_MAX, 0); 73 75 … … 108 110 if (laddr != NULL) { 109 111 rc = ntrans_add(packet.sender_proto_addr, 110 packet.sender_hw_addr);112 &packet.sender_hw_addr); 111 113 if (rc != EOK) 112 114 return rc; … … 115 117 116 118 reply.opcode = ICMPV6_NEIGHBOUR_ADVERTISEMENT; 117 addr48(laddr->ilink->mac, reply.sender_hw_addr);119 reply.sender_hw_addr = laddr->ilink->mac; 118 120 addr128(packet.target_proto_addr, reply.sender_proto_addr); 119 addr48(packet.sender_hw_addr, reply.target_hw_addr);121 reply.target_hw_addr = packet.sender_hw_addr; 120 122 addr128(packet.sender_proto_addr, reply.target_proto_addr); 121 123 … … 128 130 if (laddr != NULL) 129 131 return ntrans_add(packet.sender_proto_addr, 130 packet.sender_hw_addr);132 &packet.sender_hw_addr); 131 133 132 134 break; … … 151 153 * 152 154 */ 153 errno_t ndp_translate(addr128_t src_addr, addr128_t ip_addr, addr48_tmac_addr,155 errno_t ndp_translate(addr128_t src_addr, addr128_t ip_addr, eth_addr_t *mac_addr, 154 156 inet_link_t *ilink) 155 157 { … … 167 169 168 170 packet.opcode = ICMPV6_NEIGHBOUR_SOLICITATION; 169 addr48(ilink->mac, packet.sender_hw_addr);171 packet.sender_hw_addr = ilink->mac; 170 172 addr128(src_addr, packet.sender_proto_addr); 171 173 addr128(ip_addr, packet.solicited_ip); 172 addr48_solicited_node(ip_addr,packet.target_hw_addr);174 eth_addr_solicited_node(ip_addr, &packet.target_hw_addr); 173 175 ndp_solicited_node_ip(ip_addr, packet.target_proto_addr); 174 176 -
uspace/srv/net/inetsrv/ndp.h
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 2021 Jiri Svoboda 2 3 * Copyright (c) 2013 Antonin Steinhauser 3 4 * All rights reserved. … … 39 40 40 41 #include <inet/addr.h> 42 #include <inet/eth_addr.h> 41 43 #include "inetsrv.h" 42 44 #include "icmpv6_std.h" … … 52 54 ndp_opcode_t opcode; 53 55 /** Sender hardware address */ 54 addr48_t sender_hw_addr;56 eth_addr_t sender_hw_addr; 55 57 /** Sender protocol address */ 56 58 addr128_t sender_proto_addr; 57 59 /** Target hardware address */ 58 addr48_t target_hw_addr;60 eth_addr_t target_hw_addr; 59 61 /** Target protocol address */ 60 62 addr128_t target_proto_addr; … … 64 66 65 67 extern errno_t ndp_received(inet_dgram_t *); 66 extern errno_t ndp_translate(addr128_t, addr128_t, addr48_t, inet_link_t *);68 extern errno_t ndp_translate(addr128_t, addr128_t, eth_addr_t *, inet_link_t *); 67 69 68 70 #endif -
uspace/srv/net/inetsrv/ntrans.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 2021 Jiri Svoboda 2 3 * Copyright (c) 2013 Antonin Steinhauser 3 4 * All rights reserved. … … 38 39 #include <errno.h> 39 40 #include <fibril_synch.h> 41 #include <inet/eth_addr.h> 40 42 #include <inet/iplink_srv.h> 41 43 #include <stdlib.h> … … 73 75 * 74 76 */ 75 errno_t ntrans_add(addr128_t ip_addr, addr48_tmac_addr)77 errno_t ntrans_add(addr128_t ip_addr, eth_addr_t *mac_addr) 76 78 { 77 79 inet_ntrans_t *ntrans; … … 83 85 84 86 addr128(ip_addr, ntrans->ip_addr); 85 addr48(mac_addr, ntrans->mac_addr);87 ntrans->mac_addr = *mac_addr; 86 88 87 89 fibril_mutex_lock(&ntrans_list_lock); … … 134 136 * 135 137 */ 136 errno_t ntrans_lookup(addr128_t ip_addr, addr48_tmac_addr)138 errno_t ntrans_lookup(addr128_t ip_addr, eth_addr_t *mac_addr) 137 139 { 138 140 fibril_mutex_lock(&ntrans_list_lock); … … 144 146 145 147 fibril_mutex_unlock(&ntrans_list_lock); 146 addr48(ntrans->mac_addr, mac_addr);148 *mac_addr = ntrans->mac_addr; 147 149 return EOK; 148 150 } -
uspace/srv/net/inetsrv/ntrans.h
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 2021 Jiri Svoboda 2 3 * Copyright (c) 2013 Antonin Steinhauser 3 4 * All rights reserved. … … 38 39 #define NTRANS_H_ 39 40 41 #include <inet/addr.h> 42 #include <inet/eth_addr.h> 40 43 #include <inet/iplink_srv.h> 41 #include <inet/addr.h>42 44 43 45 /** Address translation table element */ … … 45 47 link_t ntrans_list; 46 48 addr128_t ip_addr; 47 addr48_t mac_addr;49 eth_addr_t mac_addr; 48 50 } inet_ntrans_t; 49 51 50 extern errno_t ntrans_add(addr128_t, addr48_t);52 extern errno_t ntrans_add(addr128_t, eth_addr_t *); 51 53 extern errno_t ntrans_remove(addr128_t); 52 extern errno_t ntrans_lookup(addr128_t, addr48_t);54 extern errno_t ntrans_lookup(addr128_t, eth_addr_t *); 53 55 extern errno_t ntrans_wait_timeout(usec_t); 54 56 -
uspace/srv/net/inetsrv/pdu.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 40 40 #include <errno.h> 41 41 #include <fibril_synch.h> 42 #include <inet/eth_addr.h> 42 43 #include <io/log.h> 43 44 #include <macros.h> … … 504 505 505 506 message->length = 1; 506 addr48(ndp->sender_hw_addr, message->mac);507 eth_addr_encode(&ndp->sender_hw_addr, message->mac); 507 508 508 509 icmpv6_phdr_t phdr; … … 552 553 553 554 addr128_t_be2host(message->target_address, ndp->target_proto_addr); 554 addr48(message->mac,ndp->sender_hw_addr);555 eth_addr_decode(message->mac, &ndp->sender_hw_addr); 555 556 556 557 return EOK; -
uspace/srv/net/loopip/loopip.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 20 12Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 #include <inet/iplink_srv.h> 42 42 #include <inet/addr.h> 43 #include <inet/eth_addr.h> 43 44 #include <io/log.h> 44 45 #include <loc.h> … … 55 56 static errno_t loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu); 56 57 static errno_t loopip_get_mtu(iplink_srv_t *srv, size_t *mtu); 57 static errno_t loopip_get_mac48(iplink_srv_t *srv, addr48_t *mac);58 static errno_t loopip_get_mac48(iplink_srv_t *srv, eth_addr_t *mac); 58 59 static errno_t loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr); 59 60 static errno_t loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr); … … 231 232 } 232 233 233 static errno_t loopip_get_mac48(iplink_srv_t *src, addr48_t *mac)234 static errno_t loopip_get_mac48(iplink_srv_t *src, eth_addr_t *mac) 234 235 { 235 236 log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_get_mac48()"); -
uspace/srv/net/slip/slip.c
r2ce943a r8a9a41e 1 1 /* 2 * Copyright (c) 2021 Jiri Svoboda 2 3 * Copyright (c) 2013 Jakub Jermar 3 4 * All rights reserved. … … 40 41 #include <loc.h> 41 42 #include <inet/addr.h> 43 #include <inet/eth_addr.h> 42 44 #include <inet/iplink_srv.h> 43 45 #include <io/chardev.h> … … 62 64 static errno_t slip_send6(iplink_srv_t *, iplink_sdu6_t *); 63 65 static errno_t slip_get_mtu(iplink_srv_t *, size_t *); 64 static errno_t slip_get_mac48(iplink_srv_t *, addr48_t *);66 static errno_t slip_get_mac48(iplink_srv_t *, eth_addr_t *); 65 67 static errno_t slip_addr_add(iplink_srv_t *, inet_addr_t *); 66 68 static errno_t slip_addr_remove(iplink_srv_t *, inet_addr_t *); … … 176 178 } 177 179 178 errno_t slip_get_mac48(iplink_srv_t *src, addr48_t *mac)180 errno_t slip_get_mac48(iplink_srv_t *src, eth_addr_t *mac) 179 181 { 180 182 log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_get_mac48()");
Note:
See TracChangeset
for help on using the changeset viewer.
