History

ipmr: ip6mr: Create new sockopt to clear mfc cache or vifs

Currently the only way to clear the forwarding cache was to delete the entries one by one using the MRT_DEL_MFC socket option or to destroy and recreate the socket. Create a new socket option which with the use of optional flags can clear any combination of multicast entries (static or not static) and multicast vifs (static or not static). Calling the new socket option MRT_FLUSH with the flags MRT_FLUSH_MFC and MRT_FLUSH_VIFS will clear all entries and vifs on the socket except for static entries.

Callum Sinclair committed 7 years ago

Commit ca8d4791 parent fd8ca894 files · +115 −56Browse files

Showing the changes to include/uapi/linux (2 of 4 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/mroute.h +8 −1
  2. include/uapi/linux/mroute6.h +8 −1
include/uapi/linux/mroute.h+8−1
@@ -28,12 +28,19 @@ · 27 unmodified lines
2828 #define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */
2929 #define MRT_ADD_MFC_PROXY (MRT_BASE+10) /* Add a (*,*|G) mfc entry */
3030 #define MRT_DEL_MFC_PROXY (MRT_BASE+11) /* Del a (*,*|G) mfc entry */
31−#define MRT_MAX (MRT_BASE+11)
31+#define MRT_FLUSH (MRT_BASE+12) /* Flush all mfc entries and/or vifs */
32+#define MRT_MAX (MRT_BASE+12)
3233
3334 #define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */
3435 #define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
3536 #define SIOCGETRPF (SIOCPROTOPRIVATE+2)
3637
38+/* MRT_FLUSH optional flags */
39+#define MRT_FLUSH_MFC 1 /* Flush multicast entries */
40+#define MRT_FLUSH_MFC_STATIC 2 /* Flush static multicast entries */
41+#define MRT_FLUSH_VIFS 4 /* Flush multicast vifs */
42+#define MRT_FLUSH_VIFS_STATIC 8 /* Flush static multicast vifs */
43+
3744 #define MAXVIFS 32
3845 typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */
3946 typedef unsigned short vifi_t;
include/uapi/linux/mroute6.h+8−1
@@ -31,12 +31,19 @@ · 30 unmodified lines
3131 #define MRT6_TABLE (MRT6_BASE+9) /* Specify mroute table ID */
3232 #define MRT6_ADD_MFC_PROXY (MRT6_BASE+10) /* Add a (*,*|G) mfc entry */
3333 #define MRT6_DEL_MFC_PROXY (MRT6_BASE+11) /* Del a (*,*|G) mfc entry */
34−#define MRT6_MAX (MRT6_BASE+11)
34+#define MRT6_FLUSH (MRT6_BASE+12) /* Flush all mfc entries and/or vifs */
35+#define MRT6_MAX (MRT6_BASE+12)
3536
3637 #define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */
3738 #define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
3839 #define SIOCGETRPF (SIOCPROTOPRIVATE+2)
3940
41+/* MRT6_FLUSH optional flags */
42+#define MRT6_FLUSH_MFC 1 /* Flush multicast entries */
43+#define MRT6_FLUSH_MFC_STATIC 2 /* Flush static multicast entries */
44+#define MRT6_FLUSH_MIFS 4 /* Flushing multicast vifs */
45+#define MRT6_FLUSH_MIFS_STATIC 8 /* Flush static multicast vifs */
46+
4047 #define MAXMIFS 32
4148 typedef unsigned long mifbitmap_t; /* User mode code depends on this lot */
4249 typedef unsigned short mifi_t;