mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 21:44:38 +08:00
Slipif: fixed IPv6 support
This commit is contained in:
parent
c5203ab5ea
commit
78f0307246
@ -108,11 +108,10 @@ struct slipif_priv {
|
|||||||
*
|
*
|
||||||
* @param netif the lwip network interface structure for this slipif
|
* @param netif the lwip network interface structure for this slipif
|
||||||
* @param p the pbuf chaing packet to send
|
* @param p the pbuf chaing packet to send
|
||||||
* @param ipaddr the ip address to send the packet to (not used for slipif)
|
|
||||||
* @return always returns ERR_OK since the serial layer does not provide return values
|
* @return always returns ERR_OK since the serial layer does not provide return values
|
||||||
*/
|
*/
|
||||||
err_t
|
static err_t
|
||||||
slipif_output(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr)
|
slipif_output(struct netif *netif, struct pbuf *p)
|
||||||
{
|
{
|
||||||
struct slipif_priv *priv;
|
struct slipif_priv *priv;
|
||||||
struct pbuf *q;
|
struct pbuf *q;
|
||||||
@ -123,8 +122,6 @@ slipif_output(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr)
|
|||||||
LWIP_ASSERT("netif->state != NULL", (netif->state != NULL));
|
LWIP_ASSERT("netif->state != NULL", (netif->state != NULL));
|
||||||
LWIP_ASSERT("p != NULL", (p != NULL));
|
LWIP_ASSERT("p != NULL", (p != NULL));
|
||||||
|
|
||||||
LWIP_UNUSED_ARG(ipaddr);
|
|
||||||
|
|
||||||
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_output(%"U16_F"): sending %"U16_F" bytes\n", (u16_t)netif->num, p->tot_len));
|
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_output(%"U16_F"): sending %"U16_F" bytes\n", (u16_t)netif->num, p->tot_len));
|
||||||
priv = netif->state;
|
priv = netif->state;
|
||||||
|
|
||||||
@ -158,6 +155,42 @@ slipif_output(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr)
|
|||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a pbuf doing the necessary SLIP encapsulation
|
||||||
|
*
|
||||||
|
* Uses the serial layer's sio_send()
|
||||||
|
*
|
||||||
|
* @param netif the lwip network interface structure for this slipif
|
||||||
|
* @param p the pbuf chaing packet to send
|
||||||
|
* @param ipaddr the ip address to send the packet to (not used for slipif)
|
||||||
|
* @return always returns ERR_OK since the serial layer does not provide return values
|
||||||
|
*/
|
||||||
|
static err_t
|
||||||
|
slipif_output_v4(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr)
|
||||||
|
{
|
||||||
|
LWIP_UNUSED_ARG(ipaddr);
|
||||||
|
return slipif_output(netif, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if LWIP_IPV6
|
||||||
|
/**
|
||||||
|
* Send a pbuf doing the necessary SLIP encapsulation
|
||||||
|
*
|
||||||
|
* Uses the serial layer's sio_send()
|
||||||
|
*
|
||||||
|
* @param netif the lwip network interface structure for this slipif
|
||||||
|
* @param p the pbuf chaing packet to send
|
||||||
|
* @param ipaddr the ip address to send the packet to (not used for slipif)
|
||||||
|
* @return always returns ERR_OK since the serial layer does not provide return values
|
||||||
|
*/
|
||||||
|
static err_t
|
||||||
|
slipif_output_v6(struct netif *netif, struct pbuf *p, ip6_addr_t *ipaddr)
|
||||||
|
{
|
||||||
|
LWIP_UNUSED_ARG(ipaddr);
|
||||||
|
return slipif_output(netif, p);
|
||||||
|
}
|
||||||
|
#endif /* LWIP_IPV6 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the incoming SLIP stream character by character
|
* Handle the incoming SLIP stream character by character
|
||||||
*
|
*
|
||||||
@ -330,9 +363,9 @@ slipif_init(struct netif *netif)
|
|||||||
|
|
||||||
netif->name[0] = 's';
|
netif->name[0] = 's';
|
||||||
netif->name[1] = 'l';
|
netif->name[1] = 'l';
|
||||||
netif->output = slipif_output;
|
netif->output = slipif_output_v4;
|
||||||
#if LWIP_IPV6
|
#if LWIP_IPV6
|
||||||
netif->output_ip6 = slipif_output;
|
netif->output_ip6 = slipif_output_v6;
|
||||||
#endif /* LWIP_IPV6 */
|
#endif /* LWIP_IPV6 */
|
||||||
netif->mtu = SLIP_MAX_SIZE;
|
netif->mtu = SLIP_MAX_SIZE;
|
||||||
netif->flags |= NETIF_FLAG_POINTTOPOINT;
|
netif->flags |= NETIF_FLAG_POINTTOPOINT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user