summaryrefslogtreecommitdiffstats
path: root/src/mcast.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mcast.c')
-rw-r--r--src/mcast.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mcast.c b/src/mcast.c
index 6193a59..cdaed5f 100644
--- a/src/mcast.c
+++ b/src/mcast.c
@@ -26,6 +26,8 @@
#include <sys/time.h>
#include <unistd.h>
#include <string.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
#include "mcast.h"
#include "debug.h"
@@ -71,6 +73,18 @@ struct mcast_sock *mcast_server_create(struct mcast_conf *conf)
return NULL;
}
+ if(conf->iface[0]) {
+ struct ifreq ifr;
+
+ strncpy(ifr.ifr_name, conf->iface, sizeof(ifr.ifr_name));
+
+ if (ioctl(m->fd, SIOCGIFMTU, &ifr) == -1) {
+ debug("ioctl");
+ return NULL;
+ }
+ conf->mtu = ifr.ifr_mtu;
+ }
+
if (setsockopt(m->fd, SOL_SOCKET, SO_REUSEADDR, &yes,
sizeof(int)) == -1) {
debug("mcast_sock_server_create:setsockopt1");