summaryrefslogtreecommitdiff
path: root/mcastseed
diff options
context:
space:
mode:
Diffstat (limited to 'mcastseed')
-rw-r--r--mcastseed/src/mcastseed.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/mcastseed/src/mcastseed.c b/mcastseed/src/mcastseed.c
index 796e159..04d5575 100644
--- a/mcastseed/src/mcastseed.c
+++ b/mcastseed/src/mcastseed.c
@@ -18,6 +18,9 @@
#define READ_BUF_LEN 256
#define MAX_PENDING_CONNECTIONS 256
#define MAX_CLIENTS 256
+#define MTU 1500
+/* Linux IPv6 fragmentation don't output ethernet frames larger than 1470 when MTU==1500 */
+#define MULTICAST_MAX_PAYLOAD_SIZE (MTU-40-8-(14+30))
#define DEFAULT_MCAST_IP_STR "ff02::114"
#define DEFAULT_PORT_STR "9000"
@@ -270,26 +273,31 @@ int start_job() {
void send_fake(char buf[], int paylen, int i) {
*( (uint32_t *) buf+1 ) = htonl(i);
- snprintf(buf+29, 5, "%04i", i);
+ snprintf(buf+28, 6, "%05i", i);
*( (char *) buf+33 ) = ')';
sendto(mcast_sock, buf, paylen, 0, mcast_addr->ai_addr, mcast_addr->ai_addrlen);
}
int send_data() {
ssize_t nwrite;
- char buf[] = "dataXXXXJe suis à la plage (XXXX).\n";
- int paylen = strlen(buf);
+ char buf[MULTICAST_MAX_PAYLOAD_SIZE];
+ int paylen = MULTICAST_MAX_PAYLOAD_SIZE;
int i;
+
/* XXX Dummy */
+ memset(buf, '.', MULTICAST_MAX_PAYLOAD_SIZE-1);
+ buf[MULTICAST_MAX_PAYLOAD_SIZE-1]='\n';
+ strcpy(buf, "dataXXXXJe suis a la plage (XXXXX)");
+
send_fake(buf, paylen, 5);
send_fake(buf, paylen, 4);
send_fake(buf, paylen, 3);
- for (i=6; i<=300; i+=2) {
+ for (i=6; i<=100000; i+=2) {
send_fake(buf, paylen, i);
}
- for (i=7; i<=300; i+=2) {
+ for (i=7; i<=100000; i+=2) {
send_fake(buf, paylen, i);
}
@@ -298,7 +306,7 @@ int send_data() {
send_fake(buf, paylen, 2);
*( (uint32_t *) buf+1 ) = htonl(3);
- buf[22]='m', buf[23]='e', buf[24]='r'; buf[25]='.'; buf[26]='\n'; paylen = 27;
+ buf[21]='m', buf[22]='e', buf[23]='r'; buf[24]='.'; buf[25]='\n'; paylen = 26;
nwrite = sendto(mcast_sock, buf, paylen, 0, mcast_addr->ai_addr, mcast_addr->ai_addrlen);
if ( nwrite < 0 ) {
perror("sendto() failed");
@@ -322,7 +330,7 @@ int wait_all_finalize_job() {
char buf[] = "end:XXXX";
int paylen = strlen(buf);
- *( (uint32_t *) buf+1 ) = htonl(300);
+ *( (uint32_t *) buf+1 ) = htonl(100000);
nwrite = sendto(mcast_sock, buf, paylen, 0, mcast_addr->ai_addr, mcast_addr->ai_addrlen);
if ( nwrite < 0 ) {
perror("sendto() failed");