is a list of changes: - Ignore interfaces that are not listed in the configuration file: fixes an abort when trying to configure interface located in a different rdomain and doesn't look to the address of interfaces outside the configuration (otherwise it would pick the wrong interface in some cases). - Improve the routing code: use a rb-tree to store groups avoiding group duplications and having to fix hand-rolled list implementations. - Fixed some warnings and improved debug messages. As discussed with ajacoutot@, ok reyk@
108 lines
2.9 KiB
Plaintext
108 lines
2.9 KiB
Plaintext
$OpenBSD: patch-defs_h,v 1.4 2016/12/23 13:44:31 rzalamena Exp $
|
|
--- defs.h.orig Thu Dec 15 19:50:23 2016
|
|
+++ defs.h Mon Dec 19 21:20:06 2016
|
|
@@ -40,10 +40,13 @@
|
|
#include <stdlib.h>
|
|
#include <syslog.h>
|
|
#include <signal.h>
|
|
+#include <string.h>
|
|
+#include <unistd.h>
|
|
|
|
+#include <sys/errno.h>
|
|
+#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
-#include <sys/un.h>
|
|
-#include <sys/time.h>
|
|
+#include <sys/ioctl.h>
|
|
|
|
#include <net/if.h>
|
|
|
|
@@ -52,13 +55,32 @@
|
|
#include <linux/in.h>
|
|
#include <linux/mroute.h>
|
|
#else
|
|
+ #include <netinet/in_systm.h>
|
|
#include <netinet/in.h>
|
|
#include <netinet/ip.h>
|
|
#include <netinet/igmp.h>
|
|
+ #include <netinet/ip_mroute.h>
|
|
#include <arpa/inet.h>
|
|
#endif
|
|
|
|
+#ifndef IGMP_MEMBERSHIP_QUERY
|
|
+#define IGMP_MEMBERSHIP_QUERY IGMP_HOST_MEMBERSHIP_QUERY
|
|
+#endif
|
|
+#ifndef IGMP_V1_MEMBERSHIP_REPORT
|
|
+#define IGMP_V1_MEMBERSHIP_REPORT IGMP_v1_HOST_MEMBERSHIP_REPORT
|
|
+#endif
|
|
+#ifndef IGMP_V2_MEMBERSHIP_REPORT
|
|
+#define IGMP_V2_MEMBERSHIP_REPORT IGMP_v2_HOST_MEMBERSHIP_REPORT
|
|
+#endif
|
|
+#ifndef IGMP_V2_LEAVE_GROUP
|
|
+#define IGMP_V2_LEAVE_GROUP IGMP_HOST_LEAVE_MESSAGE
|
|
+#endif
|
|
|
|
+#ifndef INADDR_ALLRTRS_GROUP
|
|
+/* address for multicast mtrace msg */
|
|
+#define INADDR_ALLRTRS_GROUP (u_int32_t)0xe0000002 /* 224.0.0.2 */
|
|
+#endif
|
|
+
|
|
// The default path for the config file...
|
|
#define IGMPPROXY_CONFIG_FILEPATH "/etc/igmpproxy.conf"
|
|
#define ENABLE_DEBUG 1
|
|
@@ -73,8 +95,12 @@
|
|
#define MAX_MC_VIFS 32 // !!! check this const in the specific includes
|
|
|
|
// Useful macros..
|
|
+#ifndef MIN
|
|
#define MIN( a, b ) ((a) < (b) ? (a) : (b))
|
|
+#endif
|
|
+#ifndef MAX
|
|
#define MAX( a, b ) ((a) < (b) ? (b) : (a))
|
|
+#endif
|
|
#define VCMC( Vc ) (sizeof( Vc ) / sizeof( (Vc)[ 0 ] ))
|
|
#define VCEP( Vc ) (&(Vc)[ VCMC( Vc ) ])
|
|
|
|
@@ -126,6 +152,7 @@
|
|
|
|
#define IF_DEBUG if(Log2Stderr & LOG_DEBUG)
|
|
|
|
+#define log logit
|
|
void log( int Serverity, int Errno, const char *FmtSt, ... );
|
|
|
|
/* ifvc.c
|
|
@@ -196,6 +223,7 @@
|
|
struct IfDesc *getIfByName( const char *IfName );
|
|
struct IfDesc *getIfByIx( unsigned Ix );
|
|
struct IfDesc *getIfByAddress( uint32 Ix );
|
|
+int isAdressValidForIf( struct IfDesc* intrface, uint32 ipaddr );
|
|
|
|
/* mroute-api.c
|
|
*/
|
|
@@ -221,6 +249,7 @@
|
|
int loadConfig(char *configFile);
|
|
void configureVifs();
|
|
struct Config *getCommonConfig();
|
|
+struct vifconfig *config_getinterface(const char *ifname);
|
|
|
|
/* igmp.c
|
|
*/
|
|
@@ -235,7 +264,7 @@
|
|
char *fmtInAdr( char *St, struct in_addr InAdr );
|
|
char *inetFmt(uint32 addr, char *s);
|
|
char *inetFmts(uint32 addr, uint32 mask, char *s);
|
|
-int inetCksum(u_short *addr, u_int len);
|
|
+int inetChksum(u_short *addr, u_int len);
|
|
|
|
/* kern.c
|
|
*/
|
|
@@ -264,7 +293,7 @@
|
|
void initRouteTable();
|
|
void clearAllRoutes();
|
|
int insertRoute(uint32 group, int ifx);
|
|
-int activateRoute(uint32 group, uint32 originAddr);
|
|
+int activateRoute(uint32 group, uint32 originAddr, int downIf);
|
|
void ageActiveRoutes();
|
|
void setRouteLastMemberMode(uint32 group);
|
|
int lastMemberGroupAge(uint32 group);
|