Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ff_recvfrom failed: Operation not permitted #853

Open
axbkts opened this issue Dec 26, 2024 · 0 comments
Open

ff_recvfrom failed: Operation not permitted #853

axbkts opened this issue Dec 26, 2024 · 0 comments

Comments

@axbkts
Copy link

axbkts commented Dec 26, 2024

Network devices using DPDK-compatible driver

0000:00:08.0 '82540EM Gigabit Ethernet Controller 100e' drv=uio_pci_generic unused=e1000

Network devices using kernel driver

0000:00:03.0 '82540EM Gigabit Ethernet Controller 100e' if=enp0s3 drv=e1000 unused=uio_pci_generic Active

No 'Baseband' devices detected

No 'Crypto' devices detected

No 'DMA' devices detected

No 'Eventdev' devices detected

No 'Mempool' devices detected

No 'Compress' devices detected

No 'Misc (rawdev)' devices detected

No 'Regex' devices detected

My code :
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <ff_api.h>

#define PORT 12345
#define BUFFER_SIZE 1024
#define IP_ADDRESS "192.168.1.3"

int main(int argc, char *argv[]) {
if (ff_init(argc, argv) < 0) {
fprintf(stderr, "F-Stack initialization failed\n");
return -1;
}

int sock = ff_socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
    perror("ff_socket failed");
    return -1;
}

struct linux_sockaddr server_addr;
memset(&server_addr, 0, sizeof(server_addr));
server_addr.sa_family = AF_INET;

*((uint16_t *)server_addr.sa_data) = htons(PORT);
inet_pton(AF_INET, IP_ADDRESS, server_addr.sa_data + 2);

if (ff_bind(sock, &server_addr, sizeof(server_addr)) < 0) {
    perror("ff_bind failed");
    ff_close(sock);
    return -1;
}

printf("Listening for UDP packets on port %d...\n", PORT);


char buffer[BUFFER_SIZE];
struct linux_sockaddr from_addr;
socklen_t from_len = sizeof(from_addr);

while (1) {
    ssize_t received_bytes = ff_recvfrom(sock, buffer, BUFFER_SIZE - 1, 0,
                                         (struct linux_sockaddr *)&from_addr, &from_len);
    if (received_bytes < 0) {
        perror("ff_recvfrom failed");
        break;
    }

    buffer[received_bytes] = '\0';
    
    printf("Received %ld bytes from %s:%d: %s\n", received_bytes,
           inet_ntoa(*(struct in_addr *)&from_addr.sa_data[4]), ntohs(*(uint16_t *)&from_addr.sa_data[2]), buffer);
}

ff_close(sock);

return 0;

}

config.ini :

[dpdk]
lcore_mask=0x3
channel=2
promiscuous=1
numa_on=0
tcore_mask=0x3
port_list=0
mem_size=4096

[port0]
addr=192.168.1.3
netmask=255.255.255.0
broadcast=192.168.1.255
gateway=192.168.1.254
#addr6 = fe80::a8:6501:12f1:3eb9
#prefix6 = 64
#gateway6 = fe80::1

[log]
level = debug

Hi, I am encountering an issue while running F-Stack. After starting the application.

root@ubuntu:/home/ahmet/Masaüstü/f_stack/f-stack3# ./f-stack3 --conf config.ini --proc-type=primary --proc-id=0
[dpdk]: lcore_mask=0x3
[dpdk]: channel=2
[dpdk]: promiscuous=1
[dpdk]: numa_on=0
[dpdk]: tcore_mask=0x3
[dpdk]: port_list=0
[dpdk]: mem_size=4096
[port0]: addr=192.168.1.3
[port0]: netmask=255.255.255.0
[port0]: broadcast=192.168.1.255
[port0]: gateway=192.168.1.254
[log]: level=debug
f-stack -c1 -n2 --proc-type=primary
EAL: Detected CPU lcores: 3
EAL: Detected NUMA nodes: 1
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: Probe PCI driver: net_e1000_em (8086:100e) device: 0000:00:08.0 (socket -1)
TELEMETRY: No legacy callbacks, legacy socket not created
lcore: 0, port: 0, queue: 0
create mbuf pool on socket 0
create ring:dispatch_ring_p0_q0 success, 2047 ring entries are now free!
create ring:dispatch_ring_p0_q1 success, 2047 ring entries are now free!
Port 0 MAC:08:00:27:D7:CB:D6
Port 0 modified RSS hash function based on hardware support,requested:0x2003ffffc configured:0
RX checksum offload supported
TX ip checksum offload supported
TX TCP&UDP checksum offload supported
TSO is disabled
set port 0 to promiscuous mode ok

Checking link status...................done
Port 0 Link Up - speed 1000 Mbps - full-duplex
link_elf_lookup_symbol: missing symbol hash table
link_elf_lookup_symbol: missing symbol hash table
Timecounters tick every 10.000 msec
WARNING: Adding ifaddrs to all fibs has been turned off by default. Consider tuning net.add_addr_allfibs if needed
Attempting to load tcp_bbr
tcp_bbr is now available
TCP Hpts created 1 swi interrupt threads and bound 0 to cpus
Timecounter "ff_clock" frequency 100 Hz quality 1
TCP_ratelimit: Is now initialized
f-stack-0: No addr6 config found.
f-stack-0: Ethernet address: 08:00:27:d7:cb:d6
f-stack-0: Successed to register dpdk interface
Listening for UDP packets on port 12345...
ff_recvfrom failed: Operation not permitted

I can see that the setup progresses successfully, and the application starts listening for UDP packets on port 12345. However, shortly after, I get the following error message :
ff_recvfrom failed: Operation not permitted

Could you help me understand what I need to do to resolve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant