Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/ip_output.c
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | |||||
#include <netinet/in_systm.h> | #include <netinet/in_systm.h> | ||||
#include <netinet/ip.h> | #include <netinet/ip.h> | ||||
#include <netinet/in_fib.h> | #include <netinet/in_fib.h> | ||||
#include <netinet/in_pcb.h> | #include <netinet/in_pcb.h> | ||||
#include <netinet/in_rss.h> | #include <netinet/in_rss.h> | ||||
#include <netinet/in_var.h> | #include <netinet/in_var.h> | ||||
#include <netinet/ip_var.h> | #include <netinet/ip_var.h> | ||||
#include <netinet/ip_options.h> | #include <netinet/ip_options.h> | ||||
#include <netinet/ip_mroute.h> | |||||
#include <netinet/udp.h> | #include <netinet/udp.h> | ||||
#include <netinet/udp_var.h> | #include <netinet/udp_var.h> | ||||
#if defined(SCTP) || defined(SCTP_SUPPORT) | #if defined(SCTP) || defined(SCTP_SUPPORT) | ||||
#include <netinet/sctp.h> | #include <netinet/sctp.h> | ||||
#include <netinet/sctp_crc32.h> | #include <netinet/sctp_crc32.h> | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* In the IP forwarding case, the packet will arrive with options already | * In the IP forwarding case, the packet will arrive with options already | ||||
* inserted, so must have a NULL opt pointer. | * inserted, so must have a NULL opt pointer. | ||||
*/ | */ | ||||
int | int | ||||
ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, | ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, | ||||
struct ip_moptions *imo, struct inpcb *inp) | struct ip_moptions *imo, struct inpcb *inp) | ||||
{ | { | ||||
MROUTER_RLOCK_TRACKER; | |||||
struct rm_priotracker in_ifa_tracker; | struct rm_priotracker in_ifa_tracker; | ||||
struct ip *ip; | struct ip *ip; | ||||
struct ifnet *ifp = NULL; /* keep compiler happy */ | struct ifnet *ifp = NULL; /* keep compiler happy */ | ||||
struct mbuf *m0; | struct mbuf *m0; | ||||
int hlen = sizeof (struct ip); | int hlen = sizeof (struct ip); | ||||
int mtu = 0; | int mtu = 0; | ||||
int error = 0; | int error = 0; | ||||
int vlan_pcp = -1; | int vlan_pcp = -1; | ||||
▲ Show 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | if ((imo == NULL && in_mcast_loop) || | ||||
* to send. The multicast forwarding function | * to send. The multicast forwarding function | ||||
* recursively calls this function, using the | * recursively calls this function, using the | ||||
* IP_FORWARDING flag to prevent infinite recursion. | * IP_FORWARDING flag to prevent infinite recursion. | ||||
* | * | ||||
* Multicasts that are looped back by ip_mloopback(), | * Multicasts that are looped back by ip_mloopback(), | ||||
* above, will be forwarded by the ip_input() routine, | * above, will be forwarded by the ip_input() routine, | ||||
* if necessary. | * if necessary. | ||||
*/ | */ | ||||
MROUTER_RLOCK(); | |||||
if (V_ip_mrouter && (flags & IP_FORWARDING) == 0) { | if (V_ip_mrouter && (flags & IP_FORWARDING) == 0) { | ||||
/* | /* | ||||
* If rsvp daemon is not running, do not | * If rsvp daemon is not running, do not | ||||
* set ip_moptions. This ensures that the packet | * set ip_moptions. This ensures that the packet | ||||
* is multicast and not just sent down one link | * is multicast and not just sent down one link | ||||
* as prescribed by rsvpd. | * as prescribed by rsvpd. | ||||
*/ | */ | ||||
if (!V_rsvp_on) | if (!V_rsvp_on) | ||||
imo = NULL; | imo = NULL; | ||||
if (ip_mforward && | if (ip_mforward && | ||||
ip_mforward(ip, ifp, m, imo) != 0) { | ip_mforward(ip, ifp, m, imo) != 0) { | ||||
MROUTER_RUNLOCK(); | |||||
m_freem(m); | m_freem(m); | ||||
goto done; | goto done; | ||||
} | } | ||||
} | } | ||||
MROUTER_RUNLOCK(); | |||||
} | } | ||||
/* | /* | ||||
* Multicasts with a time-to-live of zero may be looped- | * Multicasts with a time-to-live of zero may be looped- | ||||
* back, above, but must not be transmitted on a network. | * back, above, but must not be transmitted on a network. | ||||
* Also, multicasts addressed to the loopback interface | * Also, multicasts addressed to the loopback interface | ||||
* are not sent -- the above call to ip_mloopback() will | * are not sent -- the above call to ip_mloopback() will | ||||
* loop back a copy. ip_input() will drop the copy if | * loop back a copy. ip_input() will drop the copy if | ||||
▲ Show 20 Lines • Show All 990 Lines • Show Last 20 Lines |