1 /*************************************************************************** 2 * Linux PPP over X - Generic PPP transport layer sockets 3 * Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516) 4 * 5 * This file supplies definitions required by the PPP over Ethernet driver 6 * (pppox.c). All version information wrt this file is located in pppox.c 7 * 8 * License: 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License 11 * as published by the Free Software Foundation; either version 12 * 2 of the License, or (at your option) any later version. 13 * 14 */ 15 16 #ifndef __LINUX_IF_PPPOX_H 17 #define __LINUX_IF_PPPOX_H 18 19 20 #include <asm/types.h> 21 #include <asm/byteorder.h> 22 23 #include <linux/if_pppol2tp.h> 24 25 /* For user-space programs to pick up these definitions 26 * which they wouldn't get otherwise without defining __KERNEL__ 27 */ 28 #ifndef AF_PPPOX 29 #define AF_PPPOX 24 30 #define PF_PPPOX AF_PPPOX 31 #endif /* !(AF_PPPOX) */ 32 33 /************************************************************************ 34 * PPPoE addressing definition 35 */ 36 typedef __be16 sid_t; 37 struct pppoe_addr{ 38 sid_t sid; /* Session identifier */ 39 unsigned char remote[ETH_ALEN]; /* Remote address */ 40 char dev[IFNAMSIZ]; /* Local device to use */ 41 }; 42 43 /************************************************************************ 44 * Protocols supported by AF_PPPOX 45 */ 46 #define PX_PROTO_OE 0 /* Currently just PPPoE */ 47 #define PX_PROTO_OL2TP 1 /* Now L2TP also */ 48 #define PX_MAX_PROTO 2 49 50 struct sockaddr_pppox { 51 sa_family_t sa_family; /* address family, AF_PPPOX */ 52 unsigned int sa_protocol; /* protocol identifier */ 53 union{ 54 struct pppoe_addr pppoe; 55 }sa_addr; 56 }__attribute__ ((packed)); 57 58 /* The use of the above union isn't viable because the size of this 59 * struct must stay fixed over time -- applications use sizeof(struct 60 * sockaddr_pppox) to fill it. We use a protocol specific sockaddr 61 * type instead. 62 */ 63 struct sockaddr_pppol2tp { 64 sa_family_t sa_family; /* address family, AF_PPPOX */ 65 unsigned int sa_protocol; /* protocol identifier */ 66 struct pppol2tp_addr pppol2tp; 67 }__attribute__ ((packed)); 68 69 /********************************************************************* 70 * 71 * ioctl interface for defining forwarding of connections 72 * 73 ********************************************************************/ 74 75 #define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t) 76 #define PPPOEIOCDFWD _IO(0xB1 ,1) 77 /*#define PPPOEIOCGFWD _IOWR(0xB1,2, size_t)*/ 78 79 /* Codes to identify message types */ 80 #define PADI_CODE 0x09 81 #define PADO_CODE 0x07 82 #define PADR_CODE 0x19 83 #define PADS_CODE 0x65 84 #define PADT_CODE 0xa7 85 struct pppoe_tag { 86 __be16 tag_type; 87 __be16 tag_len; 88 char tag_data[0]; 89 } __attribute ((packed)); 90 91 /* Tag identifiers */ 92 #define PTT_EOL __constant_htons(0x0000) 93 #define PTT_SRV_NAME __constant_htons(0x0101) 94 #define PTT_AC_NAME __constant_htons(0x0102) 95 #define PTT_HOST_UNIQ __constant_htons(0x0103) 96 #define PTT_AC_COOKIE __constant_htons(0x0104) 97 #define PTT_VENDOR __constant_htons(0x0105) 98 #define PTT_RELAY_SID __constant_htons(0x0110) 99 #define PTT_SRV_ERR __constant_htons(0x0201) 100 #define PTT_SYS_ERR __constant_htons(0x0202) 101 #define PTT_GEN_ERR __constant_htons(0x0203) 102 103 struct pppoe_hdr { 104 #if defined(__LITTLE_ENDIAN_BITFIELD) 105 __u8 ver : 4; 106 __u8 type : 4; 107 #elif defined(__BIG_ENDIAN_BITFIELD) 108 __u8 type : 4; 109 __u8 ver : 4; 110 #else 111 #error "Please fix <asm/byteorder.h>" 112 #endif 113 __u8 code; 114 __be16 sid; 115 __be16 length; 116 struct pppoe_tag tag[0]; 117 } __attribute__ ((packed)); 118 119 /* Length of entire PPPoE + PPP header */ 120 #define PPPOE_SES_HLEN 8 121 122 123 #endif /* !(__LINUX_IF_PPPOX_H) */ 124