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

Collapse All | Expand All

(-)sys/netinet/ip_divert.c (-2 / +22 lines)
Lines 317-322 div_output(struct socket *so, struct mbuf *m, stru Link Here
317
    struct mbuf *control)
317
    struct mbuf *control)
318
{
318
{
319
	struct ip *const ip = mtod(m, struct ip *);
319
	struct ip *const ip = mtod(m, struct ip *);
320
	struct ifaddr *ifa;
320
	struct m_tag *mtag;
321
	struct m_tag *mtag;
321
	struct ipfw_rule_ref *dt;
322
	struct ipfw_rule_ref *dt;
322
	int error = 0;
323
	int error = 0;
Lines 471-478 div_output(struct socket *so, struct mbuf *m, stru Link Here
471
			 * Clear the port and the ifname to make sure
472
			 * Clear the port and the ifname to make sure
472
			 * there are no distractions for ifa_ifwithaddr.
473
			 * there are no distractions for ifa_ifwithaddr.
473
			 */
474
			 */
474
			struct	ifaddr *ifa;
475
476
			bzero(sin->sin_zero, sizeof(sin->sin_zero));
475
			bzero(sin->sin_zero, sizeof(sin->sin_zero));
477
			sin->sin_port = 0;
476
			sin->sin_port = 0;
478
			ifa = ifa_ifwithaddr((struct sockaddr *) sin);
477
			ifa = ifa_ifwithaddr((struct sockaddr *) sin);
Lines 489-494 div_output(struct socket *so, struct mbuf *m, stru Link Here
489
		/* Send packet to input processing via netisr */
488
		/* Send packet to input processing via netisr */
490
		switch (ip->ip_v) {
489
		switch (ip->ip_v) {
491
		case IPVERSION:
490
		case IPVERSION:
491
			if (!(m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST)) {
492
				netisr_queue_src(NETISR_IP, (uintptr_t)so, m);
493
				break;
494
			}
495
			/*
496
			 * Set M_BCAST flag when destination address is
497
			 * broadcast. It is expected by ip_tryforward().
498
			 */
499
			if_addr_rlock(m->m_pkthdr.rcvif);
500
			TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrhead,
501
			    ifa_link) {
502
				if (ifa->ifa_addr->sa_family != AF_INET)
503
					continue;
504
				if (satosin(&ifatoia(
505
				    ifa)->ia_broadaddr)->sin_addr.s_addr ==
506
				    ip->ip_dst.s_addr) {
507
					m->m_flags |= M_BCAST;
508
					break;
509
				}
510
			}
511
			if_addr_runlock(m->m_pkthdr.rcvif);
492
			netisr_queue_src(NETISR_IP, (uintptr_t)so, m);
512
			netisr_queue_src(NETISR_IP, (uintptr_t)so, m);
493
			break;
513
			break;
494
#ifdef INET6
514
#ifdef INET6

Return to bug 209491