1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 #ifndef _UAPI__LINUX_MROUTE_H 2 #ifndef _UAPI__LINUX_MROUTE_H 3 #define _UAPI__LINUX_MROUTE_H 3 #define _UAPI__LINUX_MROUTE_H 4 4 5 #include <linux/sockios.h> 5 #include <linux/sockios.h> 6 #include <linux/types.h> 6 #include <linux/types.h> 7 #include <linux/in.h> /* For struct 7 #include <linux/in.h> /* For struct in_addr. */ 8 8 9 /* Based on the MROUTING 3.5 defines primarily 9 /* Based on the MROUTING 3.5 defines primarily to keep 10 * source compatibility with BSD. 10 * source compatibility with BSD. 11 * 11 * 12 * See the mrouted code for the original histo 12 * See the mrouted code for the original history. 13 * 13 * 14 * Protocol Independent Multicast (PIM) data s 14 * Protocol Independent Multicast (PIM) data structures included 15 * Carlos Picoto (cap@di.fc.ul.pt) 15 * Carlos Picoto (cap@di.fc.ul.pt) 16 */ 16 */ 17 17 18 #define MRT_BASE 200 18 #define MRT_BASE 200 19 #define MRT_INIT (MRT_BASE) /* Act 19 #define MRT_INIT (MRT_BASE) /* Activate the kernel mroute code */ 20 #define MRT_DONE (MRT_BASE+1) /* Shu 20 #define MRT_DONE (MRT_BASE+1) /* Shutdown the kernel mroute */ 21 #define MRT_ADD_VIF (MRT_BASE+2) /* Add 21 #define MRT_ADD_VIF (MRT_BASE+2) /* Add a virtual interface */ 22 #define MRT_DEL_VIF (MRT_BASE+3) /* Del 22 #define MRT_DEL_VIF (MRT_BASE+3) /* Delete a virtual interface */ 23 #define MRT_ADD_MFC (MRT_BASE+4) /* Add 23 #define MRT_ADD_MFC (MRT_BASE+4) /* Add a multicast forwarding entry */ 24 #define MRT_DEL_MFC (MRT_BASE+5) /* Del 24 #define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */ 25 #define MRT_VERSION (MRT_BASE+6) /* Get 25 #define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */ 26 #define MRT_ASSERT (MRT_BASE+7) /* Act 26 #define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ 27 #define MRT_PIM (MRT_BASE+8) /* ena 27 #define MRT_PIM (MRT_BASE+8) /* enable PIM code */ 28 #define MRT_TABLE (MRT_BASE+9) /* Spe 28 #define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */ 29 #define MRT_ADD_MFC_PROXY (MRT_BASE+10) 29 #define MRT_ADD_MFC_PROXY (MRT_BASE+10) /* Add a (*,*|G) mfc entry */ 30 #define MRT_DEL_MFC_PROXY (MRT_BASE+11) 30 #define MRT_DEL_MFC_PROXY (MRT_BASE+11) /* Del a (*,*|G) mfc entry */ 31 #define MRT_FLUSH (MRT_BASE+12) /* Flu 31 #define MRT_FLUSH (MRT_BASE+12) /* Flush all mfc entries and/or vifs */ 32 #define MRT_MAX (MRT_BASE+12) 32 #define MRT_MAX (MRT_BASE+12) 33 33 34 #define SIOCGETVIFCNT SIOCPROTOPRIVATE 34 #define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ 35 #define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) 35 #define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) 36 #define SIOCGETRPF (SIOCPROTOPRIVATE+2) 36 #define SIOCGETRPF (SIOCPROTOPRIVATE+2) 37 37 38 /* MRT_FLUSH optional flags */ 38 /* MRT_FLUSH optional flags */ 39 #define MRT_FLUSH_MFC 1 /* Flush multi 39 #define MRT_FLUSH_MFC 1 /* Flush multicast entries */ 40 #define MRT_FLUSH_MFC_STATIC 2 /* Flu 40 #define MRT_FLUSH_MFC_STATIC 2 /* Flush static multicast entries */ 41 #define MRT_FLUSH_VIFS 4 /* Flush multi 41 #define MRT_FLUSH_VIFS 4 /* Flush multicast vifs */ 42 #define MRT_FLUSH_VIFS_STATIC 8 /* Flu 42 #define MRT_FLUSH_VIFS_STATIC 8 /* Flush static multicast vifs */ 43 43 44 #define MAXVIFS 32 44 #define MAXVIFS 32 45 typedef unsigned long vifbitmap_t; /* Use 45 typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */ 46 typedef unsigned short vifi_t; 46 typedef unsigned short vifi_t; 47 #define ALL_VIFS ((vifi_t)(-1)) 47 #define ALL_VIFS ((vifi_t)(-1)) 48 48 49 /* Same idea as select */ 49 /* Same idea as select */ 50 50 51 #define VIFM_SET(n,m) ((m)|=(1<<(n))) 51 #define VIFM_SET(n,m) ((m)|=(1<<(n))) 52 #define VIFM_CLR(n,m) ((m)&=~(1<<(n))) 52 #define VIFM_CLR(n,m) ((m)&=~(1<<(n))) 53 #define VIFM_ISSET(n,m) ((m)&(1<<(n))) 53 #define VIFM_ISSET(n,m) ((m)&(1<<(n))) 54 #define VIFM_CLRALL(m) ((m)=0) 54 #define VIFM_CLRALL(m) ((m)=0) 55 #define VIFM_COPY(mfrom,mto) ((mto)=(mfrom) 55 #define VIFM_COPY(mfrom,mto) ((mto)=(mfrom)) 56 #define VIFM_SAME(m1,m2) ((m1)==(m2)) 56 #define VIFM_SAME(m1,m2) ((m1)==(m2)) 57 57 58 /* Passed by mrouted for an MRT_ADD_VIF - agai 58 /* Passed by mrouted for an MRT_ADD_VIF - again we use the 59 * mrouted 3.6 structures for compatibility 59 * mrouted 3.6 structures for compatibility 60 */ 60 */ 61 struct vifctl { 61 struct vifctl { 62 vifi_t vifc_vifi; /* Ind 62 vifi_t vifc_vifi; /* Index of VIF */ 63 unsigned char vifc_flags; /* VIF 63 unsigned char vifc_flags; /* VIFF_ flags */ 64 unsigned char vifc_threshold; /* ttl 64 unsigned char vifc_threshold; /* ttl limit */ 65 unsigned int vifc_rate_limit; /* Rat 65 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ 66 union { 66 union { 67 struct in_addr vifc_lcl_addr; 67 struct in_addr vifc_lcl_addr; /* Local interface address */ 68 int vifc_lcl_ifinde 68 int vifc_lcl_ifindex; /* Local interface index */ 69 }; 69 }; 70 struct in_addr vifc_rmt_addr; /* IPI 70 struct in_addr vifc_rmt_addr; /* IPIP tunnel addr */ 71 }; 71 }; 72 72 73 #define VIFF_TUNNEL 0x1 /* IPI 73 #define VIFF_TUNNEL 0x1 /* IPIP tunnel */ 74 #define VIFF_SRCRT 0x2 /* NI 74 #define VIFF_SRCRT 0x2 /* NI */ 75 #define VIFF_REGISTER 0x4 /* reg 75 #define VIFF_REGISTER 0x4 /* register vif */ 76 #define VIFF_USE_IFINDEX 0x8 /* use 76 #define VIFF_USE_IFINDEX 0x8 /* use vifc_lcl_ifindex instead of 77 vif 77 vifc_lcl_addr to find an interface */ 78 78 79 /* Cache manipulation structures for mrouted a 79 /* Cache manipulation structures for mrouted and PIMd */ 80 struct mfcctl { 80 struct mfcctl { 81 struct in_addr mfcc_origin; 81 struct in_addr mfcc_origin; /* Origin of mcast */ 82 struct in_addr mfcc_mcastgrp; 82 struct in_addr mfcc_mcastgrp; /* Group in question */ 83 vifi_t mfcc_parent; 83 vifi_t mfcc_parent; /* Where it arrived */ 84 unsigned char mfcc_ttls[MAXVIFS]; 84 unsigned char mfcc_ttls[MAXVIFS]; /* Where it is going */ 85 unsigned int mfcc_pkt_cnt; 85 unsigned int mfcc_pkt_cnt; /* pkt count for src-grp */ 86 unsigned int mfcc_byte_cnt; 86 unsigned int mfcc_byte_cnt; 87 unsigned int mfcc_wrong_if; 87 unsigned int mfcc_wrong_if; 88 int mfcc_expire; 88 int mfcc_expire; 89 }; 89 }; 90 90 91 /* Group count retrieval for mrouted */ 91 /* Group count retrieval for mrouted */ 92 struct sioc_sg_req { 92 struct sioc_sg_req { 93 struct in_addr src; 93 struct in_addr src; 94 struct in_addr grp; 94 struct in_addr grp; 95 unsigned long pktcnt; 95 unsigned long pktcnt; 96 unsigned long bytecnt; 96 unsigned long bytecnt; 97 unsigned long wrong_if; 97 unsigned long wrong_if; 98 }; 98 }; 99 99 100 /* To get vif packet counts */ 100 /* To get vif packet counts */ 101 struct sioc_vif_req { 101 struct sioc_vif_req { 102 vifi_t vifi; /* Which iface 102 vifi_t vifi; /* Which iface */ 103 unsigned long icount; /* In packets 103 unsigned long icount; /* In packets */ 104 unsigned long ocount; /* Out packets 104 unsigned long ocount; /* Out packets */ 105 unsigned long ibytes; /* In bytes */ 105 unsigned long ibytes; /* In bytes */ 106 unsigned long obytes; /* Out bytes * 106 unsigned long obytes; /* Out bytes */ 107 }; 107 }; 108 108 109 /* This is the format the mroute daemon expect 109 /* This is the format the mroute daemon expects to see IGMP control 110 * data. Magically happens to be like an IP pa 110 * data. Magically happens to be like an IP packet as per the original 111 */ 111 */ 112 struct igmpmsg { 112 struct igmpmsg { 113 __u32 unused1,unused2; 113 __u32 unused1,unused2; 114 unsigned char im_msgtype; 114 unsigned char im_msgtype; /* What is this */ 115 unsigned char im_mbz; 115 unsigned char im_mbz; /* Must be zero */ 116 unsigned char im_vif; !! 116 unsigned char im_vif; /* Interface (this ought to be a vifi_t!) */ 117 unsigned char im_vif_hi; !! 117 unsigned char unused3; 118 struct in_addr im_src,im_dst; 118 struct in_addr im_src,im_dst; 119 }; 119 }; 120 120 121 /* ipmr netlink table attributes */ 121 /* ipmr netlink table attributes */ 122 enum { 122 enum { 123 IPMRA_TABLE_UNSPEC, 123 IPMRA_TABLE_UNSPEC, 124 IPMRA_TABLE_ID, 124 IPMRA_TABLE_ID, 125 IPMRA_TABLE_CACHE_RES_QUEUE_LEN, 125 IPMRA_TABLE_CACHE_RES_QUEUE_LEN, 126 IPMRA_TABLE_MROUTE_REG_VIF_NUM, 126 IPMRA_TABLE_MROUTE_REG_VIF_NUM, 127 IPMRA_TABLE_MROUTE_DO_ASSERT, 127 IPMRA_TABLE_MROUTE_DO_ASSERT, 128 IPMRA_TABLE_MROUTE_DO_PIM, 128 IPMRA_TABLE_MROUTE_DO_PIM, 129 IPMRA_TABLE_VIFS, 129 IPMRA_TABLE_VIFS, 130 IPMRA_TABLE_MROUTE_DO_WRVIFWHOLE, 130 IPMRA_TABLE_MROUTE_DO_WRVIFWHOLE, 131 __IPMRA_TABLE_MAX 131 __IPMRA_TABLE_MAX 132 }; 132 }; 133 #define IPMRA_TABLE_MAX (__IPMRA_TABLE_MAX - 1 133 #define IPMRA_TABLE_MAX (__IPMRA_TABLE_MAX - 1) 134 134 135 /* ipmr netlink vif attribute format 135 /* ipmr netlink vif attribute format 136 * [ IPMRA_TABLE_VIFS ] - nested attribute 136 * [ IPMRA_TABLE_VIFS ] - nested attribute 137 * [ IPMRA_VIF ] - nested attribute 137 * [ IPMRA_VIF ] - nested attribute 138 * [ IPMRA_VIFA_xxx ] 138 * [ IPMRA_VIFA_xxx ] 139 */ 139 */ 140 enum { 140 enum { 141 IPMRA_VIF_UNSPEC, 141 IPMRA_VIF_UNSPEC, 142 IPMRA_VIF, 142 IPMRA_VIF, 143 __IPMRA_VIF_MAX 143 __IPMRA_VIF_MAX 144 }; 144 }; 145 #define IPMRA_VIF_MAX (__IPMRA_VIF_MAX - 1) 145 #define IPMRA_VIF_MAX (__IPMRA_VIF_MAX - 1) 146 146 147 /* vif-specific attributes */ 147 /* vif-specific attributes */ 148 enum { 148 enum { 149 IPMRA_VIFA_UNSPEC, 149 IPMRA_VIFA_UNSPEC, 150 IPMRA_VIFA_IFINDEX, 150 IPMRA_VIFA_IFINDEX, 151 IPMRA_VIFA_VIF_ID, 151 IPMRA_VIFA_VIF_ID, 152 IPMRA_VIFA_FLAGS, 152 IPMRA_VIFA_FLAGS, 153 IPMRA_VIFA_BYTES_IN, 153 IPMRA_VIFA_BYTES_IN, 154 IPMRA_VIFA_BYTES_OUT, 154 IPMRA_VIFA_BYTES_OUT, 155 IPMRA_VIFA_PACKETS_IN, 155 IPMRA_VIFA_PACKETS_IN, 156 IPMRA_VIFA_PACKETS_OUT, 156 IPMRA_VIFA_PACKETS_OUT, 157 IPMRA_VIFA_LOCAL_ADDR, 157 IPMRA_VIFA_LOCAL_ADDR, 158 IPMRA_VIFA_REMOTE_ADDR, 158 IPMRA_VIFA_REMOTE_ADDR, 159 IPMRA_VIFA_PAD, 159 IPMRA_VIFA_PAD, 160 __IPMRA_VIFA_MAX 160 __IPMRA_VIFA_MAX 161 }; 161 }; 162 #define IPMRA_VIFA_MAX (__IPMRA_VIFA_MAX - 1) 162 #define IPMRA_VIFA_MAX (__IPMRA_VIFA_MAX - 1) 163 163 164 /* ipmr netlink cache report attributes */ 164 /* ipmr netlink cache report attributes */ 165 enum { 165 enum { 166 IPMRA_CREPORT_UNSPEC, 166 IPMRA_CREPORT_UNSPEC, 167 IPMRA_CREPORT_MSGTYPE, 167 IPMRA_CREPORT_MSGTYPE, 168 IPMRA_CREPORT_VIF_ID, 168 IPMRA_CREPORT_VIF_ID, 169 IPMRA_CREPORT_SRC_ADDR, 169 IPMRA_CREPORT_SRC_ADDR, 170 IPMRA_CREPORT_DST_ADDR, 170 IPMRA_CREPORT_DST_ADDR, 171 IPMRA_CREPORT_PKT, 171 IPMRA_CREPORT_PKT, 172 IPMRA_CREPORT_TABLE, << 173 __IPMRA_CREPORT_MAX 172 __IPMRA_CREPORT_MAX 174 }; 173 }; 175 #define IPMRA_CREPORT_MAX (__IPMRA_CREPORT_MAX 174 #define IPMRA_CREPORT_MAX (__IPMRA_CREPORT_MAX - 1) 176 175 177 /* That's all usermode folks */ 176 /* That's all usermode folks */ 178 177 179 #define MFC_ASSERT_THRESH (3*HZ) 178 #define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */ 180 179 181 /* Pseudo messages used by mrouted */ 180 /* Pseudo messages used by mrouted */ 182 #define IGMPMSG_NOCACHE 1 181 #define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */ 183 #define IGMPMSG_WRONGVIF 2 182 #define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */ 184 #define IGMPMSG_WHOLEPKT 3 183 #define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ 185 #define IGMPMSG_WRVIFWHOLE 4 184 #define IGMPMSG_WRVIFWHOLE 4 /* For PIM Register and assert processing */ 186 185 187 #endif /* _UAPI__LINUX_MROUTE_H */ 186 #endif /* _UAPI__LINUX_MROUTE_H */ 188 187
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.