mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-10 12:39:55 +00:00
Kieran Mansley - kjm25@cam.ac.uk - 23rd March 2003
- Changed all #ifdef SO_REUSE into #if SO_REUSE
This commit is contained in:
parent
6f7c8fb355
commit
2c8aa6f6f4
@ -1079,7 +1079,7 @@ int lwip_getsockopt (int s, int level, int optname, void *optval, socklen_t *opt
|
|||||||
/* UNIMPL case SO_DONTROUTE: */
|
/* UNIMPL case SO_DONTROUTE: */
|
||||||
case SO_KEEPALIVE:
|
case SO_KEEPALIVE:
|
||||||
/* UNIMPL case SO_OOBINCLUDE: */
|
/* UNIMPL case SO_OOBINCLUDE: */
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
case SO_REUSEADDR:
|
case SO_REUSEADDR:
|
||||||
case SO_REUSEPORT:
|
case SO_REUSEPORT:
|
||||||
#endif /* SO_REUSE */
|
#endif /* SO_REUSE */
|
||||||
@ -1182,7 +1182,7 @@ int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_
|
|||||||
/* UNIMPL case SO_SNDBUF: */
|
/* UNIMPL case SO_SNDBUF: */
|
||||||
/* UNIMPL case SO_RCVLOWAT: */
|
/* UNIMPL case SO_RCVLOWAT: */
|
||||||
/* UNIMPL case SO_SNDLOWAT: */
|
/* UNIMPL case SO_SNDLOWAT: */
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
case SO_REUSEADDR:
|
case SO_REUSEADDR:
|
||||||
case SO_REUSEPORT:
|
case SO_REUSEPORT:
|
||||||
#endif /* SO_REUSE */
|
#endif /* SO_REUSE */
|
||||||
@ -1264,7 +1264,7 @@ int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_
|
|||||||
/* UNIMPL case SO_DONTROUTE: */
|
/* UNIMPL case SO_DONTROUTE: */
|
||||||
case SO_KEEPALIVE:
|
case SO_KEEPALIVE:
|
||||||
/* UNIMPL case SO_OOBINCLUDE: */
|
/* UNIMPL case SO_OOBINCLUDE: */
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
case SO_REUSEADDR:
|
case SO_REUSEADDR:
|
||||||
case SO_REUSEPORT:
|
case SO_REUSEPORT:
|
||||||
#endif /* SO_REUSE */
|
#endif /* SO_REUSE */
|
||||||
|
@ -251,7 +251,8 @@ tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
|||||||
if (port == 0) {
|
if (port == 0) {
|
||||||
port = tcp_new_port();
|
port = tcp_new_port();
|
||||||
}
|
}
|
||||||
#ifndef SO_REUSE
|
#if SO_REUSE
|
||||||
|
#else
|
||||||
/* Check if the address already is in use. */
|
/* Check if the address already is in use. */
|
||||||
for(cpcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs;
|
for(cpcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs;
|
||||||
cpcb != NULL; cpcb = cpcb->next) {
|
cpcb != NULL; cpcb = cpcb->next) {
|
||||||
|
@ -175,7 +175,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
for an active connection. */
|
for an active connection. */
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
|
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
pcb_temp = tcp_active_pcbs;
|
pcb_temp = tcp_active_pcbs;
|
||||||
|
|
||||||
again_1:
|
again_1:
|
||||||
@ -193,7 +193,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src)) &&
|
ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src)) &&
|
||||||
ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest))) {
|
ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest))) {
|
||||||
|
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
if(pcb->so_options & SOF_REUSEPORT) {
|
if(pcb->so_options & SOF_REUSEPORT) {
|
||||||
if(reuse) {
|
if(reuse) {
|
||||||
/* We processed one PCB already */
|
/* We processed one PCB already */
|
||||||
@ -363,7 +363,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
tcp_debug_print_state(pcb->state);
|
tcp_debug_print_state(pcb->state);
|
||||||
#endif /* TCP_DEBUG */
|
#endif /* TCP_DEBUG */
|
||||||
#endif /* TCP_INPUT_DEBUG */
|
#endif /* TCP_INPUT_DEBUG */
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
/* First socket should receive now */
|
/* First socket should receive now */
|
||||||
if(reuse_port) {
|
if(reuse_port) {
|
||||||
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: searching next PCB.\n"));
|
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: searching next PCB.\n"));
|
||||||
@ -375,7 +375,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
#endif /* SO_REUSE */
|
#endif /* SO_REUSE */
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
if(reuse) {
|
if(reuse) {
|
||||||
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: freeing PBUF with reference counter set to %i\n", p->ref));
|
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: freeing PBUF with reference counter set to %i\n", p->ref));
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
@ -394,7 +394,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
}
|
}
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
}
|
}
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
end:
|
end:
|
||||||
#endif /* SO_REUSE */
|
#endif /* SO_REUSE */
|
||||||
LWIP_ASSERT("tcp_input: tcp_pcbs_sane()", tcp_pcbs_sane());
|
LWIP_ASSERT("tcp_input: tcp_pcbs_sane()", tcp_pcbs_sane());
|
||||||
|
@ -128,7 +128,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
ip4_addr1(&iphdr->src), ip4_addr2(&iphdr->src),
|
ip4_addr1(&iphdr->src), ip4_addr2(&iphdr->src),
|
||||||
ip4_addr3(&iphdr->src), ip4_addr4(&iphdr->src), ntohs(udphdr->src)));
|
ip4_addr3(&iphdr->src), ip4_addr4(&iphdr->src), ntohs(udphdr->src)));
|
||||||
|
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
pcb_temp = udp_pcbs;
|
pcb_temp = udp_pcbs;
|
||||||
|
|
||||||
again_1:
|
again_1:
|
||||||
@ -158,7 +158,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
(ip_addr_isany(&pcb->local_ip) ||
|
(ip_addr_isany(&pcb->local_ip) ||
|
||||||
/* PCB local IP address matches UDP destination IP address? */
|
/* PCB local IP address matches UDP destination IP address? */
|
||||||
ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest)))) {
|
ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest)))) {
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
if(pcb->so_options & SOF_REUSEPORT) {
|
if(pcb->so_options & SOF_REUSEPORT) {
|
||||||
if(reuse) {
|
if(reuse) {
|
||||||
/* We processed one PCB already */
|
/* We processed one PCB already */
|
||||||
@ -187,7 +187,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
/* Iterate through the UDP PCB list for a pcb that matches
|
/* Iterate through the UDP PCB list for a pcb that matches
|
||||||
the local address. */
|
the local address. */
|
||||||
|
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
pcb_temp = udp_pcbs;
|
pcb_temp = udp_pcbs;
|
||||||
|
|
||||||
again_2:
|
again_2:
|
||||||
@ -209,7 +209,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
(ip_addr_isany(&pcb->local_ip) ||
|
(ip_addr_isany(&pcb->local_ip) ||
|
||||||
/* ...matching interface address? */
|
/* ...matching interface address? */
|
||||||
ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest)))) {
|
ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest)))) {
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
if(pcb->so_options & SOF_REUSEPORT) {
|
if(pcb->so_options & SOF_REUSEPORT) {
|
||||||
if(reuse) {
|
if(reuse) {
|
||||||
/* We processed one PCB already */
|
/* We processed one PCB already */
|
||||||
@ -279,7 +279,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
if (pcb != NULL) {
|
if (pcb != NULL) {
|
||||||
snmp_inc_udpindatagrams();
|
snmp_inc_udpindatagrams();
|
||||||
pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src), src);
|
pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src), src);
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
/* First socket should receive now */
|
/* First socket should receive now */
|
||||||
if(reuse_port_1 || reuse_port_2) {
|
if(reuse_port_1 || reuse_port_2) {
|
||||||
/* We want to search on next socket after receiving */
|
/* We want to search on next socket after receiving */
|
||||||
@ -299,7 +299,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
}
|
}
|
||||||
#endif /* SO_REUSE */
|
#endif /* SO_REUSE */
|
||||||
} else {
|
} else {
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
if(reuse) {
|
if(reuse) {
|
||||||
LWIP_DEBUGF(UDP_DEBUG, ("udp_input: freeing PBUF with reference counter set to %i\n", p->ref));
|
LWIP_DEBUGF(UDP_DEBUG, ("udp_input: freeing PBUF with reference counter set to %i\n", p->ref));
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
@ -517,7 +517,7 @@ udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
|||||||
{
|
{
|
||||||
struct udp_pcb *ipcb;
|
struct udp_pcb *ipcb;
|
||||||
u8_t rebind;
|
u8_t rebind;
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
int reuse_port_all_set = 1;
|
int reuse_port_all_set = 1;
|
||||||
#endif /* SO_REUSE */
|
#endif /* SO_REUSE */
|
||||||
LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_bind(ipaddr = "));
|
LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_bind(ipaddr = "));
|
||||||
@ -535,7 +535,8 @@ udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
|||||||
rebind = 1;
|
rebind = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SO_REUSE
|
#if SO_REUSE
|
||||||
|
#else
|
||||||
/* this code does not allow upper layer to share a UDP port for
|
/* this code does not allow upper layer to share a UDP port for
|
||||||
listening to broadcast or multicast traffic (See SO_REUSE_ADDR and
|
listening to broadcast or multicast traffic (See SO_REUSE_ADDR and
|
||||||
SO_REUSE_PORT under *BSD). TODO: See where it fits instead, OR
|
SO_REUSE_PORT under *BSD). TODO: See where it fits instead, OR
|
||||||
@ -589,7 +590,7 @@ udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SO_REUSE
|
#if SO_REUSE
|
||||||
/* If SOF_REUSEPORT isn't set in all PCB's bound to specified port and local address specified then
|
/* If SOF_REUSEPORT isn't set in all PCB's bound to specified port and local address specified then
|
||||||
{IP, port} can't be reused. */
|
{IP, port} can't be reused. */
|
||||||
if(!reuse_port_all_set) {
|
if(!reuse_port_all_set) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user