2019-05-27 06:55:01 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2005-04-16 22:20:36 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Linux PPP over X - Generic PPP transport layer sockets
|
|
|
|
* Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516)
|
|
|
|
*
|
|
|
|
* This file supplies definitions required by the PPP over Ethernet driver
|
|
|
|
* (pppox.c). All version information wrt this file is located in pppox.c
|
|
|
|
*/
|
|
|
|
#ifndef __LINUX_IF_PPPOX_H
|
|
|
|
#define __LINUX_IF_PPPOX_H
|
|
|
|
|
|
|
|
#include <linux/if.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/ppp_channel.h>
|
2007-03-10 18:56:08 +00:00
|
|
|
#include <linux/skbuff.h>
|
2015-03-01 10:54:39 +00:00
|
|
|
#include <linux/workqueue.h>
|
2012-10-13 09:46:48 +00:00
|
|
|
#include <uapi/linux/if_pppox.h>
|
2007-03-10 18:56:08 +00:00
|
|
|
|
|
|
|
static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
|
|
|
|
{
|
2007-04-11 03:50:43 +00:00
|
|
|
return (struct pppoe_hdr *)skb_network_header(skb);
|
2007-03-10 18:56:08 +00:00
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
struct pppoe_opt {
|
|
|
|
struct net_device *dev; /* device associated with socket*/
|
2007-03-05 00:03:22 +00:00
|
|
|
int ifindex; /* ifindex of device associated with socket */
|
2005-04-16 22:20:36 +00:00
|
|
|
struct pppoe_addr pa; /* what this socket is bound to*/
|
|
|
|
struct sockaddr_pppox relay; /* what socket data will be
|
|
|
|
relayed to (PPPoE relaying) */
|
2015-03-01 10:54:39 +00:00
|
|
|
struct work_struct padt_work;/* Work item for handling PADT */
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
2010-08-22 06:05:39 +00:00
|
|
|
struct pptp_opt {
|
|
|
|
struct pptp_addr src_addr;
|
|
|
|
struct pptp_addr dst_addr;
|
|
|
|
u32 ack_sent, ack_recv;
|
|
|
|
u32 seq_sent, seq_recv;
|
|
|
|
int ppp_flags;
|
|
|
|
};
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <net/sock.h>
|
|
|
|
|
|
|
|
struct pppox_sock {
|
|
|
|
/* struct sock must be the first member of pppox_sock */
|
2010-08-22 06:05:39 +00:00
|
|
|
struct sock sk;
|
|
|
|
struct ppp_channel chan;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct pppox_sock *next; /* for hash table */
|
|
|
|
union {
|
|
|
|
struct pppoe_opt pppoe;
|
2010-08-22 06:05:39 +00:00
|
|
|
struct pptp_opt pptp;
|
2005-04-16 22:20:36 +00:00
|
|
|
} proto;
|
2007-08-23 06:55:33 +00:00
|
|
|
__be16 num;
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
#define pppoe_dev proto.pppoe.dev
|
2007-03-05 00:03:22 +00:00
|
|
|
#define pppoe_ifindex proto.pppoe.ifindex
|
2005-04-16 22:20:36 +00:00
|
|
|
#define pppoe_pa proto.pppoe.pa
|
|
|
|
#define pppoe_relay proto.pppoe.relay
|
|
|
|
|
|
|
|
static inline struct pppox_sock *pppox_sk(struct sock *sk)
|
|
|
|
{
|
|
|
|
return (struct pppox_sock *)sk;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct sock *sk_pppox(struct pppox_sock *po)
|
|
|
|
{
|
|
|
|
return (struct sock *)po;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct module;
|
|
|
|
|
|
|
|
struct pppox_proto {
|
2015-05-09 02:09:13 +00:00
|
|
|
int (*create)(struct net *net, struct socket *sock, int kern);
|
2005-04-16 22:20:36 +00:00
|
|
|
int (*ioctl)(struct socket *sock, unsigned int cmd,
|
|
|
|
unsigned long arg);
|
|
|
|
struct module *owner;
|
|
|
|
};
|
|
|
|
|
2010-09-21 06:43:54 +00:00
|
|
|
extern int register_pppox_proto(int proto_num, const struct pppox_proto *pp);
|
2005-04-16 22:20:36 +00:00
|
|
|
extern void unregister_pppox_proto(int proto_num);
|
|
|
|
extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */
|
2005-12-28 04:57:40 +00:00
|
|
|
extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
|
2019-07-30 19:25:20 +00:00
|
|
|
extern int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
|
|
|
|
|
|
|
|
#define PPPOEIOCSFWD32 _IOW(0xB1 ,0, compat_size_t)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* PPPoX socket states */
|
|
|
|
enum {
|
|
|
|
PPPOX_NONE = 0, /* initial state */
|
|
|
|
PPPOX_CONNECTED = 1, /* connection established ==TCP_ESTABLISHED */
|
|
|
|
PPPOX_BOUND = 2, /* bound to ppp device */
|
|
|
|
PPPOX_RELAY = 4, /* forwarding is enabled */
|
|
|
|
PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* !(__LINUX_IF_PPPOX_H) */
|