Module Name:    src
Committed By:   christos
Date:           Sat Oct 11 21:12:51 UTC 2014

Modified Files:
        src/sys/netinet: ip_output.c ip_var.h

Log Message:
exposet multicast option functions which are used by the v6 code now.


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.106 -r1.107 src/sys/netinet/ip_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.230 src/sys/netinet/ip_output.c:1.231
--- src/sys/netinet/ip_output.c:1.230	Thu Jun  5 20:11:19 2014
+++ src/sys/netinet/ip_output.c	Sat Oct 11 17:12:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.230 2014/06/06 00:11:19 rmind Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.231 2014/10/11 21:12:51 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.230 2014/06/06 00:11:19 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.231 2014/10/11 21:12:51 christos Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -136,8 +136,6 @@ static struct mbuf *ip_insertoptions(str
 static struct ifnet *ip_multicast_if(struct in_addr *, int *);
 static void ip_mloopback(struct ifnet *, struct mbuf *,
     const struct sockaddr_in *);
-static int ip_setmoptions(struct inpcb *, const struct sockopt *);
-static int ip_getmoptions(struct inpcb *, struct sockopt *);
 
 extern pfil_head_t *inet_pfil_hook;			/* XXX */
 
@@ -1003,7 +1001,7 @@ ip_ctloutput(int op, struct socket *so, 
 		case IP_MULTICAST_LOOP:
 		case IP_ADD_MEMBERSHIP:
 		case IP_DROP_MEMBERSHIP:
-			error = ip_setmoptions(inp, sopt);
+			error = ip_setmoptions(&inp->inp_moptions, sopt);
 			break;
 
 		case IP_PORTRANGE:
@@ -1151,7 +1149,7 @@ ip_ctloutput(int op, struct socket *so, 
 		case IP_MULTICAST_LOOP:
 		case IP_ADD_MEMBERSHIP:
 		case IP_DROP_MEMBERSHIP:
-			error = ip_getmoptions(inp, sopt);
+			error = ip_getmoptions(inp->inp_moptions, sopt);
 			break;
 
 		case IP_PORTRANGE:
@@ -1364,10 +1362,10 @@ ip_getoptval(const struct sockopt *sopt,
 /*
  * Set the IP multicast options in response to user setsockopt().
  */
-static int
-ip_setmoptions(struct inpcb *inp, const struct sockopt *sopt)
+int
+ip_setmoptions(struct ip_moptions **pimo, const struct sockopt *sopt)
 {
-	struct ip_moptions *imo = inp->inp_moptions;
+	struct ip_moptions *imo = *pimo;
 	struct in_addr addr;
 	struct ip_mreq lmreq, *mreq;
 	struct ifnet *ifp;
@@ -1387,7 +1385,7 @@ ip_setmoptions(struct inpcb *inp, const 
 		imo->imo_multicast_ttl = IP_DEFAULT_MULTICAST_TTL;
 		imo->imo_multicast_loop = IP_DEFAULT_MULTICAST_LOOP;
 		imo->imo_num_memberships = 0;
-		inp->inp_moptions = imo;
+		*pimo = imo;
 	}
 
 	switch (sopt->sopt_name) {
@@ -1583,7 +1581,7 @@ ip_setmoptions(struct inpcb *inp, const 
 	    imo->imo_multicast_loop == IP_DEFAULT_MULTICAST_LOOP &&
 	    imo->imo_num_memberships == 0) {
 		kmem_free(imo, sizeof(*imo));
-		inp->inp_moptions = NULL;
+		*pimo = NULL;
 	}
 
 	return error;
@@ -1592,10 +1590,9 @@ ip_setmoptions(struct inpcb *inp, const 
 /*
  * Return the IP multicast options in response to user getsockopt().
  */
-static int
-ip_getmoptions(struct inpcb *inp, struct sockopt *sopt)
+int
+ip_getmoptions(struct ip_moptions *imo, struct sockopt *sopt)
 {
-	struct ip_moptions *imo = inp->inp_moptions;
 	struct in_addr addr;
 	struct in_ifaddr *ia;
 	uint8_t optval;

Index: src/sys/netinet/ip_var.h
diff -u src/sys/netinet/ip_var.h:1.106 src/sys/netinet/ip_var.h:1.107
--- src/sys/netinet/ip_var.h:1.106	Thu Jun  5 19:48:16 2014
+++ src/sys/netinet/ip_var.h	Sat Oct 11 17:12:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_var.h,v 1.106 2014/06/05 23:48:16 rmind Exp $	*/
+/*	$NetBSD: ip_var.h,v 1.107 2014/10/11 21:12:51 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -234,6 +234,9 @@ int	 rip_output(struct mbuf *, ...);
 int	 rip_usrreq(struct socket *,
 	    int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *);
 
+int	ip_setmoptions(struct ip_moptions **, const struct sockopt *sopt);
+int	ip_getmoptions(struct ip_moptions *, struct sockopt *sopt);
+
 /* IP Flow interface. */
 void	ipflow_init(void);
 void	ipflow_poolinit(void);

Reply via email to