Comments (1)
I minimally changed the example
multicast-echo.c
in order to confirm that this is a bug.
The modified version is here:
#include <time.h>
#include <poll.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <iostream>
int main(int argc, char *argv[])
{
int j = 0;
struct sockaddr_in mcast_addr;//, send_addr;
struct ip_mreq im;
int recv_fd; // , send_fd;
char *p, *q;
/* Parse command line arguments */
if (argc != 2)
goto usage_error;
mcast_addr.sin_family = AF_INET;
// send_addr.sin_family = AF_INET;
if ((p = strtok(argv[1], ":")) == NULL ||
inet_aton(p, &mcast_addr.sin_addr) == 0)
goto usage_error;
if ((p = strtok(NULL, ":")) == NULL ||
inet_aton(p, &im.imr_interface) == 0)
goto usage_error;
if ((p = strtok(NULL, "")) == NULL)
goto usage_error;
mcast_addr.sin_port = htons(strtol(p, &q, 10));
if (*p == '\0' || *q != '\0')
goto usage_error;
im.imr_multiaddr = mcast_addr.sin_addr;
/* if ((p = strtok(argv[2], ":")) == NULL ||
inet_aton(p, &send_addr.sin_addr) == 0)
goto usage_error;
if ((p = strtok(NULL, "")) == NULL)
goto usage_error;
send_addr.sin_port = htons(strtol(p, &q, 10));
if (*p == '\0' || *q != '\0')
goto usage_error;
*/
/* Create and bind sockets */
recv_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (recv_fd == -1)
{
fprintf(stderr, "socket: %s\n", strerror(errno));
return EXIT_FAILURE;
}
/*
send_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (send_fd == -1)
{
fprintf(stderr, "socket: %s\n", strerror(errno));
return EXIT_FAILURE;
}
*/
if (setsockopt(recv_fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&im, sizeof(im)) == -1)
{
fprintf(stderr, "setsockopt: IP_ADD_MEMBERSHIP failed: %s\n",
strerror(errno));
return EXIT_FAILURE;
}
if (bind(recv_fd, (struct sockaddr *)&mcast_addr, sizeof(mcast_addr)) == -1)
{
fprintf(stderr, "bind: %s\n", strerror(errno));
return EXIT_FAILURE;
}
/* if (connect(send_fd, (struct sockaddr *)&send_addr, sizeof(send_addr)) == -1)
{
fprintf(stderr, "connect: %s\n", strerror(errno));
return EXIT_FAILURE;
}
*/
/* Echo packets */
while (1)
{
char buf[65536];
ssize_t len;
len = recv(recv_fd, buf, sizeof(buf), 0);
std::cout << "len: " << len << std::endl;
if (len == -1)
{
fprintf(stderr, "recv: %s\n", strerror(errno));
return EXIT_FAILURE;
}
j++;
if(j == 100)
{
std::cout << "***" << std::endl;
if (setsockopt(recv_fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, (char *)&im, sizeof(im)) == -1)
{
return -1;
}
}
/*
if (send(send_fd, buf, len, 0) == -1)
{
fprintf(stderr, "send: %s\n", strerror(errno));
return EXIT_FAILURE;
}
*/
}
close(recv_fd);
// close(send_fd);
return 0;
usage_error:
fprintf(stderr,
"Usage: %s <multicast-group>:<interface-addr>:<port> <send-addr>:<port>\n"
"\n"
"Receive multicast UDP packets on <interface-addr> addressed to\n"
"multicast group <multicast-group> at port <port>, and echo a copy of\n"
"each packets to <send-addr>:<port>.\n",
argv[0]);
return 0;
}
The result is the same:
[ch@localhost exasock]$ exasock --debug ./a.out 233.252.14.1:192.168.2.2:10001
a.out: structs.h:487: exa_hashtable_mcast_remove: Assertion `memb_to_insert != ((void *)0)' failed.
I am trying to understand what is happening (debugging).
from exanic-software.
Related Issues (20)
- why do auther add this code ``#include <linux/ethtool.h>`` in exanic-phyops.h on version 2.7.2.
- There is no way to setup tcp connection with nonblock flag HOT 1
- version mismatch in 2.7.3 release link
- exanic_find_port_by_interface_name fails for X100 on RHEL8/9 HOT 4
- Unable to debug exasock application using gdb. HOT 5
- Kernel module fails to build on Linux 6.1 LTS HOT 7
- Public yum repositories return 200 OK for nonexistent content instead of 404
- exasock doesn't support socket MSG_WAITALL flag HOT 2
- EL9 (Rocky9) EADDRNOTAVAIL (Cannot assign requested address) on connect() HOT 1
- exanic-clock-sync have 300ns bias HOT 8
- Extra acknowledgement being sent while using exanic Kernel module for TCP session, with wrong sequence number
- Sockets linger in FIN-WAIT-2 indefinitely
- Kernel module fails to run on 6.2
- RHEL9 support request for libexanic
- exablaze.com and repositories no longer available HOT 1
- Exasock timeouts are broken
- Modules do not compile for kernel >= 6.4.0
- Loopback is unsupported HOT 1
- Fail to compile in CentOS Stream 9 HOT 1
- Build failure on RHEL 9.4 kernel 5.14.0-427.16.1.el9_4.x86_64 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exanic-software.