libhd  5.0
Data Structures | Macros | Typedefs | Functions | Variables
pppoe.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <linux/if.h>
#include <net/ethernet.h>
#include <net/if_arp.h>
#include <netinet/in.h>
#include <netpacket/packet.h>
#include "hd.h"
#include "hd_int.h"
#include "pppoe.h"

Data Structures

struct  PPPoEPacketStruct
 
struct  PPPoETagStruct
 
struct  PPPoEConnectionStruct
 
struct  PacketCriteriaStruct
 

Macros

#define ETH_PPPOE_DISCOVERY   0x8863
 
#define ETH_PPPOE_SESSION   0x8864
 
#define CODE_PADI   0x09
 
#define CODE_PADO   0x07
 
#define CODE_PADR   0x19
 
#define CODE_PADS   0x65
 
#define CODE_PADT   0xA7
 
#define TAG_END_OF_LIST   0x0000
 
#define TAG_SERVICE_NAME   0x0101
 
#define TAG_AC_NAME   0x0102
 
#define TAG_HOST_UNIQ   0x0103
 
#define TAG_AC_COOKIE   0x0104
 
#define TAG_VENDOR_SPECIFIC   0x0105
 
#define TAG_RELAY_SESSION_ID   0x0110
 
#define TAG_SERVICE_NAME_ERROR   0x0201
 
#define TAG_AC_SYSTEM_ERROR   0x0202
 
#define TAG_GENERIC_ERROR   0x0203
 
#define MAX_ATTEMPTS   2
 
#define PADO_TIMEOUT   3
 
#define PPPOE_OVERHEAD   6 /* type, code, session, length */
 
#define HDR_SIZE   (sizeof (struct ethhdr) + PPPOE_OVERHEAD)
 
#define MAX_PPPOE_PAYLOAD   (ETH_DATA_LEN - PPPOE_OVERHEAD)
 
#define TAG_HDR_SIZE   4
 
#define NOT_UNICAST(e)   ((e[0] & 0x01) != 0)
 

Typedefs

typedef struct PPPoEPacketStruct PPPoEPacket
 
typedef struct PPPoETagStruct PPPoETag
 
typedef void parse_func(uint16_t type, uint16_t len, unsigned char *data, void *extra)
 
typedef struct PPPoEConnectionStruct PPPoEConnection
 
typedef struct PacketCriteriaStruct PacketCriteria
 

Functions

static int check_room (PPPoEConnection *conn, unsigned char *cursor, unsigned char *start, uint16_t len)
 
static int parse_packet (PPPoEConnection *conn, PPPoEPacket *packet, parse_func *func, void *extra)
 
static int open_interfaces (int n, PPPoEConnection *conns)
 
static void close_intefaces (int n, PPPoEConnection *conns)
 
static int send_packet (int fd, PPPoEPacket *pkt, size_t size)
 
static int receive_packet (int fd, PPPoEPacket *pkt, size_t *size)
 
static void parse_hostuniq (uint16_t type, uint16_t len, unsigned char *data, void *extra)
 
static int packet_for_me (PPPoEConnection *conn, PPPoEPacket *packet)
 
static void parse_pado_tags (uint16_t type, uint16_t len, unsigned char *data, void *extra)
 
static int send_padi (int n, PPPoEConnection *conns)
 
static int wait_for_pado (int n, PPPoEConnection *conns)
 
static void discovery (int n, PPPoEConnection *conns)
 
void hd_scan_pppoe (hd_data_t *hd_data2)
 

Variables

static hd_data_thd_data
 

Variable Documentation

◆ hd_data

hd_data_t* hd_data
static

Referenced by _read_klog(), add_cdrom_info(), add_disk_size(), add_edid_from_file(), add_edid_info(), add_hd_entry(), add_ide_sysfs_info(), add_input_dev(), add_kma(), add_monitor(), add_mv643xx_eth(), add_other_sysfs_info(), add_partitions(), add_pci(), add_pci_data(), add_pci_entry(), add_scsi_sysfs_info(), add_serial_console(), add_serial_modem(), add_serial_mouse(), add_uml(), add_xen_network(), add_xen_storage(), add_xpnet(), assign_hw_class(), at_cmd(), copy_log2shm(), dev_name_duplicate(), device_class(), do_alva(), do_baum(), do_fhp(), do_fhp_new(), do_ht(), do_lp(), do_zip(), dump_bios(), dump_cpu_data(), dump_floppy_data(), dump_klog(), dump_misc_data(), dump_misc_proc_data(), dump_normal(), dump_pci_data(), dump_ser_modem_data(), dump_ser_mouse_data(), dump_serial_data(), exists_hd_entry(), expand_driver_info(), find_udi(), fix_probe_features(), free_devtree(), free_old_hd_entries(), get_block_devs(), get_cmd_param(), get_cmdline(), get_generic_scsi_devs(), get_input_devices(), get_input_devs(), get_kernel_version(), get_printer_devs(), get_probe_env(), get_probe_val_int(), get_probe_val_list(), get_probe_val_str(), get_scsi_tape(), get_serial_devs(), get_serial_info(), get_serial_modem(), get_serial_mouse(), get_usb_devs(), guess_modem_name(), hal_find_device(), has_something_attached(), hd_add_driver_data(), hd_apm_enabled(), hd_base_class_list(), hd_boot_arch(), hd_boot_disk(), hd_bus_list(), hd_change_config_status(), hd_change_status(), hd_clear_probe_feature(), hd_color(), hd_cpu_arch(), hd_display_adapter(), hd_dump_entry(), hd_find_sysfs_id(), hd_find_sysfs_id_devname(), hd_fork(), hd_fork_done(), hd_free_hd_data(), hd_get_device_by_id(), hd_get_device_by_idx(), hd_has_pcmcia(), hd_is_shm_ptr(), hd_is_uml(), hd_list(), hd_list2(), hd_list_with_status(), hd_list_with_status2(), hd_log(), hd_log_hex(), hd_log_printf(), hd_mac_color(), hd_modinfo_db(), hd_module_is_active(), hd_module_list(), hd_move_to_shm(), hd_pci_read_data(), hd_probe_feature(), hd_read_config(), hd_read_ibmebus(), hd_read_macio(), hd_read_mdio(), hd_read_mmap(), hd_read_mmc(), hd_read_nd(), hd_read_of_platform(), hd_read_platform(), hd_read_ps3_system_bus(), hd_read_sdio(), hd_read_uisvirtpci(), hd_read_vio(), hd_read_virtio(), hd_read_visorbus(), hd_read_vm(), hd_read_xen(), hd_report_this(), hd_scan(), hd_scan_braille(), hd_scan_cpu(), hd_scan_dsl(), hd_scan_fb(), hd_scan_floppy(), hd_scan_hal(), hd_scan_hal_assign_udi(), hd_scan_hal_basic(), hd_scan_input(), hd_scan_int(), hd_scan_isdn(), hd_scan_kbd(), hd_scan_manual(), hd_scan_manual2(), hd_scan_memory(), hd_scan_misc(), hd_scan_misc2(), hd_scan_modem(), hd_scan_monitor(), hd_scan_mouse(), hd_scan_net(), hd_scan_no_hal(), hd_scan_parallel(), hd_scan_pcmcia(), hd_scan_pppoe(), hd_scan_serial(), hd_scan_sys(), hd_scan_sysfs_block(), hd_scan_sysfs_pci(), hd_scan_sysfs_scsi(), hd_scan_sysfs_usb(), hd_scan_with_hal(), hd_scan_wlan(), hd_scan_xtra(), hd_set_probe_feature(), hd_set_probe_feature_hw(), hd_shm_add(), hd_shm_add_str(), hd_shm_add_str_list(), hd_shm_clean(), hd_shm_done(), hd_shm_init(), hd_smp_support(), hd_sub_class_list(), hd_sysfs_driver_list(), hd_sysfs_find_driver(), hd_usb_support(), hd_write_config(), hddb_add_info(), hddb_init(), hddb_init_external(), hddb_init_pci(), hddb_search(), int_add_driver_modules(), int_cdrom(), int_devicenames(), int_find_parent(), int_fix_usb_scsi(), int_floppy(), int_hotplug(), int_media_check(), int_modem(), int_mouse(), int_udev(), int_update_driver_data(), int_wlan(), isdn_driver(), kbd_driver(), klog_mem(), klog_mem2(), link_hal_tree(), load_module(), load_module_with_params(), match_modinfo(), new_id(), pcmcia_ctrl_read_data(), pcmcia_read_data(), probe_module(), progress(), prop2hd(), read_cdroms(), read_cpuinfo(), read_hal(), read_klog(), read_kmods(), read_modem(), read_partitions(), read_properties(), read_udevinfo(), remove_hd_entries(), remove_tagged_hd_entries(), set_class_entries(), set_probe_feature(), set_probe_val(), sigusr1_handler(), smbios_dump(), smbios_parse(), sub_device_class(), unload_module(), update_irq_usage(), and write_modem().