summaryrefslogtreecommitdiffstats
path: root/sys/netinet/raw_ip.c
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2002-11-15 22:53:53 +0000
committerluigi <luigi@FreeBSD.org>2002-11-15 22:53:53 +0000
commit60e892bf319d72d9b1ee2c14488fa30da0195da3 (patch)
tree3749705a7135b04736f5f3cc35c85e50866bc963 /sys/netinet/raw_ip.c
parent5044bd9ace87bfc9ba423a4ea2003b64b244ba2c (diff)
downloadFreeBSD-src-60e892bf319d72d9b1ee2c14488fa30da0195da3.zip
FreeBSD-src-60e892bf319d72d9b1ee2c14488fa30da0195da3.tar.gz
Massive cleanup of the ip_mroute code.
No functional changes, but: + the mrouting module now should behave the same as the compiled-in version (it did not before, some of the rsvp code was not loaded properly); + netinet/ip_mroute.c is now truly optional; + removed some redundant/unused code; + changed many instances of '0' to NULL and INADDR_ANY as appropriate; + removed several static variables to make the code more SMP-friendly; + fixed some minor bugs in the mrouting code (mostly, incorrect return values from functions). This commit is also a prerequisite to the addition of support for PIM, which i would like to put in before DP2 (it does not change any of the existing APIs, anyways). Note, in the process we found out that some device drivers fail to properly handle changes in IFF_ALLMULTI, leading to interesting behaviour when a multicast router is started. This bug is not corrected by this commit, and will be fixed with a separate commit. Detailed changes: -------------------- netinet/ip_mroute.c all the above. conf/files make ip_mroute.c optional net/route.c fix mrt_ioctl hook netinet/ip_input.c fix ip_mforward hook, move rsvp_input() here together with other rsvp code, and a couple of indentation fixes. netinet/ip_output.c fix ip_mforward and ip_mcast_src hooks netinet/ip_var.h rsvp function hooks netinet/raw_ip.c hooks for mrouting and rsvp functions, plus interface cleanup. netinet/ip_mroute.h remove an unused and optional field from a struct Most of the code is from Pavlin Radoslavov and the XORP project Reviewed by: sam MFC after: 1 week
Diffstat (limited to 'sys/netinet/raw_ip.c')
-rw-r--r--sys/netinet/raw_ip.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index f435d97..8599a1b 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -86,6 +86,28 @@ ip_fw_ctl_t *ip_fw_ctl_ptr;
ip_dn_ctl_t *ip_dn_ctl_ptr;
/*
+ * hooks for multicast routing. They all default to NULL,
+ * so leave them not initialized and rely on BSS being set to 0.
+ */
+
+/* The socket used to communicate with the multicast routing daemon. */
+struct socket *ip_mrouter;
+
+/* The various mrouter and rsvp functions */
+int (*ip_mrouter_set)(struct socket *, struct sockopt *);
+int (*ip_mrouter_get)(struct socket *, struct sockopt *);
+int (*ip_mrouter_done)(void);
+int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
+ struct ip_moptions *);
+int (*mrt_ioctl)(int, caddr_t);
+int (*legal_vif_num)(int);
+u_long (*ip_mcast_src)(int);
+
+void (*rsvp_input_p)(struct mbuf *m, int off);
+int (*ip_rsvp_vif)(struct socket *, struct sockopt *);
+void (*ip_rsvp_force_done)(struct socket *);
+
+/*
* Nominal space allocated to a raw ip socket.
*/
#define RIPSNDQ 8192
@@ -351,7 +373,8 @@ rip_ctloutput(so, sopt)
case MRT_DEL_MFC:
case MRT_VERSION:
case MRT_ASSERT:
- error = ip_mrouter_get(so, sopt);
+ error = ip_mrouter_get ? ip_mrouter_get(so, sopt) :
+ EOPNOTSUPP;
break;
default:
@@ -401,13 +424,10 @@ rip_ctloutput(so, sopt)
error = ip_rsvp_done();
break;
- /* XXX - should be combined */
case IP_RSVP_VIF_ON:
- error = ip_rsvp_vif_init(so, sopt);
- break;
-
case IP_RSVP_VIF_OFF:
- error = ip_rsvp_vif_done(so, sopt);
+ error = ip_rsvp_vif ?
+ ip_rsvp_vif(so, sopt) : EINVAL;
break;
case MRT_INIT:
@@ -418,7 +438,8 @@ rip_ctloutput(so, sopt)
case MRT_DEL_MFC:
case MRT_VERSION:
case MRT_ASSERT:
- error = ip_mrouter_set(so, sopt);
+ error = ip_mrouter_set ? ip_mrouter_set(so, sopt) :
+ EOPNOTSUPP;
break;
default:
@@ -546,9 +567,10 @@ rip_detach(struct socket *so)
inp = sotoinpcb(so);
if (inp == 0)
panic("rip_detach");
- if (so == ip_mrouter)
+ if (so == ip_mrouter && ip_mrouter_done)
ip_mrouter_done();
- ip_rsvp_force_done(so);
+ if (ip_rsvp_force_done)
+ ip_rsvp_force_done(so);
if (so == ip_rsvpd)
ip_rsvp_done();
in_pcbdetach(inp);
OpenPOWER on IntegriCloud