summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_mroute.h
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-06-13 17:51:16 +0000
committerwollman <wollman@FreeBSD.org>1995-06-13 17:51:16 +0000
commit20ad4f8359820cf12331c0335034438fc23ad604 (patch)
treeb5de17b0bb0d03b7ed728b104d3d0f4a9752fd4a /sys/netinet/ip_mroute.h
parentc0dfcf234735c518d2c756c46fddf87d2332c838 (diff)
downloadFreeBSD-src-20ad4f8359820cf12331c0335034438fc23ad604.zip
FreeBSD-src-20ad4f8359820cf12331c0335034438fc23ad604.tar.gz
Kernel side of 3.5 multicast routing code, based on work by Bill Fenner
and other work done here. The LKM support is probably broken, but it still compiles and will be fixed later.
Diffstat (limited to 'sys/netinet/ip_mroute.h')
-rw-r--r--sys/netinet/ip_mroute.h135
1 files changed, 73 insertions, 62 deletions
diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h
index 4c815e8..fd5ef37 100644
--- a/sys/netinet/ip_mroute.h
+++ b/sys/netinet/ip_mroute.h
@@ -42,28 +42,29 @@
#define _NETINET_IP_MROUTE_H_
/*
- * Definitions for the kernel part of DVMRP,
- * a Distance-Vector Multicast Routing Protocol.
- * (See RFC-1075.)
+ * Definitions for IP multicast forwarding.
*
* Written by David Waitzman, BBN Labs, August 1988.
* Modified by Steve Deering, Stanford, February 1989.
* Modified by Ajit Thyagarajan, PARC, August 1993.
* Modified by Ajit Thyagarajan, PARC, August 1994.
*
- * MROUTING 1.5
+ * MROUTING Revision: 3.3.1.3
*/
/*
- * DVMRP-specific setsockopt commands.
+ * Multicast Routing set/getsockopt commands.
*/
-#define DVMRP_INIT 100 /* initialize forwarder */
-#define DVMRP_DONE 101 /* shut down forwarder */
-#define DVMRP_ADD_VIF 102 /* create virtual interface */
-#define DVMRP_DEL_VIF 103 /* delete virtual interface */
-#define DVMRP_ADD_MFC 104 /* insert forwarding cache entry */
-#define DVMRP_DEL_MFC 105 /* delete forwarding cache entry */
+#define MRT_INIT 100 /* initialize forwarder */
+#define MRT_DONE 101 /* shut down forwarder */
+#define MRT_ADD_VIF 102 /* create virtual interface */
+#define MRT_DEL_VIF 103 /* delete virtual interface */
+#define MRT_ADD_MFC 104 /* insert forwarding cache entry */
+#define MRT_DEL_MFC 105 /* delete forwarding cache entry */
+#define MRT_VERSION 106 /* get kernel version number */
+#define MRT_ASSERT 107 /* enable PIM assert processing */
+
#define GET_TIME(t) microtime(&t)
@@ -73,6 +74,7 @@
#define MAXVIFS 32
typedef u_long vifbitmap_t;
typedef u_short vifi_t; /* type of a vif index */
+#define ALL_VIFS (vifi_t)-1
#define VIFM_SET(n, m) ((m) |= (1 << (n)))
#define VIFM_CLR(n, m) ((m) &= ~(1 << (n)))
@@ -83,59 +85,33 @@ typedef u_short vifi_t; /* type of a vif index */
/*
- * Argument structure for DVMRP_ADD_VIF.
- * (DVMRP_DEL_VIF takes a single vifi_t argument.)
+ * Argument structure for MRT_ADD_VIF.
+ * (MRT_DEL_VIF takes a single vifi_t argument.)
*/
struct vifctl {
- vifi_t vifc_vifi; /* the index of the vif to be added */
- u_char vifc_flags; /* VIFF_ flags defined below */
- u_char vifc_threshold; /* min ttl required to forward on vif */
- u_int vifc_rate_limit; /* max tate */
+ vifi_t vifc_vifi; /* the index of the vif to be added */
+ u_char vifc_flags; /* VIFF_ flags defined below */
+ u_char vifc_threshold; /* min ttl required to forward on vif */
+ u_int vifc_rate_limit; /* max rate */
struct in_addr vifc_lcl_addr; /* local interface address */
struct in_addr vifc_rmt_addr; /* remote address (tunnels only) */
};
#define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */
-#define VIFF_SRCRT 0x2 /* tunnel uses IP source routing */
+#define VIFF_SRCRT 0x2 /* tunnel uses IP source routing */
/*
- * Argument structure for DVMRP_ADD_MFC
+ * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC
* (mfcc_tos to be added at a future point)
*/
struct mfcctl {
- struct in_addr mfcc_origin; /* subnet origin of mcasts */
+ struct in_addr mfcc_origin; /* ip origin of mcasts */
struct in_addr mfcc_mcastgrp; /* multicast group associated*/
- struct in_addr mfcc_originmask; /* subnet mask for origin */
vifi_t mfcc_parent; /* incoming vif */
u_char mfcc_ttls[MAXVIFS]; /* forwarding ttls on vifs */
};
/*
- * Argument structure for DVMRP_DEL_MFC
- */
-struct delmfcctl {
- struct in_addr mfcc_origin; /* subnet origin of multicasts */
- struct in_addr mfcc_mcastgrp; /* multicast group assoc. w/ origin */
-};
-
-/*
- * Argument structure used by RSVP daemon to get vif information
- */
-struct vif_req {
- u_char v_flags; /* VIFF_ flags defined above */
- u_char v_threshold; /* min ttl required to forward on vif */
- struct in_addr v_lcl_addr; /* local interface address */
- struct in_addr v_rmt_addr;
- char v_if_name[IFNAMSIZ]; /* if name */
-};
-
-struct vif_conf {
- u_int vifc_len;
- u_int vifc_num;
- struct vif_req *vifc_req;
-};
-
-/*
* The kernel's multicast routing statistics.
*/
struct mrtstat {
@@ -151,6 +127,7 @@ struct mrtstat {
u_long mrts_drop_sel; /* pkts dropped selectively */
u_long mrts_q_overflow; /* pkts dropped - Q overflow */
u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */
+ u_long mrts_upq_sockfull; /* upcalls dropped - socket full */
};
/*
@@ -159,21 +136,28 @@ struct mrtstat {
struct sioc_sg_req {
struct in_addr src;
struct in_addr grp;
- u_long count;
+ u_long pktcnt;
+ u_long bytecnt;
+ u_long wrong_if;
};
/*
* Argument structure used by mrouted to get vif pkt counts
*/
struct sioc_vif_req {
- vifi_t vifi;
- u_long icount;
- u_long ocount;
+ vifi_t vifi; /* vif number */
+ u_long icount; /* Input packet count on vif */
+ u_long ocount; /* Output packet count on vif */
+ u_long ibytes; /* Input byte count on vif */
+ u_long obytes; /* Output byte count on vif */
};
-
+
#ifdef KERNEL
+/*
+ * The kernel's virtual-interface structure.
+ */
struct vif {
u_char v_flags; /* VIFF_ flags defined above */
u_char v_threshold; /* min ttl required to forward on vif*/
@@ -184,30 +168,56 @@ struct vif {
struct ifnet *v_ifp; /* pointer to interface */
u_long v_pkt_in; /* # pkts in on interface */
u_long v_pkt_out; /* # pkts out on interface */
+ u_long v_bytes_in; /* # bytes in on interface */
+ u_long v_bytes_out; /* # bytes out on interface */
+ struct route v_route; /* cached route if this is a tunnel */
+ u_int v_rsvp_on; /* RSVP listening on this vif */
+ struct socket *v_rsvpd; /* RSVP daemon socket */
};
/*
- * The kernel's multicast forwarding cache entry structure
- * (A field for the type of service (mfc_tos) is to be added
+ * The kernel's multicast forwarding cache entry structure
+ * (A field for the type of service (mfc_tos) is to be added
* at a future point)
*/
struct mfc {
- struct in_addr mfc_origin; /* subnet origin of mcasts */
+ struct in_addr mfc_origin; /* IP origin of mcasts */
struct in_addr mfc_mcastgrp; /* multicast group associated*/
- struct in_addr mfc_originmask; /* subnet mask for origin */
vifi_t mfc_parent; /* incoming vif */
u_char mfc_ttls[MAXVIFS]; /* forwarding ttls on vifs */
u_long mfc_pkt_cnt; /* pkt count for src-grp */
+ u_long mfc_byte_cnt; /* byte count for src-grp */
+ u_long mfc_wrong_if; /* wrong if for src-grp */
+ int mfc_expire; /* time to clean entry up */
+ struct timeval mfc_last_assert; /* last time I sent an assert*/
+};
+
+/*
+ * Struct used to communicate from kernel to multicast router
+ * note the convenient similarity to an IP packet
+ */
+struct igmpmsg {
+ u_long unused1;
+ u_long unused2;
+ u_char im_msgtype; /* what type of message */
+#define IGMPMSG_NOCACHE 1
+#define IGMPMSG_WRONGVIF 2
+ u_char im_mbz; /* must be zero */
+ u_char im_vif; /* vif rec'd on */
+ u_char unused3;
+ struct in_addr im_src, im_dst;
};
/*
* Argument structure used for pkt info. while upcall is made
*/
struct rtdetq {
- struct mbuf *m;
- struct ifnet *ifp;
- u_long tunnel_src;
- struct ip_moptions *imo;
+ struct mbuf *m; /* A copy of the packet */
+ struct ifnet *ifp; /* Interface pkt came in on */
+ vifi_t xmt_vif; /* Saved copy of imo_multicast_vif */
+#ifdef UPCALL_TIMING
+ struct timeval t; /* Timestamp */
+#endif /* UPCALL_TIMING */
};
#define MFCTBLSIZ 256
@@ -220,7 +230,7 @@ struct rtdetq {
#define MAX_UPQ 4 /* max. no of pkts in upcall Q */
/*
- * Token Bucket filter code
+ * Token Bucket filter code
*/
#define MAX_BKT_SIZE 10000 /* 10K bytes size */
#define MAXQSIZE 10 /* max # of pkts in queue */
@@ -228,7 +238,7 @@ struct rtdetq {
/*
* queue structure at each vif
*/
-struct pkt_queue
+struct pkt_queue
{
u_long pkt_len; /* length of packet in queue */
struct mbuf *pkt_m; /* pointer to packet mbuf */
@@ -246,7 +256,8 @@ struct tbf
u_long q_len; /* length of queue at this vif */
};
-extern int (*ip_mrouter_cmd) __P((int, struct socket *, struct mbuf *));
+extern int (*ip_mrouter_set) __P((int, struct socket *, struct mbuf *));
+extern int (*ip_mrouter_get) __P((int, struct socket *, struct mbuf **));
extern int (*ip_mrouter_done) __P((void));
extern int (*mrt_ioctl) __P((int, caddr_t, struct proc *));
OpenPOWER on IntegriCloud