Skip to content
Permalink
Browse files

net: ppp: Initial support for point-to-point protocol

This implements ppp L2 component, LCP and IPCP modules.

Fixes #14034

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information...
jukkar committed Mar 26, 2019
1 parent 504dffa commit f95938da0fd510369a45166b6368b3782665f122
@@ -82,6 +82,16 @@
} GROUP_LINK_IN(ROMABLE_REGION)
#endif

#if defined(CONFIG_NET_L2_PPP)
SECTION_PROLOGUE(net_ppp_proto,,)
{
__net_ppp_proto_start = .;
*(".net_ppp_proto.*")
KEEP(*(SORT_BY_NAME(".net_ppp_proto.*")))
__net_ppp_proto_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
#endif

SECTION_DATA_PROLOGUE(_bt_channels_area,,SUBALIGN(4))
{
_bt_l2cap_fixed_chan_list_start = .;
@@ -37,6 +37,11 @@ enum net_l2_flags {

/** Is promiscuous mode supported */
NET_L2_PROMISC_MODE = BIT(2),

/** Is this L2 point-to-point with tunneling so no need to have
* IP address etc to network interface.
*/
NET_L2_POINT_TO_POINT = BIT(3),
} __packed;

/**
@@ -88,6 +93,11 @@ NET_L2_DECLARE_PUBLIC(DUMMY_L2);
NET_L2_DECLARE_PUBLIC(ETHERNET_L2);
#endif /* CONFIG_NET_L2_ETHERNET */

#ifdef CONFIG_NET_L2_PPP
#define PPP_L2 PPP
NET_L2_DECLARE_PUBLIC(PPP_L2);
#endif /* CONFIG_NET_L2_PPP */

#ifdef CONFIG_NET_L2_IEEE802154
#define IEEE802154_L2 IEEE802154
NET_L2_DECLARE_PUBLIC(IEEE802154_L2);
@@ -158,6 +158,7 @@ struct net_pkt {
* Note: family needs to be
* AF_UNSPEC.
*/
u8_t ppp_msg : 1; /* This is a PPP message */
};

union {
@@ -848,6 +849,33 @@ static inline void net_pkt_set_lldp(struct net_pkt *pkt, bool is_lldp)
}
#endif /* CONFIG_NET_LLDP */

#if defined(CONFIG_NET_PPP)
static inline bool net_pkt_is_ppp(struct net_pkt *pkt)
{
return pkt->ppp_msg;
}

static inline void net_pkt_set_ppp(struct net_pkt *pkt,
bool is_ppp_msg)
{
pkt->ppp_msg = is_ppp_msg;
}
#else /* CONFIG_NET_PPP */
static inline bool net_pkt_is_ppp(struct net_pkt *pkt)
{
ARG_UNUSED(pkt);

return false;
}

static inline void net_pkt_set_ppp(struct net_pkt *pkt,
bool is_ppp_msg)
{
ARG_UNUSED(pkt);
ARG_UNUSED(is_ppp_msg);
}
#endif /* CONFIG_NET_PPP */

#define NET_IPV6_HDR(pkt) ((struct net_ipv6_hdr *)net_pkt_ip_data(pkt))
#define NET_IPV4_HDR(pkt) ((struct net_ipv4_hdr *)net_pkt_ip_data(pkt))

@@ -376,6 +376,20 @@ struct net_stats_eth {
#endif
};

/**
* @brief All PPP specific statistics
*/
struct net_stats_ppp {
struct net_stats_bytes bytes;
struct net_stats_pkts pkts;

/** Number of received and dropped PPP frames. */
net_stats_t drop;

/** Number of received PPP frames with a bad checksum. */
net_stats_t chkerr;
};

#if defined(CONFIG_NET_STATISTICS_USER_API)
/* Management part definitions */

@@ -398,6 +412,7 @@ enum net_request_stats_cmd {
NET_REQUEST_STATS_CMD_GET_UDP,
NET_REQUEST_STATS_CMD_GET_TCP,
NET_REQUEST_STATS_CMD_GET_ETHERNET,
NET_REQUEST_STATS_CMD_GET_PPP,
};

#define NET_REQUEST_STATS_GET_ALL \
@@ -469,6 +484,13 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_TCP);
NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_ETHERNET);
#endif /* CONFIG_NET_STATISTICS_ETHERNET */

#if defined(CONFIG_NET_STATISTICS_PPP)
#define NET_REQUEST_STATS_GET_PPP \
(_NET_STATS_BASE | NET_REQUEST_STATS_CMD_GET_PPP)

NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_STATS_GET_PPP);
#endif /* CONFIG_NET_STATISTICS_PPP */

#endif /* CONFIG_NET_STATISTICS_USER_API */

/**

0 comments on commit f95938d

Please sign in to comment.
You can’t perform that action at this time.