mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-29 00:32:51 +00:00
Minor cleanup and documentation updates
This commit is contained in:
parent
e835707814
commit
676dd74140
@ -235,7 +235,10 @@ raw_bind(struct raw_pcb *pcb, const ip_addr_t *ipaddr)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup raw_raw
|
* @ingroup raw_raw
|
||||||
* Bind a RAW PCB.
|
* Bind an RAW PCB to a specific netif.
|
||||||
|
* After calling this function, all packets received via this PCB
|
||||||
|
* are guaranteed to have come in via the specified netif, and all
|
||||||
|
* outgoing packets will go out via the specified netif.
|
||||||
*
|
*
|
||||||
* @param pcb RAW PCB to be bound with netif.
|
* @param pcb RAW PCB to be bound with netif.
|
||||||
* @param netif netif to bind to. Can be NULL.
|
* @param netif netif to bind to. Can be NULL.
|
||||||
|
@ -643,6 +643,9 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
|
|||||||
/**
|
/**
|
||||||
* @ingroup tcp_raw
|
* @ingroup tcp_raw
|
||||||
* Binds the connection to a netif and IP address.
|
* Binds the connection to a netif and IP address.
|
||||||
|
* After calling this function, all packets received via this PCB
|
||||||
|
* are guaranteed to have come in via the specified netif, and all
|
||||||
|
* outgoing packets will go out via the specified netif.
|
||||||
*
|
*
|
||||||
* @param pcb the tcp_pcb to bind.
|
* @param pcb the tcp_pcb to bind.
|
||||||
* @param netif the netif to bind to. Can be NULL.
|
* @param netif the netif to bind to. Can be NULL.
|
||||||
@ -926,21 +929,18 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
|
|||||||
/* check if we have a route to the remote host */
|
/* check if we have a route to the remote host */
|
||||||
netif = ip_route(&pcb->local_ip, &pcb->remote_ip);
|
netif = ip_route(&pcb->local_ip, &pcb->remote_ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (netif == NULL) {
|
if (netif == NULL) {
|
||||||
/* Don't even try to send a SYN packet if we have no route since that will fail. */
|
/* Don't even try to send a SYN packet if we have no route since that will fail. */
|
||||||
return ERR_RTE;
|
return ERR_RTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check if local IP has been assigned to pcb, if not, get one */
|
||||||
if (ip_addr_isany(&pcb->local_ip)) {
|
if (ip_addr_isany(&pcb->local_ip)) {
|
||||||
/* no local IP address set, yet. */
|
|
||||||
const ip_addr_t *local_ip = ip_netif_get_local_ip(netif, ipaddr);
|
const ip_addr_t *local_ip = ip_netif_get_local_ip(netif, ipaddr);
|
||||||
if (local_ip != NULL) {
|
if (local_ip == NULL) {
|
||||||
/* Use the address as local address of the pcb. */
|
|
||||||
ip_addr_copy(pcb->local_ip, *local_ip);
|
|
||||||
} else {
|
|
||||||
return ERR_RTE;
|
return ERR_RTE;
|
||||||
}
|
}
|
||||||
|
ip_addr_copy(pcb->local_ip, *local_ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LWIP_IPV6 && LWIP_IPV6_SCOPES
|
#if LWIP_IPV6 && LWIP_IPV6_SCOPES
|
||||||
|
@ -1007,6 +1007,9 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
|
|||||||
/**
|
/**
|
||||||
* @ingroup udp_raw
|
* @ingroup udp_raw
|
||||||
* Bind an UDP PCB to a specific netif.
|
* Bind an UDP PCB to a specific netif.
|
||||||
|
* After calling this function, all packets received via this PCB
|
||||||
|
* are guaranteed to have come in via the specified netif, and all
|
||||||
|
* outgoing packets will go out via the specified netif.
|
||||||
*
|
*
|
||||||
* @param pcb UDP PCB to be bound.
|
* @param pcb UDP PCB to be bound.
|
||||||
* @param netif netif to bind udp pcb to. Can be NULL.
|
* @param netif netif to bind udp pcb to. Can be NULL.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user