mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-04 05:39:53 +00:00
PPP, CORE, IPv6, if_up flag used instead of if6_up for outgoing IPv6 packets, fixed
We can have an IPv6 only PPP interface, checking if6_up instead of if_up fixes IPv6 only setup. ppp_netif_output() which were only used for common code between ppp_netif_output_ip4() and ppp_netif_output_ip6() is not necessary anymore, removed, reducing call stack by one.
This commit is contained in:
parent
d6e1b86147
commit
30c89310a6
@ -180,7 +180,6 @@ static err_t ppp_netif_output_ip4(struct netif *netif, struct pbuf *pb, ip_addr_
|
||||
#if PPP_IPV6_SUPPORT
|
||||
static err_t ppp_netif_output_ip6(struct netif *netif, struct pbuf *pb, ip6_addr_t *ipaddr);
|
||||
#endif /* PPP_IPV6_SUPPORT */
|
||||
static err_t ppp_netif_output(struct netif *netif, struct pbuf *pb, u_short protocol);
|
||||
|
||||
/***********************************/
|
||||
/*** PUBLIC FUNCTION DEFINITIONS ***/
|
||||
@ -433,54 +432,46 @@ static err_t ppp_netif_init_cb(struct netif *netif) {
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/* Send a IPv4 packet on the given connection.
|
||||
/*
|
||||
* Send an IPv4 packet on the given connection.
|
||||
*/
|
||||
static err_t ppp_netif_output_ip4(struct netif *netif, struct pbuf *pb, ip_addr_t *ipaddr) {
|
||||
LWIP_UNUSED_ARG(ipaddr);
|
||||
return ppp_netif_output(netif, pb, PPP_IP);
|
||||
}
|
||||
|
||||
#if PPP_IPV6_SUPPORT
|
||||
/* Send a IPv6 packet on the given connection.
|
||||
*/
|
||||
static err_t ppp_netif_output_ip6(struct netif *netif, struct pbuf *pb, ip6_addr_t *ipaddr) {
|
||||
LWIP_UNUSED_ARG(ipaddr);
|
||||
return ppp_netif_output(netif, pb, PPP_IPV6);
|
||||
}
|
||||
#endif /* PPP_IPV6_SUPPORT */
|
||||
|
||||
/* Send a packet on the given connection.
|
||||
*
|
||||
* This is the low level function that send the PPP packet,
|
||||
* only for IPv4 and IPv6 packets coming from lwIP.
|
||||
*/
|
||||
static err_t ppp_netif_output(struct netif *netif, struct pbuf *pb, u_short protocol) {
|
||||
ppp_pcb *pcb = (ppp_pcb*)netif->state;
|
||||
|
||||
/* Validate parameters. */
|
||||
/* We let any protocol value go through - it can't hurt us
|
||||
* and the peer will just drop it if it's not accepting it. */
|
||||
if (!pcb || !pb) {
|
||||
PPPDEBUG(LOG_WARNING, ("ppp_netif_output[%d]: bad params prot=%d pb=%p\n",
|
||||
pcb->netif->num, PPP_IP, (void*)pb));
|
||||
LINK_STATS_INC(link.opterr);
|
||||
LINK_STATS_INC(link.drop);
|
||||
snmp_inc_ifoutdiscards(netif);
|
||||
return ERR_ARG;
|
||||
}
|
||||
LWIP_UNUSED_ARG(ipaddr);
|
||||
|
||||
/* Check that the link is up. */
|
||||
if (!pcb->if_up) {
|
||||
PPPDEBUG(LOG_ERR, ("ppp_netif_output[%d]: link not up\n", pcb->netif->num));
|
||||
PPPDEBUG(LOG_ERR, ("ppp_netif_output_ip4[%d]: link not up\n", pcb->netif->num));
|
||||
LINK_STATS_INC(link.rterr);
|
||||
LINK_STATS_INC(link.drop);
|
||||
snmp_inc_ifoutdiscards(netif);
|
||||
return ERR_RTE;
|
||||
}
|
||||
|
||||
return pcb->link_cb->netif_output(pcb, pcb->link_ctx_cb, pb, protocol);
|
||||
return pcb->link_cb->netif_output(pcb, pcb->link_ctx_cb, pb, PPP_IP);
|
||||
}
|
||||
|
||||
#if PPP_IPV6_SUPPORT
|
||||
/*
|
||||
* Send an IPv6 packet on the given connection.
|
||||
*/
|
||||
static err_t ppp_netif_output_ip6(struct netif *netif, struct pbuf *pb, ip6_addr_t *ipaddr) {
|
||||
ppp_pcb *pcb = (ppp_pcb*)netif->state;
|
||||
LWIP_UNUSED_ARG(ipaddr);
|
||||
|
||||
/* Check that the link is up. */
|
||||
if (!pcb->if6_up) {
|
||||
PPPDEBUG(LOG_ERR, ("ppp_netif_output_ip6[%d]: link not up\n", pcb->netif->num));
|
||||
LINK_STATS_INC(link.rterr);
|
||||
LINK_STATS_INC(link.drop);
|
||||
snmp_inc_ifoutdiscards(netif);
|
||||
return ERR_RTE;
|
||||
}
|
||||
|
||||
return pcb->link_cb->netif_output(pcb, pcb->link_ctx_cb, pb, PPP_IPV6);
|
||||
}
|
||||
#endif /* PPP_IPV6_SUPPORT */
|
||||
|
||||
|
||||
/************************************/
|
||||
/*** PRIVATE FUNCTION DEFINITIONS ***/
|
||||
|
Loading…
Reference in New Issue
Block a user