2019-05-27 13:55:01 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2005-04-17 05:20:36 +07: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
|
|
|
|
*
|
|
|
|
* License:
|
|
|
|
*/
|
|
|
|
#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-11 01:56:08 +07:00
|
|
|
#include <linux/skbuff.h>
|
2015-03-01 17:54:39 +07:00
|
|
|
#include <linux/workqueue.h>
|
2012-10-13 16:46:48 +07:00
|
|
|
#include <uapi/linux/if_pppox.h>
|
2007-03-11 01:56:08 +07:00
|
|
|
|
|
|
|
static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
|
|
|
|
{
|
2007-04-11 10:50:43 +07:00
|
|
|
return (struct pppoe_hdr *)skb_network_header(skb);
|
2007-03-11 01:56:08 +07:00
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
struct pppoe_opt {
|
|
|
|
struct net_device *dev; /* device associated with socket*/
|
2007-03-05 07:03:22 +07:00
|
|
|
int ifindex; /* ifindex of device associated with socket */
|
2005-04-17 05:20:36 +07: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 17:54:39 +07:00
|
|
|
struct work_struct padt_work;/* Work item for handling PADT */
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
2010-08-22 13:05:39 +07: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-17 05:20:36 +07:00
|
|
|
#include <net/sock.h>
|
|
|
|
|
|
|
|
struct pppox_sock {
|
|
|
|
/* struct sock must be the first member of pppox_sock */
|
2010-08-22 13:05:39 +07:00
|
|
|
struct sock sk;
|
|
|
|
struct ppp_channel chan;
|
2005-04-17 05:20:36 +07:00
|
|
|
struct pppox_sock *next; /* for hash table */
|
|
|
|
union {
|
|
|
|
struct pppoe_opt pppoe;
|
2010-08-22 13:05:39 +07:00
|
|
|
struct pptp_opt pptp;
|
2005-04-17 05:20:36 +07:00
|
|
|
} proto;
|
2007-08-23 13:55:33 +07:00
|
|
|
__be16 num;
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
#define pppoe_dev proto.pppoe.dev
|
2007-03-05 07:03:22 +07:00
|
|
|
#define pppoe_ifindex proto.pppoe.ifindex
|
2005-04-17 05:20:36 +07: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 09:09:13 +07:00
|
|
|
int (*create)(struct net *net, struct socket *sock, int kern);
|
2005-04-17 05:20:36 +07:00
|
|
|
int (*ioctl)(struct socket *sock, unsigned int cmd,
|
|
|
|
unsigned long arg);
|
|
|
|
struct module *owner;
|
|
|
|
};
|
|
|
|
|
2010-09-21 13:43:54 +07:00
|
|
|
extern int register_pppox_proto(int proto_num, const struct pppox_proto *pp);
|
2005-04-17 05:20:36 +07:00
|
|
|
extern void unregister_pppox_proto(int proto_num);
|
|
|
|
extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */
|
2005-12-28 11:57:40 +07:00
|
|
|
extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
|
2019-07-31 02:25:20 +07: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-17 05:20:36 +07: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) */
|