net: ppp: dialup enablers
Introducing PPP dialup features to enable e.g. usage of nrf9160 based board as a dialup modem for transferring ip data over PPP (e.g. windows dial up), i.e. usage of Zephyr PPP as a server for providing MTU/MRU, IP address and DNS addresses for a PC: - PPP LCP MRU option (configurable) - PPP server: IPCP ip and dns address peer options to enable providing IP and DNS addresses for PPP peer. Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
This commit is contained in:
parent
e3f8757b70
commit
5d76e8aca8
6 changed files with 231 additions and 2 deletions
|
@ -23,6 +23,12 @@ config NET_PPP_DRV_NAME
|
|||
help
|
||||
This option sets the driver name
|
||||
|
||||
config NET_PPP_MTU_MRU
|
||||
int "PPP MTU and MRU"
|
||||
default 1500
|
||||
help
|
||||
This options sets MTU and MRU for PPP link.
|
||||
|
||||
config NET_PPP_UART_BUF_LEN
|
||||
int "Buffer length when reading from UART"
|
||||
default 8
|
||||
|
|
|
@ -576,6 +576,20 @@ static int ppp_send(const struct device *dev, struct net_pkt *pkt)
|
|||
protocol = htons(PPP_IP);
|
||||
} else if (net_pkt_family(pkt) == AF_INET6) {
|
||||
protocol = htons(PPP_IPV6);
|
||||
} else if (IS_ENABLED(CONFIG_NET_SOCKETS_PACKET) &&
|
||||
net_pkt_family(pkt) == AF_PACKET) {
|
||||
char type = (NET_IPV6_HDR(pkt)->vtc & 0xf0);
|
||||
|
||||
switch (type) {
|
||||
case 0x60:
|
||||
protocol = htons(PPP_IPV6);
|
||||
break;
|
||||
case 0x40:
|
||||
protocol = htons(PPP_IP);
|
||||
break;
|
||||
default:
|
||||
return -EPROTONOSUPPORT;
|
||||
}
|
||||
} else {
|
||||
return -EPROTONOSUPPORT;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue