Author: melifaro Date: Sat Aug 8 15:58:35 2015 New Revision: 286452 URL: https://svnweb.freebsd.org/changeset/base/286452
Log: Simplify ip[6] simploop: Do not pass 'dst' sockaddr to ip[6]_mloopback: - We have explicit check for AF_INET in ip_output() - We assume ip header inside passed mbuf in ip_mloopback - We assume ip6 header inside passed mbuf in ip6_mloopback Modified: head/sys/netinet/ip_output.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/ip6_output.c head/sys/netinet6/ip6_var.h Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Sat Aug 8 15:51:29 2015 (r286451) +++ head/sys/netinet/ip_output.c Sat Aug 8 15:58:35 2015 (r286452) @@ -99,8 +99,7 @@ SYSCTL_INT(_net_inet_ip, OID_AUTO, mbuf_ &mbuf_frag_size, 0, "Fragment outgoing mbufs to this size"); #endif -static void ip_mloopback - (struct ifnet *, struct mbuf *, struct sockaddr_in *, int); +static void ip_mloopback(struct ifnet *, const struct mbuf *, int); extern int in_mcast_loop; @@ -446,7 +445,7 @@ again: * thus deferring a hash lookup and mutex acquisition * at the expense of a cheap copy using m_copym(). */ - ip_mloopback(ifp, m, dst, hlen); + ip_mloopback(ifp, m, hlen); } else { /* * If we are acting as a multicast router, perform @@ -1359,10 +1358,9 @@ ip_ctloutput(struct socket *so, struct s * replicating that code here. */ static void -ip_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in *dst, - int hlen) +ip_mloopback(struct ifnet *ifp, const struct mbuf *m, int hlen) { - register struct ip *ip; + struct ip *ip; struct mbuf *copym; /* @@ -1388,13 +1386,6 @@ ip_mloopback(struct ifnet *ifp, struct m ip = mtod(copym, struct ip *); ip->ip_sum = 0; ip->ip_sum = in_cksum(copym, hlen); -#if 1 /* XXX */ - if (dst->sin_family != AF_INET) { - printf("ip_mloopback: bad address family %d\n", - dst->sin_family); - dst->sin_family = AF_INET; - } -#endif - if_simloop(ifp, copym, dst->sin_family, 0); + if_simloop(ifp, copym, AF_INET, 0); } } Modified: head/sys/netinet6/ip6_mroute.c ============================================================================== --- head/sys/netinet6/ip6_mroute.c Sat Aug 8 15:51:29 2015 (r286451) +++ head/sys/netinet6/ip6_mroute.c Sat Aug 8 15:58:35 2015 (r286452) @@ -1583,15 +1583,8 @@ phyint_send(struct ip6_hdr *ip6, struct * If configured to loop back multicasts by default, * loop back a copy now. */ - if (in6_mcast_loop) { - struct sockaddr_in6 dst6; - - bzero(&dst6, sizeof(dst6)); - dst6.sin6_len = sizeof(struct sockaddr_in6); - dst6.sin6_family = AF_INET6; - dst6.sin6_addr = ip6->ip6_dst; - ip6_mloopback(ifp, m, &dst6); - } + if (in6_mcast_loop) + ip6_mloopback(ifp, m); /* * Put the packet into the sending queue of the outgoing interface Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sat Aug 8 15:51:29 2015 (r286451) +++ head/sys/netinet6/ip6_output.c Sat Aug 8 15:58:35 2015 (r286452) @@ -662,7 +662,7 @@ again: * thus deferring a hash lookup and lock acquisition * at the expense of an m_copym(). */ - ip6_mloopback(ifp, m, dst); + ip6_mloopback(ifp, m); } else { /* * If we are acting as a multicast router, perform @@ -2883,7 +2883,7 @@ ip6_setpktopt(int optname, u_char *buf, * pointer that might NOT be &loif -- easier than replicating that code here. */ void -ip6_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in6 *dst) +ip6_mloopback(struct ifnet *ifp, const struct mbuf *m) { struct mbuf *copym; struct ip6_hdr *ip6; @@ -2915,7 +2915,7 @@ ip6_mloopback(struct ifnet *ifp, struct CSUM_PSEUDO_HDR; copym->m_pkthdr.csum_data = 0xffff; } - (void)if_simloop(ifp, copym, dst->sin6_family, 0); + if_simloop(ifp, copym, AF_INET6, 0); } /* Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Sat Aug 8 15:51:29 2015 (r286451) +++ head/sys/netinet6/ip6_var.h Sat Aug 8 15:58:35 2015 (r286452) @@ -373,7 +373,7 @@ int ip6_sysctl(int *, u_int, void *, siz void ip6_forward(struct mbuf *, int); -void ip6_mloopback(struct ifnet *, struct mbuf *, struct sockaddr_in6 *); +void ip6_mloopback(struct ifnet *, const struct mbuf *); int ip6_output(struct mbuf *, struct ip6_pktopts *, struct route_in6 *, int, _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"