#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched/signal.h>
#include <linux/kmod.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/idr.h>
#include <linux/netdevice.h>
#include <linux/poll.h>
#include <linux/ppp_defs.h>
#include <linux/filter.h>
#include <linux/ppp-ioctl.h>
#include <linux/ppp_channel.h>
#include <linux/ppp-comp.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/if_arp.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/spinlock.h>
#include <linux/rwsem.h>
#include <linux/stddef.h>
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/unaligned.h>
#include <net/slhc_vj.h>
#include <linux/atomic.h>
#include <linux/refcount.h>
#include <linux/nsproxy.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#define PPP_VERSION …
#define NP_IP …
#define NP_IPV6 …
#define NP_IPX …
#define NP_AT …
#define NP_MPLS_UC …
#define NP_MPLS_MC …
#define NUM_NP …
#define MPHDRLEN …
#define MPHDRLEN_SSN …
#define PPP_PROTO_LEN …
#define PPP_LCP_HDRLEN …
struct ppp_file { … };
#define PF_TO_X(pf, X) …
#define PF_TO_PPP(pf) …
#define PF_TO_CHANNEL(pf) …
struct ppp_link_stats { … };
struct ppp { … };
#define SC_FLAG_BITS …
struct channel { … };
struct ppp_config { … };
static DEFINE_MUTEX(ppp_mutex);
static atomic_t ppp_unit_count = …;
static atomic_t channel_count = …;
static unsigned int ppp_net_id __read_mostly;
struct ppp_net { … };
#define PPP_PROTO(skb) …
#define PPP_MAX_RQLEN …
#define PPP_MP_MAX_QLEN …
#define B …
#define E …
#define seq_before(a, b) …
#define seq_after(a, b) …
static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
struct file *file, unsigned int cmd, unsigned long arg);
static void ppp_xmit_process(struct ppp *ppp, struct sk_buff *skb);
static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb);
static void ppp_push(struct ppp *ppp);
static void ppp_channel_push(struct channel *pch);
static void ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb,
struct channel *pch);
static void ppp_receive_error(struct ppp *ppp);
static void ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb);
static struct sk_buff *ppp_decompress_frame(struct ppp *ppp,
struct sk_buff *skb);
#ifdef CONFIG_PPP_MULTILINK
static void ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb,
struct channel *pch);
static void ppp_mp_insert(struct ppp *ppp, struct sk_buff *skb);
static struct sk_buff *ppp_mp_reconstruct(struct ppp *ppp);
static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb);
#endif
static int ppp_set_compress(struct ppp *ppp, struct ppp_option_data *data);
static void ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound);
static void ppp_ccp_closed(struct ppp *ppp);
static struct compressor *find_compressor(int type);
static void ppp_get_stats(struct ppp *ppp, struct ppp_stats *st);
static int ppp_create_interface(struct net *net, struct file *file, int *unit);
static void init_ppp_file(struct ppp_file *pf, int kind);
static void ppp_destroy_interface(struct ppp *ppp);
static struct ppp *ppp_find_unit(struct ppp_net *pn, int unit);
static struct channel *ppp_find_channel(struct ppp_net *pn, int unit);
static int ppp_connect_channel(struct channel *pch, int unit);
static int ppp_disconnect_channel(struct channel *pch);
static void ppp_destroy_channel(struct channel *pch);
static int unit_get(struct idr *p, void *ptr, int min);
static int unit_set(struct idr *p, void *ptr, int n);
static void unit_put(struct idr *p, int n);
static void *unit_find(struct idr *p, int n);
static void ppp_setup(struct net_device *dev);
static const struct net_device_ops ppp_netdev_ops;
static const struct class ppp_class = …;
static inline struct ppp_net *ppp_pernet(struct net *net)
{ … }
static inline int proto_to_npindex(int proto)
{ … }
static const int npindex_to_proto[NUM_NP] = …;
static inline int ethertype_to_npindex(int ethertype)
{ … }
static const int npindex_to_ethertype[NUM_NP] = …;
#define ppp_xmit_lock(ppp) …
#define ppp_xmit_unlock(ppp) …
#define ppp_recv_lock(ppp) …
#define ppp_recv_unlock(ppp) …
#define ppp_lock(ppp) …
#define ppp_unlock(ppp) …
static int ppp_open(struct inode *inode, struct file *file)
{ … }
static int ppp_release(struct inode *unused, struct file *file)
{ … }
static ssize_t ppp_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{ … }
static bool ppp_check_packet(struct sk_buff *skb, size_t count)
{ … }
static ssize_t ppp_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{ … }
static __poll_t ppp_poll(struct file *file, poll_table *wait)
{ … }
#ifdef CONFIG_PPP_FILTER
static struct bpf_prog *get_filter(struct sock_fprog *uprog)
{ … }
static struct bpf_prog *ppp_get_filter(struct sock_fprog __user *p)
{ … }
#ifdef CONFIG_COMPAT
struct sock_fprog32 { … };
#define PPPIOCSPASS32 …
#define PPPIOCSACTIVE32 …
static struct bpf_prog *compat_ppp_get_filter(struct sock_fprog32 __user *p)
{ … }
#endif
#endif
static int ppp_bridge_channels(struct channel *pch, struct channel *pchb)
{ … }
static int ppp_unbridge_channels(struct channel *pch)
{ … }
static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
#ifdef CONFIG_COMPAT
struct ppp_option_data32 { … };
#define PPPIOCSCOMPRESS32 …
static long ppp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
#endif
static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
struct file *file, unsigned int cmd, unsigned long arg)
{ … }
static const struct file_operations ppp_device_fops = …;
static __net_init int ppp_init_net(struct net *net)
{ … }
static __net_exit void ppp_exit_net(struct net *net)
{ … }
static struct pernet_operations ppp_net_ops = …;
static int ppp_unit_register(struct ppp *ppp, int unit, bool ifname_is_set)
{ … }
static int ppp_dev_configure(struct net *src_net, struct net_device *dev,
const struct ppp_config *conf)
{ … }
static const struct nla_policy ppp_nl_policy[IFLA_PPP_MAX + 1] = …;
static int ppp_nl_validate(struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static int ppp_nl_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static void ppp_nl_dellink(struct net_device *dev, struct list_head *head)
{ … }
static size_t ppp_nl_get_size(const struct net_device *dev)
{ … }
static int ppp_nl_fill_info(struct sk_buff *skb, const struct net_device *dev)
{ … }
static struct net *ppp_nl_get_link_net(const struct net_device *dev)
{ … }
static struct rtnl_link_ops ppp_link_ops __read_mostly = …;
#define PPP_MAJOR …
static int __init ppp_init(void)
{ … }
static netdev_tx_t
ppp_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ … }
static int
ppp_net_siocdevprivate(struct net_device *dev, struct ifreq *ifr,
void __user *addr, int cmd)
{ … }
static void
ppp_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats64)
{ … }
static int ppp_dev_init(struct net_device *dev)
{ … }
static void ppp_dev_uninit(struct net_device *dev)
{ … }
static void ppp_dev_priv_destructor(struct net_device *dev)
{ … }
static int ppp_fill_forward_path(struct net_device_path_ctx *ctx,
struct net_device_path *path)
{ … }
static const struct net_device_ops ppp_netdev_ops = …;
static const struct device_type ppp_type = …;
static void ppp_setup(struct net_device *dev)
{ … }
static void __ppp_xmit_process(struct ppp *ppp, struct sk_buff *skb)
{ … }
static void ppp_xmit_process(struct ppp *ppp, struct sk_buff *skb)
{ … }
static inline struct sk_buff *
pad_compress_skb(struct ppp *ppp, struct sk_buff *skb)
{ … }
static void
ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
{ … }
static void
ppp_push(struct ppp *ppp)
{ … }
#ifdef CONFIG_PPP_MULTILINK
static bool mp_protocol_compress __read_mostly = …;
module_param(mp_protocol_compress, bool, 0644);
MODULE_PARM_DESC(…) …;
static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
{ … }
#endif
static void __ppp_channel_push(struct channel *pch)
{ … }
static void ppp_channel_push(struct channel *pch)
{ … }
struct ppp_mp_skb_parm { … };
#define PPP_MP_CB(skb) …
static inline void
ppp_do_recv(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
{ … }
static void __ppp_decompress_proto(struct sk_buff *skb)
{ … }
static bool ppp_decompress_proto(struct sk_buff *skb)
{ … }
static bool ppp_channel_bridge_input(struct channel *pch, struct sk_buff *skb)
{ … }
void
ppp_input(struct ppp_channel *chan, struct sk_buff *skb)
{ … }
void
ppp_input_error(struct ppp_channel *chan, int code)
{ … }
static void
ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
{ … }
static void
ppp_receive_error(struct ppp *ppp)
{ … }
static void
ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
{ … }
static struct sk_buff *
ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb)
{ … }
#ifdef CONFIG_PPP_MULTILINK
static void
ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
{ … }
static void
ppp_mp_insert(struct ppp *ppp, struct sk_buff *skb)
{ … }
static struct sk_buff *
ppp_mp_reconstruct(struct ppp *ppp)
{ … }
#endif
int ppp_register_channel(struct ppp_channel *chan)
{ … }
int ppp_register_net_channel(struct net *net, struct ppp_channel *chan)
{ … }
int ppp_channel_index(struct ppp_channel *chan)
{ … }
int ppp_unit_number(struct ppp_channel *chan)
{ … }
char *ppp_dev_name(struct ppp_channel *chan)
{ … }
void
ppp_unregister_channel(struct ppp_channel *chan)
{ … }
void
ppp_output_wakeup(struct ppp_channel *chan)
{ … }
static int
ppp_set_compress(struct ppp *ppp, struct ppp_option_data *data)
{ … }
static void
ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound)
{ … }
static void
ppp_ccp_closed(struct ppp *ppp)
{ … }
static LIST_HEAD(compressor_list);
static DEFINE_SPINLOCK(compressor_list_lock);
struct compressor_entry { … };
static struct compressor_entry *
find_comp_entry(int proto)
{ … }
int
ppp_register_compressor(struct compressor *cp)
{ … }
void
ppp_unregister_compressor(struct compressor *cp)
{ … }
static struct compressor *
find_compressor(int type)
{ … }
static void
ppp_get_stats(struct ppp *ppp, struct ppp_stats *st)
{ … }
static int ppp_create_interface(struct net *net, struct file *file, int *unit)
{ … }
static void
init_ppp_file(struct ppp_file *pf, int kind)
{ … }
static void ppp_destroy_interface(struct ppp *ppp)
{ … }
static struct ppp *
ppp_find_unit(struct ppp_net *pn, int unit)
{ … }
static struct channel *
ppp_find_channel(struct ppp_net *pn, int unit)
{ … }
static int
ppp_connect_channel(struct channel *pch, int unit)
{ … }
static int
ppp_disconnect_channel(struct channel *pch)
{ … }
static void ppp_destroy_channel(struct channel *pch)
{ … }
static void __exit ppp_cleanup(void)
{ … }
static int unit_set(struct idr *p, void *ptr, int n)
{ … }
static int unit_get(struct idr *p, void *ptr, int min)
{ … }
static void unit_put(struct idr *p, int n)
{ … }
static void *unit_find(struct idr *p, int n)
{ … }
module_init(…) …;
module_exit(ppp_cleanup);
EXPORT_SYMBOL(…);
EXPORT_SYMBOL(…);
EXPORT_SYMBOL(…);
EXPORT_SYMBOL(…);
EXPORT_SYMBOL(…);
EXPORT_SYMBOL(…);
EXPORT_SYMBOL(…);
EXPORT_SYMBOL(…);
EXPORT_SYMBOL(…);
EXPORT_SYMBOL(…);
EXPORT_SYMBOL(…);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS_CHARDEV(…);
MODULE_ALIAS_RTNL_LINK(…) …;
MODULE_ALIAS(…) …;