wg-multicast - [streaming] miniSAP - further fix
Subject: All things related to multicast
List archive
- From:
- To: Marshall Eubanks <>
- Cc:
- Subject: [streaming] miniSAP - further fix
- Date: Wed, 2 Jul 2008 18:19:37 +0100
hi,
reminded of another local patch we had to the minisapserver
we noted when looking at SAP through the Cisco kit (when
we had the SAP viewer enabled....we dont anymore! ;-) )
that the software threw out a bogus source IP address
of 1.2.3.4 - why? - who knows! anyway, heres a unified
diff patch to fix that and use the IP address of the system
on the interface being used:
--- minisapserver-0.3.4-orig/sapserver.cpp 2008-02-05 12:25:47.000000000
+0000
+++ minisapserver-0.3.4-jpk/sapserver.cpp 2008-02-05 15:30:29.000000000
+0000
@@ -42,7 +42,11 @@
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif
-
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
using namespace std;
#include "sapserver.h"
@@ -221,8 +225,20 @@
return 1;
}
+ /* Work out the address of the interface in use */
+ int sockfd = socket(PF_INET,SOCK_DGRAM,0);
+ struct sockaddr_in *sin;
+ struct ifreq ifr;
+ strncpy(ifr.ifr_name,config.GetInterface (), IFNAMSIZ);
+ ioctl(sockfd,SIOCGIFADDR,&ifr);
+ close(sockfd);
+ sin = (struct sockaddr_in *) ((struct sockaddr *)
+ &(ifr.ifr_addr));
+ char * src_addr = inet_ntoa(sin->sin_addr);
+ printf("+ src IP address = %s\n",src_addr);
+
/* Create a new message */
- Message *message = new Message(0x4212+i, "1.2.3.4");
+ Message *message = new Message(0x4212+i, src_addr);
/* Add the program */
message->AddProgram(config.Programs[i]);
alan
- [streaming] miniSAP - further fix, A . L . M . Buxey, 07/02/2008
Archive powered by MHonArc 2.6.16.