Changeset 1333dfc in mainline for uspace/srv/net/inetsrv/inetsrv.c


Ignore:
Timestamp:
2024-12-13T08:44:05Z (10 months ago)
Author:
Nataliia Korop <n.corop08@…>
Children:
0210d42d
Parents:
fc2d593
git-author:
Nataliia Korop <n.corop08@…> (2024-04-11 09:36:03)
git-committer:
Nataliia Korop <n.corop08@…> (2024-12-13 08:44:05)
Message:

inetsrv dumps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/inetsrv/inetsrv.c

    rfc2d593 r1333dfc  
    4949#include <stdint.h>
    5050#include <task.h>
     51#include <pcapdump_iface.h>
    5152#include "addrobj.h"
    5253#include "icmp.h"
     
    6364#define NAME "inetsrv"
    6465
     66/** Interface for dumping packets */
     67pcap_iface_t pcapdump;
    6568
    6669static inet_naddr_t solicited_node_mask = {
     
    118121        if (rc != EOK)
    119122                return rc;
    120 
     123        rc = async_create_port(INTERFACE_PCAP_CONTROL,
     124            pcapdump_conn, &pcapdump, &port);
     125        if (rc != EOK) {
     126                return rc;
     127        }
    121128        rc = loc_server_register(NAME, &srv);
    122129        if (rc != EOK) {
     
    203210                    dgram->dest.addr, dgram, proto, ttl, df);
    204211        }
    205 
     212        printf("SENDING: packet size is - %d\n", dgram->size);
     213        pcapdump_packet(&pcapdump, dgram->data, dgram->size);
    206214        log_msg(LOG_DEFAULT, LVL_DEBUG, "dgram to be routed");
    207215
     
    541549                        dgram.data = packet->data;
    542550                        dgram.size = packet->size;
     551                        printf("RECEIVING: packet size is - %d\n", packet->size);
     552                        pcapdump_packet(&pcapdump, packet->data, packet->size);
    543553                        return inet_recv_dgram_local(&dgram, packet->proto);
    544554                } else {
     
    561571                return 1;
    562572        }
    563 
     573        rc = pcap_iface_init(&pcapdump);
     574
     575        if (rc != EOK) {
     576                printf("Failed creating pcap interface: %s", str_error(rc));
     577                return rc;
     578        }
    564579        rc = inet_init();
    565580        if (rc != EOK)
    566581                return 1;
    567582
     583        printf(NAME ": Initialized dump iface from inetsrv.\n");
    568584        printf(NAME ": Accepting connections.\n");
    569585
Note: See TracChangeset for help on using the changeset viewer.