Worked on IPv6-only stack:

- prepared DNS;
- fixed compiling ppp.c
This commit is contained in:
sg
2015-04-13 21:24:40 +02:00
parent 69c337b31d
commit e77e18f8c4
3 changed files with 56 additions and 32 deletions

View File

@@ -181,7 +181,9 @@ const struct protent* const protocols[] = {
/* Prototypes for procedures local to this file. */
static void ppp_do_connect(void *arg);
static err_t ppp_netif_init_cb(struct netif *netif);
#if PPP_IPV4_SUPPORT
static err_t ppp_netif_output_ip4(struct netif *netif, struct pbuf *pb, const ip4_addr_t *ipaddr);
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT
static err_t ppp_netif_output_ip6(struct netif *netif, struct pbuf *pb, const ip6_addr_t *ipaddr);
#endif /* PPP_IPV6_SUPPORT */
@@ -410,8 +412,10 @@ static void ppp_do_connect(void *arg) {
static err_t ppp_netif_init_cb(struct netif *netif) {
netif->name[0] = 'p';
netif->name[1] = 'p';
#if PPP_IPV4_SUPPORT
/* FIXME: change that when netif_null_output_ip4() will materialize */
netif->output = ppp_netif_output_ip4;
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT
netif->output_ip6 = ppp_netif_output_ip6;
#endif /* PPP_IPV6_SUPPORT */
@@ -423,6 +427,7 @@ static err_t ppp_netif_init_cb(struct netif *netif) {
return ERR_OK;
}
#if PPP_IPV4_SUPPORT
/*
* Send an IPv4 packet on the given connection.
*/
@@ -448,6 +453,7 @@ static err_t ppp_netif_output_ip4(struct netif *netif, struct pbuf *pb, const ip
return ERR_IF;
#endif /* PPP_IPV4_SUPPORT */
}
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT
/*
@@ -556,8 +562,11 @@ ppp_pcb *ppp_new(struct netif *pppif, ppp_link_status_cb_fn link_status_cb, void
pcb->settings.fsm_max_nak_loops = FSM_DEFMAXNAKLOOPS;
pcb->netif = pppif;
if (!netif_add(pcb->netif, IP4_ADDR_ANY, IP4_ADDR_BROADCAST, IP4_ADDR_ANY,
(void *)pcb, ppp_netif_init_cb, NULL)) {
if (!netif_add(pcb->netif,
#if LWIP_IPV4
IP4_ADDR_ANY, IP4_ADDR_BROADCAST, IP4_ADDR_ANY,
#endif /* LWIP_IPV4 */
(void *)pcb, ppp_netif_init_cb, NULL)) {
memp_free(MEMP_PPP_PCB, pcb);
PPPDEBUG(LOG_ERR, ("ppp_new: netif_add failed\n"));
return NULL;
@@ -681,10 +690,12 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
switch(protocol) {
#if PPP_IPV4_SUPPORT
case PPP_IP: /* Internet Protocol */
PPPDEBUG(LOG_INFO, ("ppp_input[%d]: ip in pbuf len=%d\n", pcb->netif->num, pb->tot_len));
ip4_input(pb, pcb->netif);
return;
#endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT
case PPP_IPV6: /* Internet Protocol Version 6 */
@@ -1154,6 +1165,7 @@ int get_loop_output(void) {
}
#endif /* DEMAND_SUPPORT */
#if PPP_IPV4_SUPPORT
/********************************************************************
*
* Return user specified netmask, modified by any mask we might determine
@@ -1189,6 +1201,7 @@ u32_t get_mask(u32_t addr) {
LWIP_UNUSED_ARG(addr);
return IPADDR_BROADCAST;
}
#endif /* PPP_IPV4_SUPPORT */
#if PPP_PROTOCOLNAME