You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Makefile for the Linux 802.x protocol layers.
|
||||
#
|
||||
|
||||
obj-y := p8023.o
|
||||
|
||||
# Check the p8022 selections against net/core/Makefile.
|
||||
obj-$(CONFIG_SYSCTL) += sysctl_net_802.o
|
||||
obj-$(CONFIG_LLC) += p8022.o psnap.o
|
||||
obj-$(CONFIG_TR) += p8022.o psnap.o tr.o sysctl_net_802.o
|
||||
obj-$(CONFIG_NET_FC) += fc.o
|
||||
obj-$(CONFIG_FDDI) += fddi.o
|
||||
obj-$(CONFIG_HIPPI) += hippi.o
|
||||
obj-$(CONFIG_IPX) += p8022.o psnap.o
|
||||
obj-$(CONFIG_ATALK) += p8022.o psnap.o
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* NET3: Fibre Channel device handling subroutines
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Vineet Abraham <vma@iol.unh.edu>
|
||||
* v 1.0 03/22/99
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/system.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/socket.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/inet.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/fcdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/init.h>
|
||||
#include <net/arp.h>
|
||||
|
||||
/*
|
||||
* Put the headers on a Fibre Channel packet.
|
||||
*/
|
||||
|
||||
static int fc_header(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type,
|
||||
void *daddr, void *saddr, unsigned len)
|
||||
{
|
||||
struct fch_hdr *fch;
|
||||
int hdr_len;
|
||||
|
||||
/*
|
||||
* Add the 802.2 SNAP header if IP as the IPv4 code calls
|
||||
* dev->hard_header directly.
|
||||
*/
|
||||
if (type == ETH_P_IP || type == ETH_P_ARP)
|
||||
{
|
||||
struct fcllc *fcllc;
|
||||
|
||||
hdr_len = sizeof(struct fch_hdr) + sizeof(struct fcllc);
|
||||
fch = (struct fch_hdr *)skb_push(skb, hdr_len);
|
||||
fcllc = (struct fcllc *)(fch+1);
|
||||
fcllc->dsap = fcllc->ssap = EXTENDED_SAP;
|
||||
fcllc->llc = UI_CMD;
|
||||
fcllc->protid[0] = fcllc->protid[1] = fcllc->protid[2] = 0x00;
|
||||
fcllc->ethertype = htons(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
hdr_len = sizeof(struct fch_hdr);
|
||||
fch = (struct fch_hdr *)skb_push(skb, hdr_len);
|
||||
}
|
||||
|
||||
if(saddr)
|
||||
memcpy(fch->saddr,saddr,dev->addr_len);
|
||||
else
|
||||
memcpy(fch->saddr,dev->dev_addr,dev->addr_len);
|
||||
|
||||
if(daddr)
|
||||
{
|
||||
memcpy(fch->daddr,daddr,dev->addr_len);
|
||||
return(hdr_len);
|
||||
}
|
||||
return -hdr_len;
|
||||
}
|
||||
|
||||
/*
|
||||
* A neighbour discovery of some species (eg arp) has completed. We
|
||||
* can now send the packet.
|
||||
*/
|
||||
|
||||
static int fc_rebuild_header(struct sk_buff *skb)
|
||||
{
|
||||
struct fch_hdr *fch=(struct fch_hdr *)skb->data;
|
||||
struct fcllc *fcllc=(struct fcllc *)(skb->data+sizeof(struct fch_hdr));
|
||||
if(fcllc->ethertype != htons(ETH_P_IP)) {
|
||||
printk("fc_rebuild_header: Don't know how to resolve type %04X addresses ?\n",(unsigned int)htons(fcllc->ethertype));
|
||||
return 0;
|
||||
}
|
||||
#ifdef CONFIG_INET
|
||||
return arp_find(fch->daddr, skb);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void fc_setup(struct net_device *dev)
|
||||
{
|
||||
dev->hard_header = fc_header;
|
||||
dev->rebuild_header = fc_rebuild_header;
|
||||
|
||||
dev->type = ARPHRD_IEEE802;
|
||||
dev->hard_header_len = FC_HLEN;
|
||||
dev->mtu = 2024;
|
||||
dev->addr_len = FC_ALEN;
|
||||
dev->tx_queue_len = 100; /* Long queues on fc */
|
||||
dev->flags = IFF_BROADCAST;
|
||||
|
||||
memset(dev->broadcast, 0xFF, FC_ALEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* alloc_fcdev - Register fibre channel device
|
||||
* @sizeof_priv: Size of additional driver-private structure to be allocated
|
||||
* for this fibre channel device
|
||||
*
|
||||
* Fill in the fields of the device structure with fibre channel-generic values.
|
||||
*
|
||||
* Constructs a new net device, complete with a private data area of
|
||||
* size @sizeof_priv. A 32-byte (not bit) alignment is enforced for
|
||||
* this private data area.
|
||||
*/
|
||||
struct net_device *alloc_fcdev(int sizeof_priv)
|
||||
{
|
||||
return alloc_netdev(sizeof_priv, "fc%d", fc_setup);
|
||||
}
|
||||
EXPORT_SYMBOL(alloc_fcdev);
|
||||
+210
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* INET An implementation of the TCP/IP protocol suite for the LINUX
|
||||
* operating system. INET is implemented using the BSD Socket
|
||||
* interface as the means of communication with the user level.
|
||||
*
|
||||
* FDDI-type device handling.
|
||||
*
|
||||
* Version: @(#)fddi.c 1.0.0 08/12/96
|
||||
*
|
||||
* Authors: Lawrence V. Stefani, <stefani@lkg.dec.com>
|
||||
*
|
||||
* fddi.c is based on previous eth.c and tr.c work by
|
||||
* Ross Biro, <bir7@leland.Stanford.Edu>
|
||||
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
|
||||
* Mark Evans, <evansmp@uhura.aston.ac.uk>
|
||||
* Florian La Roche, <rzsfl@rz.uni-sb.de>
|
||||
* Alan Cox, <gw4pts@gw4pts.ampr.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Changes
|
||||
* Alan Cox : New arp/rebuild header
|
||||
* Maciej W. Rozycki : IPv6 support
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
#include <asm/system.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/socket.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/inet.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/fddidevice.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/errno.h>
|
||||
#include <net/arp.h>
|
||||
#include <net/sock.h>
|
||||
|
||||
/*
|
||||
* Create the FDDI MAC header for an arbitrary protocol layer
|
||||
*
|
||||
* saddr=NULL means use device source address
|
||||
* daddr=NULL means leave destination address (eg unresolved arp)
|
||||
*/
|
||||
|
||||
static int fddi_header(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type,
|
||||
void *daddr, void *saddr, unsigned len)
|
||||
{
|
||||
int hl = FDDI_K_SNAP_HLEN;
|
||||
struct fddihdr *fddi;
|
||||
|
||||
if(type != ETH_P_IP && type != ETH_P_IPV6 && type != ETH_P_ARP)
|
||||
hl=FDDI_K_8022_HLEN-3;
|
||||
fddi = (struct fddihdr *)skb_push(skb, hl);
|
||||
fddi->fc = FDDI_FC_K_ASYNC_LLC_DEF;
|
||||
if(type == ETH_P_IP || type == ETH_P_IPV6 || type == ETH_P_ARP)
|
||||
{
|
||||
fddi->hdr.llc_snap.dsap = FDDI_EXTENDED_SAP;
|
||||
fddi->hdr.llc_snap.ssap = FDDI_EXTENDED_SAP;
|
||||
fddi->hdr.llc_snap.ctrl = FDDI_UI_CMD;
|
||||
fddi->hdr.llc_snap.oui[0] = 0x00;
|
||||
fddi->hdr.llc_snap.oui[1] = 0x00;
|
||||
fddi->hdr.llc_snap.oui[2] = 0x00;
|
||||
fddi->hdr.llc_snap.ethertype = htons(type);
|
||||
}
|
||||
|
||||
/* Set the source and destination hardware addresses */
|
||||
|
||||
if (saddr != NULL)
|
||||
memcpy(fddi->saddr, saddr, dev->addr_len);
|
||||
else
|
||||
memcpy(fddi->saddr, dev->dev_addr, dev->addr_len);
|
||||
|
||||
if (daddr != NULL)
|
||||
{
|
||||
memcpy(fddi->daddr, daddr, dev->addr_len);
|
||||
return(hl);
|
||||
}
|
||||
|
||||
return(-hl);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Rebuild the FDDI MAC header. This is called after an ARP
|
||||
* (or in future other address resolution) has completed on
|
||||
* this sk_buff. We now let ARP fill in the other fields.
|
||||
*/
|
||||
|
||||
static int fddi_rebuild_header(struct sk_buff *skb)
|
||||
{
|
||||
struct fddihdr *fddi = (struct fddihdr *)skb->data;
|
||||
|
||||
#ifdef CONFIG_INET
|
||||
if (fddi->hdr.llc_snap.ethertype == __constant_htons(ETH_P_IP))
|
||||
/* Try to get ARP to resolve the header and fill destination address */
|
||||
return arp_find(fddi->daddr, skb);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
printk("%s: Don't know how to resolve type %02X addresses.\n",
|
||||
skb->dev->name, htons(fddi->hdr.llc_snap.ethertype));
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Determine the packet's protocol ID and fill in skb fields.
|
||||
* This routine is called before an incoming packet is passed
|
||||
* up. It's used to fill in specific skb fields and to set
|
||||
* the proper pointer to the start of packet data (skb->data).
|
||||
*/
|
||||
|
||||
unsigned short fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct fddihdr *fddi = (struct fddihdr *)skb->data;
|
||||
unsigned short type;
|
||||
|
||||
/*
|
||||
* Set mac.raw field to point to FC byte, set data field to point
|
||||
* to start of packet data. Assume 802.2 SNAP frames for now.
|
||||
*/
|
||||
|
||||
skb->mac.raw = skb->data; /* point to frame control (FC) */
|
||||
|
||||
if(fddi->hdr.llc_8022_1.dsap==0xe0)
|
||||
{
|
||||
skb_pull(skb, FDDI_K_8022_HLEN-3);
|
||||
type = __constant_htons(ETH_P_802_2);
|
||||
}
|
||||
else
|
||||
{
|
||||
skb_pull(skb, FDDI_K_SNAP_HLEN); /* adjust for 21 byte header */
|
||||
type=fddi->hdr.llc_snap.ethertype;
|
||||
}
|
||||
|
||||
/* Set packet type based on destination address and flag settings */
|
||||
|
||||
if (*fddi->daddr & 0x01)
|
||||
{
|
||||
if (memcmp(fddi->daddr, dev->broadcast, FDDI_K_ALEN) == 0)
|
||||
skb->pkt_type = PACKET_BROADCAST;
|
||||
else
|
||||
skb->pkt_type = PACKET_MULTICAST;
|
||||
}
|
||||
|
||||
else if (dev->flags & IFF_PROMISC)
|
||||
{
|
||||
if (memcmp(fddi->daddr, dev->dev_addr, FDDI_K_ALEN))
|
||||
skb->pkt_type = PACKET_OTHERHOST;
|
||||
}
|
||||
|
||||
/* Assume 802.2 SNAP frames, for now */
|
||||
|
||||
return(type);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(fddi_type_trans);
|
||||
|
||||
static int fddi_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if ((new_mtu < FDDI_K_SNAP_HLEN) || (new_mtu > FDDI_K_SNAP_DLEN))
|
||||
return(-EINVAL);
|
||||
dev->mtu = new_mtu;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void fddi_setup(struct net_device *dev)
|
||||
{
|
||||
dev->change_mtu = fddi_change_mtu;
|
||||
dev->hard_header = fddi_header;
|
||||
dev->rebuild_header = fddi_rebuild_header;
|
||||
|
||||
dev->type = ARPHRD_FDDI;
|
||||
dev->hard_header_len = FDDI_K_SNAP_HLEN+3; /* Assume 802.2 SNAP hdr len + 3 pad bytes */
|
||||
dev->mtu = FDDI_K_SNAP_DLEN; /* Assume max payload of 802.2 SNAP frame */
|
||||
dev->addr_len = FDDI_K_ALEN;
|
||||
dev->tx_queue_len = 100; /* Long queues on FDDI */
|
||||
dev->flags = IFF_BROADCAST | IFF_MULTICAST;
|
||||
|
||||
memset(dev->broadcast, 0xFF, FDDI_K_ALEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* alloc_fddidev - Register FDDI device
|
||||
* @sizeof_priv: Size of additional driver-private structure to be allocated
|
||||
* for this FDDI device
|
||||
*
|
||||
* Fill in the fields of the device structure with FDDI-generic values.
|
||||
*
|
||||
* Constructs a new net device, complete with a private data area of
|
||||
* size @sizeof_priv. A 32-byte (not bit) alignment is enforced for
|
||||
* this private data area.
|
||||
*/
|
||||
struct net_device *alloc_fddidev(int sizeof_priv)
|
||||
{
|
||||
return alloc_netdev(sizeof_priv, "fddi%d", fddi_setup);
|
||||
}
|
||||
EXPORT_SYMBOL(alloc_fddidev);
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
* INET An implementation of the TCP/IP protocol suite for the LINUX
|
||||
* operating system. INET is implemented using the BSD Socket
|
||||
* interface as the means of communication with the user level.
|
||||
*
|
||||
* HIPPI-type device handling.
|
||||
*
|
||||
* Version: @(#)hippi.c 1.0.0 05/29/97
|
||||
*
|
||||
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
|
||||
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
|
||||
* Mark Evans, <evansmp@uhura.aston.ac.uk>
|
||||
* Florian La Roche, <rzsfl@rz.uni-sb.de>
|
||||
* Alan Cox, <gw4pts@gw4pts.ampr.org>
|
||||
* Jes Sorensen, <Jes.Sorensen@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/socket.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/inet.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/hippidevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/errno.h>
|
||||
#include <net/arp.h>
|
||||
#include <net/sock.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/checksum.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
/*
|
||||
* Create the HIPPI MAC header for an arbitrary protocol layer
|
||||
*
|
||||
* saddr=NULL means use device source address
|
||||
* daddr=NULL means leave destination address (eg unresolved arp)
|
||||
*/
|
||||
|
||||
static int hippi_header(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type, void *daddr, void *saddr,
|
||||
unsigned len)
|
||||
{
|
||||
struct hippi_hdr *hip = (struct hippi_hdr *)skb_push(skb, HIPPI_HLEN);
|
||||
|
||||
if (!len){
|
||||
len = skb->len - HIPPI_HLEN;
|
||||
printk("hippi_header(): length not supplied\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Due to the stupidity of the little endian byte-order we
|
||||
* have to set the fp field this way.
|
||||
*/
|
||||
hip->fp.fixed = __constant_htonl(0x04800018);
|
||||
hip->fp.d2_size = htonl(len + 8);
|
||||
hip->le.fc = 0;
|
||||
hip->le.double_wide = 0; /* only HIPPI 800 for the time being */
|
||||
hip->le.message_type = 0; /* Data PDU */
|
||||
|
||||
hip->le.dest_addr_type = 2; /* 12 bit SC address */
|
||||
hip->le.src_addr_type = 2; /* 12 bit SC address */
|
||||
|
||||
memcpy(hip->le.src_switch_addr, dev->dev_addr + 3, 3);
|
||||
memset(&hip->le.reserved, 0, 16);
|
||||
|
||||
hip->snap.dsap = HIPPI_EXTENDED_SAP;
|
||||
hip->snap.ssap = HIPPI_EXTENDED_SAP;
|
||||
hip->snap.ctrl = HIPPI_UI_CMD;
|
||||
hip->snap.oui[0] = 0x00;
|
||||
hip->snap.oui[1] = 0x00;
|
||||
hip->snap.oui[2] = 0x00;
|
||||
hip->snap.ethertype = htons(type);
|
||||
|
||||
if (daddr)
|
||||
{
|
||||
memcpy(hip->le.dest_switch_addr, daddr + 3, 3);
|
||||
memcpy(&skb->private.ifield, daddr + 2, 4);
|
||||
return HIPPI_HLEN;
|
||||
}
|
||||
return -((int)HIPPI_HLEN);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Rebuild the HIPPI MAC header. This is called after an ARP has
|
||||
* completed on this sk_buff. We now let ARP fill in the other fields.
|
||||
*/
|
||||
|
||||
static int hippi_rebuild_header(struct sk_buff *skb)
|
||||
{
|
||||
struct hippi_hdr *hip = (struct hippi_hdr *)skb->data;
|
||||
|
||||
/*
|
||||
* Only IP is currently supported
|
||||
*/
|
||||
|
||||
if(hip->snap.ethertype != __constant_htons(ETH_P_IP))
|
||||
{
|
||||
printk(KERN_DEBUG "%s: unable to resolve type %X addresses.\n",skb->dev->name,ntohs(hip->snap.ethertype));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't support dynamic ARP on HIPPI, but we use the ARP
|
||||
* static ARP tables to hold the I-FIELDs.
|
||||
*/
|
||||
return arp_find(hip->le.daddr, skb);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Determine the packet's protocol ID.
|
||||
*/
|
||||
|
||||
unsigned short hippi_type_trans(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct hippi_hdr *hip;
|
||||
|
||||
hip = (struct hippi_hdr *) skb->data;
|
||||
|
||||
/*
|
||||
* This is actually wrong ... question is if we really should
|
||||
* set the raw address here.
|
||||
*/
|
||||
skb->mac.raw = skb->data;
|
||||
skb_pull(skb, HIPPI_HLEN);
|
||||
|
||||
/*
|
||||
* No fancy promisc stuff here now.
|
||||
*/
|
||||
|
||||
return hip->snap.ethertype;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(hippi_type_trans);
|
||||
|
||||
static int hippi_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
/*
|
||||
* HIPPI's got these nice large MTUs.
|
||||
*/
|
||||
if ((new_mtu < 68) || (new_mtu > 65280))
|
||||
return -EINVAL;
|
||||
dev->mtu = new_mtu;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* For HIPPI we will actually use the lower 4 bytes of the hardware
|
||||
* address as the I-FIELD rather than the actual hardware address.
|
||||
*/
|
||||
static int hippi_mac_addr(struct net_device *dev, void *p)
|
||||
{
|
||||
struct sockaddr *addr = p;
|
||||
if (netif_running(dev))
|
||||
return -EBUSY;
|
||||
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p)
|
||||
{
|
||||
/* Never send broadcast/multicast ARP messages */
|
||||
p->mcast_probes = 0;
|
||||
|
||||
/* In IPv6 unicast probes are valid even on NBMA,
|
||||
* because they are encapsulated in normal IPv6 protocol.
|
||||
* Should be a generic flag.
|
||||
*/
|
||||
if (p->tbl->family != AF_INET6)
|
||||
p->ucast_probes = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hippi_setup(struct net_device *dev)
|
||||
{
|
||||
dev->set_multicast_list = NULL;
|
||||
dev->change_mtu = hippi_change_mtu;
|
||||
dev->hard_header = hippi_header;
|
||||
dev->rebuild_header = hippi_rebuild_header;
|
||||
dev->set_mac_address = hippi_mac_addr;
|
||||
dev->hard_header_parse = NULL;
|
||||
dev->hard_header_cache = NULL;
|
||||
dev->header_cache_update = NULL;
|
||||
dev->neigh_setup = hippi_neigh_setup_dev;
|
||||
|
||||
/*
|
||||
* We don't support HIPPI `ARP' for the time being, and probably
|
||||
* never will unless someone else implements it. However we
|
||||
* still need a fake ARPHRD to make ifconfig and friends play ball.
|
||||
*/
|
||||
dev->type = ARPHRD_HIPPI;
|
||||
dev->hard_header_len = HIPPI_HLEN;
|
||||
dev->mtu = 65280;
|
||||
dev->addr_len = HIPPI_ALEN;
|
||||
dev->tx_queue_len = 25 /* 5 */;
|
||||
memset(dev->broadcast, 0xFF, HIPPI_ALEN);
|
||||
|
||||
|
||||
/*
|
||||
* HIPPI doesn't support broadcast+multicast and we only use
|
||||
* static ARP tables. ARP is disabled by hippi_neigh_setup_dev.
|
||||
*/
|
||||
dev->flags = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* alloc_hippi_dev - Register HIPPI device
|
||||
* @sizeof_priv: Size of additional driver-private structure to be allocated
|
||||
* for this HIPPI device
|
||||
*
|
||||
* Fill in the fields of the device structure with HIPPI-generic values.
|
||||
*
|
||||
* Constructs a new net device, complete with a private data area of
|
||||
* size @sizeof_priv. A 32-byte (not bit) alignment is enforced for
|
||||
* this private data area.
|
||||
*/
|
||||
|
||||
struct net_device *alloc_hippi_dev(int sizeof_priv)
|
||||
{
|
||||
return alloc_netdev(sizeof_priv, "hip%d", hippi_setup);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(alloc_hippi_dev);
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* NET3: Support for 802.2 demultiplexing off Ethernet (Token ring
|
||||
* is kept separate see p8022tr.c)
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Demultiplex 802.2 encoded protocols. We match the entry by the
|
||||
* SSAP/DSAP pair and then deliver to the registered datalink that
|
||||
* matches. The control byte is ignored and handling of such items
|
||||
* is up to the routine passed the frame.
|
||||
*
|
||||
* Unlike the 802.3 datalink we have a list of 802.2 entries as
|
||||
* there are multiple protocols to demux. The list is currently
|
||||
* short (3 or 4 entries at most). The current demux assumes this.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <net/datalink.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/init.h>
|
||||
#include <net/llc.h>
|
||||
#include <net/p8022.h>
|
||||
|
||||
static int p8022_request(struct datalink_proto *dl, struct sk_buff *skb,
|
||||
unsigned char *dest)
|
||||
{
|
||||
llc_build_and_send_ui_pkt(dl->sap, skb, dest, dl->sap->laddr.lsap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct datalink_proto *register_8022_client(unsigned char type,
|
||||
int (*func)(struct sk_buff *skb,
|
||||
struct net_device *dev,
|
||||
struct packet_type *pt))
|
||||
{
|
||||
struct datalink_proto *proto;
|
||||
|
||||
proto = kmalloc(sizeof(*proto), GFP_ATOMIC);
|
||||
if (proto) {
|
||||
proto->type[0] = type;
|
||||
proto->header_length = 3;
|
||||
proto->request = p8022_request;
|
||||
proto->sap = llc_sap_open(type, func);
|
||||
if (!proto->sap) {
|
||||
kfree(proto);
|
||||
proto = NULL;
|
||||
}
|
||||
}
|
||||
return proto;
|
||||
}
|
||||
|
||||
void unregister_8022_client(struct datalink_proto *proto)
|
||||
{
|
||||
llc_sap_close(proto->sap);
|
||||
kfree(proto);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(register_8022_client);
|
||||
EXPORT_SYMBOL(unregister_8022_client);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* NET3: 802.3 data link hooks used for IPX 802.3
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 802.3 isn't really a protocol data link layer. Some old IPX stuff
|
||||
* uses it however. Note that there is only one 802.3 protocol layer
|
||||
* in the system. We don't currently support different protocols
|
||||
* running raw 802.3 on different devices. Thankfully nobody else
|
||||
* has done anything like the old IPX.
|
||||
*/
|
||||
|
||||
#include <linux/in.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
#include <net/datalink.h>
|
||||
|
||||
/*
|
||||
* Place an 802.3 header on a packet. The driver will do the mac
|
||||
* addresses, we just need to give it the buffer length.
|
||||
*/
|
||||
static int p8023_request(struct datalink_proto *dl,
|
||||
struct sk_buff *skb, unsigned char *dest_node)
|
||||
{
|
||||
struct net_device *dev = skb->dev;
|
||||
|
||||
dev->hard_header(skb, dev, ETH_P_802_3, dest_node, NULL, skb->len);
|
||||
return dev_queue_xmit(skb);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create an 802.3 client. Note there can be only one 802.3 client
|
||||
*/
|
||||
struct datalink_proto *make_8023_client(void)
|
||||
{
|
||||
struct datalink_proto *proto = kmalloc(sizeof(*proto), GFP_ATOMIC);
|
||||
|
||||
if (proto) {
|
||||
proto->header_length = 0;
|
||||
proto->request = p8023_request;
|
||||
}
|
||||
return proto;
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroy the 802.3 client.
|
||||
*/
|
||||
void destroy_8023_client(struct datalink_proto *dl)
|
||||
{
|
||||
if (dl)
|
||||
kfree(dl);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(destroy_8023_client);
|
||||
EXPORT_SYMBOL(make_8023_client);
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* SNAP data link layer. Derived from 802.2
|
||||
*
|
||||
* Alan Cox <Alan.Cox@linux.org>,
|
||||
* from the 802.2 layer by Greg Page.
|
||||
* Merged in additions from Greg Page's psnap.c.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <net/datalink.h>
|
||||
#include <net/llc.h>
|
||||
#include <net/psnap.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
static LIST_HEAD(snap_list);
|
||||
static DEFINE_SPINLOCK(snap_lock);
|
||||
static struct llc_sap *snap_sap;
|
||||
|
||||
/*
|
||||
* Find a snap client by matching the 5 bytes.
|
||||
*/
|
||||
static struct datalink_proto *find_snap_client(unsigned char *desc)
|
||||
{
|
||||
struct list_head *entry;
|
||||
struct datalink_proto *proto = NULL, *p;
|
||||
|
||||
list_for_each_rcu(entry, &snap_list) {
|
||||
p = list_entry(entry, struct datalink_proto, node);
|
||||
if (!memcmp(p->type, desc, 5)) {
|
||||
proto = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return proto;
|
||||
}
|
||||
|
||||
/*
|
||||
* A SNAP packet has arrived
|
||||
*/
|
||||
static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
struct packet_type *pt)
|
||||
{
|
||||
int rc = 1;
|
||||
struct datalink_proto *proto;
|
||||
static struct packet_type snap_packet_type = {
|
||||
.type = __constant_htons(ETH_P_SNAP),
|
||||
};
|
||||
|
||||
rcu_read_lock();
|
||||
proto = find_snap_client(skb->h.raw);
|
||||
if (proto) {
|
||||
/* Pass the frame on. */
|
||||
skb->h.raw += 5;
|
||||
skb_pull(skb, 5);
|
||||
rc = proto->rcvfunc(skb, dev, &snap_packet_type);
|
||||
} else {
|
||||
skb->sk = NULL;
|
||||
kfree_skb(skb);
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
rcu_read_unlock();
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put a SNAP header on a frame and pass to 802.2
|
||||
*/
|
||||
static int snap_request(struct datalink_proto *dl,
|
||||
struct sk_buff *skb, u8 *dest)
|
||||
{
|
||||
memcpy(skb_push(skb, 5), dl->type, 5);
|
||||
llc_build_and_send_ui_pkt(snap_sap, skb, dest, snap_sap->laddr.lsap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up the SNAP layer
|
||||
*/
|
||||
EXPORT_SYMBOL(register_snap_client);
|
||||
EXPORT_SYMBOL(unregister_snap_client);
|
||||
|
||||
static char snap_err_msg[] __initdata =
|
||||
KERN_CRIT "SNAP - unable to register with 802.2\n";
|
||||
|
||||
static int __init snap_init(void)
|
||||
{
|
||||
snap_sap = llc_sap_open(0xAA, snap_rcv);
|
||||
|
||||
if (!snap_sap)
|
||||
printk(snap_err_msg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_init(snap_init);
|
||||
|
||||
static void __exit snap_exit(void)
|
||||
{
|
||||
llc_sap_close(snap_sap);
|
||||
}
|
||||
|
||||
module_exit(snap_exit);
|
||||
|
||||
|
||||
/*
|
||||
* Register SNAP clients. We don't yet use this for IP.
|
||||
*/
|
||||
struct datalink_proto *register_snap_client(unsigned char *desc,
|
||||
int (*rcvfunc)(struct sk_buff *,
|
||||
struct net_device *,
|
||||
struct packet_type *))
|
||||
{
|
||||
struct datalink_proto *proto = NULL;
|
||||
|
||||
spin_lock_bh(&snap_lock);
|
||||
|
||||
if (find_snap_client(desc))
|
||||
goto out;
|
||||
|
||||
proto = kmalloc(sizeof(*proto), GFP_ATOMIC);
|
||||
if (proto) {
|
||||
memcpy(proto->type, desc,5);
|
||||
proto->rcvfunc = rcvfunc;
|
||||
proto->header_length = 5 + 3; /* snap + 802.2 */
|
||||
proto->request = snap_request;
|
||||
list_add_rcu(&proto->node, &snap_list);
|
||||
}
|
||||
out:
|
||||
spin_unlock_bh(&snap_lock);
|
||||
|
||||
synchronize_net();
|
||||
return proto;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unregister SNAP clients. Protocols no longer want to play with us ...
|
||||
*/
|
||||
void unregister_snap_client(struct datalink_proto *proto)
|
||||
{
|
||||
spin_lock_bh(&snap_lock);
|
||||
list_del_rcu(&proto->node);
|
||||
spin_unlock_bh(&snap_lock);
|
||||
|
||||
synchronize_net();
|
||||
|
||||
kfree(proto);
|
||||
}
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -0,0 +1,33 @@
|
||||
/* -*- linux-c -*-
|
||||
* sysctl_net_802.c: sysctl interface to net 802 subsystem.
|
||||
*
|
||||
* Begun April 1, 1996, Mike Shaver.
|
||||
* Added /proc/sys/net/802 directory entry (empty =) ). [MS]
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/mm.h>
|
||||
#include <linux/sysctl.h>
|
||||
#include <linux/config.h>
|
||||
|
||||
#ifdef CONFIG_TR
|
||||
extern int sysctl_tr_rif_timeout;
|
||||
#endif
|
||||
|
||||
struct ctl_table tr_table[] = {
|
||||
#ifdef CONFIG_TR
|
||||
{
|
||||
.ctl_name = NET_TR_RIF_TIMEOUT,
|
||||
.procname = "rif_timeout",
|
||||
.data = &sysctl_tr_rif_timeout,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dointvec
|
||||
},
|
||||
#endif /* CONFIG_TR */
|
||||
{ 0 },
|
||||
};
|
||||
+645
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Makefile for the Linux VLAN layer.
|
||||
#
|
||||
|
||||
obj-$(CONFIG_VLAN_8021Q) += 8021q.o
|
||||
|
||||
8021q-objs := vlan.o vlan_dev.o
|
||||
|
||||
ifeq ($(CONFIG_PROC_FS),y)
|
||||
8021q-objs += vlanproc.o
|
||||
endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,72 @@
|
||||
#ifndef __BEN_VLAN_802_1Q_INC__
|
||||
#define __BEN_VLAN_802_1Q_INC__
|
||||
|
||||
#include <linux/if_vlan.h>
|
||||
|
||||
/* Uncomment this if you want debug traces to be shown. */
|
||||
/* #define VLAN_DEBUG */
|
||||
|
||||
#define VLAN_ERR KERN_ERR
|
||||
#define VLAN_INF KERN_INFO
|
||||
#define VLAN_DBG KERN_ALERT /* change these... to debug, having a hard time
|
||||
* changing the log level at run-time..for some reason.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
These I use for memory debugging. I feared a leak at one time, but
|
||||
I never found it..and the problem seems to have dissappeared. Still,
|
||||
I'll bet they might prove useful again... --Ben
|
||||
|
||||
|
||||
#define VLAN_MEM_DBG(x, y, z) printk(VLAN_DBG "%s: " x, __FUNCTION__, y, z);
|
||||
#define VLAN_FMEM_DBG(x, y) printk(VLAN_DBG "%s: " x, __FUNCTION__, y);
|
||||
*/
|
||||
|
||||
/* This way they don't do anything! */
|
||||
#define VLAN_MEM_DBG(x, y, z)
|
||||
#define VLAN_FMEM_DBG(x, y)
|
||||
|
||||
|
||||
extern unsigned short vlan_name_type;
|
||||
|
||||
#define VLAN_GRP_HASH_SHIFT 5
|
||||
#define VLAN_GRP_HASH_SIZE (1 << VLAN_GRP_HASH_SHIFT)
|
||||
#define VLAN_GRP_HASH_MASK (VLAN_GRP_HASH_SIZE - 1)
|
||||
|
||||
/* Find a VLAN device by the MAC address of its Ethernet device, and
|
||||
* it's VLAN ID. The default configuration is to have VLAN's scope
|
||||
* to be box-wide, so the MAC will be ignored. The mac will only be
|
||||
* looked at if we are configured to have a separate set of VLANs per
|
||||
* each MAC addressable interface. Note that this latter option does
|
||||
* NOT follow the spec for VLANs, but may be useful for doing very
|
||||
* large quantities of VLAN MUX/DEMUX onto FrameRelay or ATM PVCs.
|
||||
*
|
||||
* Must be invoked with rcu_read_lock (ie preempt disabled)
|
||||
* or with RTNL.
|
||||
*/
|
||||
struct net_device *__find_vlan_dev(struct net_device* real_dev,
|
||||
unsigned short VID); /* vlan.c */
|
||||
|
||||
/* found in vlan_dev.c */
|
||||
int vlan_dev_rebuild_header(struct sk_buff *skb);
|
||||
int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
|
||||
struct packet_type* ptype);
|
||||
int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type, void *daddr, void *saddr,
|
||||
unsigned len);
|
||||
int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
|
||||
int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
|
||||
int vlan_dev_change_mtu(struct net_device *dev, int new_mtu);
|
||||
int vlan_dev_set_mac_address(struct net_device *dev, void* addr);
|
||||
int vlan_dev_open(struct net_device* dev);
|
||||
int vlan_dev_stop(struct net_device* dev);
|
||||
int vlan_dev_ioctl(struct net_device* dev, struct ifreq *ifr, int cmd);
|
||||
int vlan_dev_set_ingress_priority(char* dev_name, __u32 skb_prio, short vlan_prio);
|
||||
int vlan_dev_set_egress_priority(char* dev_name, __u32 skb_prio, short vlan_prio);
|
||||
int vlan_dev_set_vlan_flag(char* dev_name, __u32 flag, short flag_val);
|
||||
int vlan_dev_get_realdev_name(const char* dev_name, char* result);
|
||||
int vlan_dev_get_vid(const char* dev_name, unsigned short* result);
|
||||
void vlan_dev_set_multicast_list(struct net_device *vlan_dev);
|
||||
|
||||
#endif /* !(__BEN_VLAN_802_1Q_INC__) */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,357 @@
|
||||
/******************************************************************************
|
||||
* vlanproc.c VLAN Module. /proc filesystem interface.
|
||||
*
|
||||
* This module is completely hardware-independent and provides
|
||||
* access to the router using Linux /proc filesystem.
|
||||
*
|
||||
* Author: Ben Greear, <greearb@candelatech.com> coppied from wanproc.c
|
||||
* by: Gene Kozin <genek@compuserve.com>
|
||||
*
|
||||
* Copyright: (c) 1998 Ben Greear
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
* Jan 20, 1998 Ben Greear Initial Version
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/stddef.h> /* offsetof(), etc. */
|
||||
#include <linux/errno.h> /* return codes */
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h> /* kmalloc(), kfree() */
|
||||
#include <linux/mm.h> /* verify_area(), etc. */
|
||||
#include <linux/string.h> /* inline mem*, str* functions */
|
||||
#include <linux/init.h> /* __initfunc et al. */
|
||||
#include <asm/byteorder.h> /* htons(), etc. */
|
||||
#include <asm/uaccess.h> /* copy_to_user */
|
||||
#include <asm/io.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include "vlanproc.h"
|
||||
#include "vlan.h"
|
||||
|
||||
/****** Function Prototypes *************************************************/
|
||||
|
||||
/* Methods for preparing data for reading proc entries */
|
||||
static int vlan_seq_show(struct seq_file *seq, void *v);
|
||||
static void *vlan_seq_start(struct seq_file *seq, loff_t *pos);
|
||||
static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos);
|
||||
static void vlan_seq_stop(struct seq_file *seq, void *);
|
||||
static int vlandev_seq_show(struct seq_file *seq, void *v);
|
||||
|
||||
/*
|
||||
* Global Data
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Names of the proc directory entries
|
||||
*/
|
||||
|
||||
static const char name_root[] = "vlan";
|
||||
static const char name_conf[] = "config";
|
||||
|
||||
/*
|
||||
* Structures for interfacing with the /proc filesystem.
|
||||
* VLAN creates its own directory /proc/net/vlan with the folowing
|
||||
* entries:
|
||||
* config device status/configuration
|
||||
* <device> entry for each device
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic /proc/net/vlan/<file> file and inode operations
|
||||
*/
|
||||
|
||||
static struct seq_operations vlan_seq_ops = {
|
||||
.start = vlan_seq_start,
|
||||
.next = vlan_seq_next,
|
||||
.stop = vlan_seq_stop,
|
||||
.show = vlan_seq_show,
|
||||
};
|
||||
|
||||
static int vlan_seq_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open(file, &vlan_seq_ops);
|
||||
}
|
||||
|
||||
static struct file_operations vlan_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = vlan_seq_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
|
||||
/*
|
||||
* /proc/net/vlan/<device> file and inode operations
|
||||
*/
|
||||
|
||||
static int vlandev_seq_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, vlandev_seq_show, PDE(inode)->data);
|
||||
}
|
||||
|
||||
static struct file_operations vlandev_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = vlandev_seq_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
/*
|
||||
* Proc filesystem derectory entries.
|
||||
*/
|
||||
|
||||
/*
|
||||
* /proc/net/vlan
|
||||
*/
|
||||
|
||||
static struct proc_dir_entry *proc_vlan_dir;
|
||||
|
||||
/*
|
||||
* /proc/net/vlan/config
|
||||
*/
|
||||
|
||||
static struct proc_dir_entry *proc_vlan_conf;
|
||||
|
||||
/* Strings */
|
||||
static const char *vlan_name_type_str[VLAN_NAME_TYPE_HIGHEST] = {
|
||||
[VLAN_NAME_TYPE_RAW_PLUS_VID] = "VLAN_NAME_TYPE_RAW_PLUS_VID",
|
||||
[VLAN_NAME_TYPE_PLUS_VID_NO_PAD] = "VLAN_NAME_TYPE_PLUS_VID_NO_PAD",
|
||||
[VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD]= "VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD",
|
||||
[VLAN_NAME_TYPE_PLUS_VID] = "VLAN_NAME_TYPE_PLUS_VID",
|
||||
};
|
||||
/*
|
||||
* Interface functions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Clean up /proc/net/vlan entries
|
||||
*/
|
||||
|
||||
void vlan_proc_cleanup(void)
|
||||
{
|
||||
if (proc_vlan_conf)
|
||||
remove_proc_entry(name_conf, proc_vlan_dir);
|
||||
|
||||
if (proc_vlan_dir)
|
||||
proc_net_remove(name_root);
|
||||
|
||||
/* Dynamically added entries should be cleaned up as their vlan_device
|
||||
* is removed, so we should not have to take care of it here...
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Create /proc/net/vlan entries
|
||||
*/
|
||||
|
||||
int __init vlan_proc_init(void)
|
||||
{
|
||||
proc_vlan_dir = proc_mkdir(name_root, proc_net);
|
||||
if (proc_vlan_dir) {
|
||||
proc_vlan_conf = create_proc_entry(name_conf,
|
||||
S_IFREG|S_IRUSR|S_IWUSR,
|
||||
proc_vlan_dir);
|
||||
if (proc_vlan_conf) {
|
||||
proc_vlan_conf->proc_fops = &vlan_fops;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
vlan_proc_cleanup();
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add directory entry for VLAN device.
|
||||
*/
|
||||
|
||||
int vlan_proc_add_dev (struct net_device *vlandev)
|
||||
{
|
||||
struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev);
|
||||
|
||||
if (!(vlandev->priv_flags & IFF_802_1Q_VLAN)) {
|
||||
printk(KERN_ERR
|
||||
"ERROR: vlan_proc_add, device -:%s:- is NOT a VLAN\n",
|
||||
vlandev->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_info->dent = create_proc_entry(vlandev->name,
|
||||
S_IFREG|S_IRUSR|S_IWUSR,
|
||||
proc_vlan_dir);
|
||||
if (!dev_info->dent)
|
||||
return -ENOBUFS;
|
||||
|
||||
dev_info->dent->proc_fops = &vlandev_fops;
|
||||
dev_info->dent->data = vlandev;
|
||||
|
||||
#ifdef VLAN_DEBUG
|
||||
printk(KERN_ERR "vlan_proc_add, device -:%s:- being added.\n",
|
||||
vlandev->name);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete directory entry for VLAN device.
|
||||
*/
|
||||
int vlan_proc_rem_dev(struct net_device *vlandev)
|
||||
{
|
||||
if (!vlandev) {
|
||||
printk(VLAN_ERR "%s: invalid argument: %p\n",
|
||||
__FUNCTION__, vlandev);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!(vlandev->priv_flags & IFF_802_1Q_VLAN)) {
|
||||
printk(VLAN_DBG "%s: invalid argument, device: %s is not a VLAN device, priv_flags: 0x%4hX.\n",
|
||||
__FUNCTION__, vlandev->name, vlandev->priv_flags);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#ifdef VLAN_DEBUG
|
||||
printk(VLAN_DBG "%s: dev: %p\n", __FUNCTION__, vlandev);
|
||||
#endif
|
||||
|
||||
/** NOTE: This will consume the memory pointed to by dent, it seems. */
|
||||
if (VLAN_DEV_INFO(vlandev)->dent) {
|
||||
remove_proc_entry(VLAN_DEV_INFO(vlandev)->dent->name, proc_vlan_dir);
|
||||
VLAN_DEV_INFO(vlandev)->dent = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****** Proc filesystem entry points ****************************************/
|
||||
|
||||
/*
|
||||
* The following few functions build the content of /proc/net/vlan/config
|
||||
*/
|
||||
|
||||
/* starting at dev, find a VLAN device */
|
||||
static struct net_device *vlan_skip(struct net_device *dev)
|
||||
{
|
||||
while (dev && !(dev->priv_flags & IFF_802_1Q_VLAN))
|
||||
dev = dev->next;
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
/* start read of /proc/net/vlan/config */
|
||||
static void *vlan_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
{
|
||||
struct net_device *dev;
|
||||
loff_t i = 1;
|
||||
|
||||
read_lock(&dev_base_lock);
|
||||
|
||||
if (*pos == 0)
|
||||
return SEQ_START_TOKEN;
|
||||
|
||||
for (dev = vlan_skip(dev_base); dev && i < *pos;
|
||||
dev = vlan_skip(dev->next), ++i);
|
||||
|
||||
return (i == *pos) ? dev : NULL;
|
||||
}
|
||||
|
||||
static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
||||
{
|
||||
++*pos;
|
||||
|
||||
return vlan_skip((v == SEQ_START_TOKEN)
|
||||
? dev_base
|
||||
: ((struct net_device *)v)->next);
|
||||
}
|
||||
|
||||
static void vlan_seq_stop(struct seq_file *seq, void *v)
|
||||
{
|
||||
read_unlock(&dev_base_lock);
|
||||
}
|
||||
|
||||
static int vlan_seq_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
if (v == SEQ_START_TOKEN) {
|
||||
const char *nmtype = NULL;
|
||||
|
||||
seq_puts(seq, "VLAN Dev name | VLAN ID\n");
|
||||
|
||||
if (vlan_name_type < ARRAY_SIZE(vlan_name_type_str))
|
||||
nmtype = vlan_name_type_str[vlan_name_type];
|
||||
|
||||
seq_printf(seq, "Name-Type: %s\n",
|
||||
nmtype ? nmtype : "UNKNOWN" );
|
||||
} else {
|
||||
const struct net_device *vlandev = v;
|
||||
const struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev);
|
||||
|
||||
seq_printf(seq, "%-15s| %d | %s\n", vlandev->name,
|
||||
dev_info->vlan_id, dev_info->real_dev->name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vlandev_seq_show(struct seq_file *seq, void *offset)
|
||||
{
|
||||
struct net_device *vlandev = (struct net_device *) seq->private;
|
||||
const struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev);
|
||||
struct net_device_stats *stats;
|
||||
static const char fmt[] = "%30s %12lu\n";
|
||||
int i;
|
||||
|
||||
if ((vlandev == NULL) || (!(vlandev->priv_flags & IFF_802_1Q_VLAN)))
|
||||
return 0;
|
||||
|
||||
seq_printf(seq, "%s VID: %d REORDER_HDR: %i dev->priv_flags: %hx\n",
|
||||
vlandev->name, dev_info->vlan_id,
|
||||
(int)(dev_info->flags & 1), vlandev->priv_flags);
|
||||
|
||||
|
||||
stats = vlan_dev_get_stats(vlandev);
|
||||
|
||||
seq_printf(seq, fmt, "total frames received", stats->rx_packets);
|
||||
seq_printf(seq, fmt, "total bytes received", stats->rx_bytes);
|
||||
seq_printf(seq, fmt, "Broadcast/Multicast Rcvd", stats->multicast);
|
||||
seq_puts(seq, "\n");
|
||||
seq_printf(seq, fmt, "total frames transmitted", stats->tx_packets);
|
||||
seq_printf(seq, fmt, "total bytes transmitted", stats->tx_bytes);
|
||||
seq_printf(seq, fmt, "total headroom inc",
|
||||
dev_info->cnt_inc_headroom_on_tx);
|
||||
seq_printf(seq, fmt, "total encap on xmit",
|
||||
dev_info->cnt_encap_on_xmit);
|
||||
seq_printf(seq, "Device: %s", dev_info->real_dev->name);
|
||||
/* now show all PRIORITY mappings relating to this VLAN */
|
||||
seq_printf(seq,
|
||||
"\nINGRESS priority mappings: 0:%lu 1:%lu 2:%lu 3:%lu 4:%lu 5:%lu 6:%lu 7:%lu\n",
|
||||
dev_info->ingress_priority_map[0],
|
||||
dev_info->ingress_priority_map[1],
|
||||
dev_info->ingress_priority_map[2],
|
||||
dev_info->ingress_priority_map[3],
|
||||
dev_info->ingress_priority_map[4],
|
||||
dev_info->ingress_priority_map[5],
|
||||
dev_info->ingress_priority_map[6],
|
||||
dev_info->ingress_priority_map[7]);
|
||||
|
||||
seq_printf(seq, "EGRESSS priority Mappings: ");
|
||||
for (i = 0; i < 16; i++) {
|
||||
const struct vlan_priority_tci_mapping *mp
|
||||
= dev_info->egress_priority_map[i];
|
||||
while (mp) {
|
||||
seq_printf(seq, "%lu:%hu ",
|
||||
mp->priority, ((mp->vlan_qos >> 13) & 0x7));
|
||||
mp = mp->next;
|
||||
}
|
||||
}
|
||||
seq_puts(seq, "\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef __BEN_VLAN_PROC_INC__
|
||||
#define __BEN_VLAN_PROC_INC__
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
int vlan_proc_init(void);
|
||||
int vlan_proc_rem_dev(struct net_device *vlandev);
|
||||
int vlan_proc_add_dev (struct net_device *vlandev);
|
||||
void vlan_proc_cleanup (void);
|
||||
|
||||
#else /* No CONFIG_PROC_FS */
|
||||
|
||||
#define vlan_proc_init() (0)
|
||||
#define vlan_proc_cleanup() do {} while(0)
|
||||
#define vlan_proc_add_dev(dev) ({(void)(dev), 0;})
|
||||
#define vlan_proc_rem_dev(dev) ({(void)(dev), 0;})
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !(__BEN_VLAN_PROC_INC__) */
|
||||
+646
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# Makefile for the linux networking.
|
||||
#
|
||||
# 2 Sep 2000, Christoph Hellwig <hch@infradead.org>
|
||||
# Rewritten to use lists instead of if-statements.
|
||||
#
|
||||
|
||||
obj-y := nonet.o
|
||||
|
||||
obj-$(CONFIG_NET) := socket.o core/
|
||||
|
||||
tmp-$(CONFIG_COMPAT) := compat.o
|
||||
obj-$(CONFIG_NET) += $(tmp-y)
|
||||
|
||||
# LLC has to be linked before the files in net/802/
|
||||
obj-$(CONFIG_LLC) += llc/
|
||||
obj-$(CONFIG_NET) += ethernet/ 802/ sched/ netlink/
|
||||
obj-$(CONFIG_INET) += ipv4/
|
||||
obj-$(CONFIG_XFRM) += xfrm/
|
||||
obj-$(CONFIG_UNIX) += unix/
|
||||
ifneq ($(CONFIG_IPV6),)
|
||||
obj-y += ipv6/
|
||||
endif
|
||||
obj-$(CONFIG_PACKET) += packet/
|
||||
obj-$(CONFIG_NET_KEY) += key/
|
||||
obj-$(CONFIG_NET_SCHED) += sched/
|
||||
obj-$(CONFIG_BRIDGE) += bridge/
|
||||
obj-$(CONFIG_IPX) += ipx/
|
||||
obj-$(CONFIG_ATALK) += appletalk/
|
||||
obj-$(CONFIG_WAN_ROUTER) += wanrouter/
|
||||
obj-$(CONFIG_X25) += x25/
|
||||
obj-$(CONFIG_LAPB) += lapb/
|
||||
obj-$(CONFIG_NETROM) += netrom/
|
||||
obj-$(CONFIG_ROSE) += rose/
|
||||
obj-$(CONFIG_AX25) += ax25/
|
||||
obj-$(CONFIG_IRDA) += irda/
|
||||
obj-$(CONFIG_BT) += bluetooth/
|
||||
obj-$(CONFIG_SUNRPC) += sunrpc/
|
||||
obj-$(CONFIG_RXRPC) += rxrpc/
|
||||
obj-$(CONFIG_ATM) += atm/
|
||||
obj-$(CONFIG_DECNET) += decnet/
|
||||
obj-$(CONFIG_ECONET) += econet/
|
||||
obj-$(CONFIG_VLAN_8021Q) += 8021q/
|
||||
obj-$(CONFIG_IP_SCTP) += sctp/
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
obj-$(CONFIG_SYSCTL) += sysctl_net.o
|
||||
endif
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
The following parameters should be tunable at compile time. Some of them
|
||||
exist as sysctls too.
|
||||
|
||||
This is far from complete
|
||||
|
||||
Item Description
|
||||
----------------------------------------------------------------------------
|
||||
MAX_LINKS Maximum number of netlink minor devices. (1-32)
|
||||
RIF_TABLE_SIZE Token ring RIF cache size (tunable)
|
||||
AARP_HASH_SIZE Size of Appletalk hash table (tunable)
|
||||
AX25_DEF_T1 AX.25 parameters. These are all tunable via
|
||||
AX25_DEF_T2 SIOCAX25SETPARMS
|
||||
AX25_DEF_T3 T1-T3,N2 have the meanings in the specification
|
||||
AX25_DEF_N2
|
||||
AX25_DEF_AXDEFMODE 8 = normal 128 is PE1CHL extended
|
||||
AX25_DEF_IPDEFMODE 'D' - datagram 'V' - virtual connection
|
||||
AX25_DEF_BACKOFF 'E'xponential 'L'inear
|
||||
AX25_DEF_NETROM Allow netrom 1=Y
|
||||
AX25_DF_TEXT Allow PID=Text 1=Y
|
||||
AX25_DEF_WINDOW Window for normal mode
|
||||
AX25_DEF_EWINDOW Window for PE1CHL mode
|
||||
AX25_DEF_DIGI 1 for inband 2 for cross band 3 for both
|
||||
AX25_DEF_CONMODE Allow connected modes 1=Yes
|
||||
AX25_ROUTE_MAX AX.25 route cache size - no currently tunable
|
||||
Unnamed (16) Number of protocol hash slots (tunable)
|
||||
DEV_NUMBUFFS Number of priority levels (not easily tunable)
|
||||
Unnamed (300) Maximum packet backlog queue (tunable)
|
||||
MAX_IOVEC Maximum number of iovecs in a message (tunable)
|
||||
MIN_WINDOW Offered minimum window (tunable)
|
||||
MAX_WINDOW Offered maximum window (tunable)
|
||||
MAX_HEADER Largest physical header (tunable)
|
||||
MAX_ADDR_LEN Largest physical address (tunable)
|
||||
SOCK_ARRAY_SIZE IP socket array hash size (tunable)
|
||||
IP_MAX_MEMBERSHIPS Largest number of groups per socket (BSD style) (tunable)
|
||||
16 Hard coded constant for amount of room allowed for
|
||||
cache align and faster forwarding (tunable)
|
||||
IP_FRAG_TIME Time we hold a fragment for. (tunable)
|
||||
PORT_MASQ_BEGIN First port reserved for masquerade (tunable)
|
||||
PORT_MASQ_END Last port used for masquerade (tunable)
|
||||
MASQUERADE_EXPIRE_TCP_FIN Time we keep a masquerade for after a FIN
|
||||
MASQUERADE_EXPIRE_UDP Time we keep a UDP masquerade for (tunable)
|
||||
MAXVIFS Maximum mrouted vifs (1-32)
|
||||
MFC_LINES Lines in the multicast router cache (tunable)
|
||||
|
||||
NetROM parameters are tunable via an ioctl passing a struct
|
||||
|
||||
4000 Size a Unix domain socket malloc falls back to
|
||||
(tunable) should be 8K - a bit for 8K machines like
|
||||
the ALPHA
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# Makefile for the Linux AppleTalk layer.
|
||||
#
|
||||
|
||||
obj-$(CONFIG_ATALK) += appletalk.o
|
||||
|
||||
appletalk-y := aarp.o ddp.o dev.o
|
||||
appletalk-$(CONFIG_PROC_FS) += atalk_proc.o
|
||||
appletalk-$(CONFIG_SYSCTL) += sysctl_net_atalk.o
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user