View | Details | Raw Unified | Return to bug 209491 | Differences between
and this patch

Collapse All | Expand All

(-)sys/netinet/ip_divert.c (+33 lines)
Lines 464-469 div_output(struct socket *so, struct mbu Link Here
464
		if (options != NULL)
464
		if (options != NULL)
465
			m_freem(options);
465
			m_freem(options);
466
	} else {
466
	} else {
467
		struct ifnet *ifp;
468
467
		dt->info |= IPFW_IS_DIVERT | IPFW_INFO_IN;
469
		dt->info |= IPFW_IS_DIVERT | IPFW_INFO_IN;
468
		if (m->m_pkthdr.rcvif == NULL) {
470
		if (m->m_pkthdr.rcvif == NULL) {
469
			/*
471
			/*
Lines 483-488 div_output(struct socket *so, struct mbu Link Here
483
			m->m_pkthdr.rcvif = ifa->ifa_ifp;
485
			m->m_pkthdr.rcvif = ifa->ifa_ifp;
484
			ifa_free(ifa);
486
			ifa_free(ifa);
485
		}
487
		}
488
489
		/*
490
		 * ip_input() can pass the packet to ip_tryforward()
491
		 * that expects broadcasts to have M_BCAST flag.
492
		 * Really bad things happen if incoming broadcast misses it.
493
		 * The same applies for multicasts.
494
		 * Restoration of M_BCAST is expensive, so do it here.
495
		 */
496
497
		ifp = m->m_pkthdr.rcvif;
498
		switch (ip->ip_v) {
499
#ifdef INET
500
		case IPVERSION:
501
			if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)))
502
				m->m_flags |= M_MCAST;
503
			else if (in_broadcast(ip->ip_dst, ifp))
504
				m->m_flags |= M_BCAST;
505
			break;
506
#endif
507
508
#ifdef INET6
509
		case IPV6_VERSION >> 4:
510
			struct ip6_hdr *ip6;
511
512
			ip6 = mtod(m, struct ip6_hdr *);
513
			if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst))
514
				m->m_flags |= M_MCAST;
515
			break;
516
#endif
517
		}
518
486
#ifdef MAC
519
#ifdef MAC
487
		mac_socket_create_mbuf(so, m);
520
		mac_socket_create_mbuf(so, m);
488
#endif
521
#endif

Return to bug 209491