mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (45 commits)
[IPV4]: Restore multipath routing after rt_next changes.
[XFRM] IPV6: Fix outbound RO transformation which is broken by IPsec tunnel patch.
[NET]: Reorder fields of struct dst_entry
[DECNET]: Convert decnet route to use the new dst_entry 'next' pointer
[IPV6]: Convert ipv6 route to use the new dst_entry 'next' pointer
[IPV4]: Convert ipv4 route to use the new dst_entry 'next' pointer
[NET]: Introduce union in struct dst_entry to hold 'next' pointer
[DECNET]: fix misannotation of linkinfo_dn
[DECNET]: FRA_{DST,SRC} are le16 for decnet
[UDP]: UDP can use sk_hash to speedup lookups
[NET]: Fix whitespace errors.
[NET] XFRM: Fix whitespace errors.
[NET] X25: Fix whitespace errors.
[NET] WANROUTER: Fix whitespace errors.
[NET] UNIX: Fix whitespace errors.
[NET] TIPC: Fix whitespace errors.
[NET] SUNRPC: Fix whitespace errors.
[NET] SCTP: Fix whitespace errors.
[NET] SCHED: Fix whitespace errors.
[NET] RXRPC: Fix whitespace errors.
...
This commit is contained in:
@@ -68,9 +68,10 @@ extern void dn_rt_cache_flush(int delay);
|
||||
struct dn_route {
|
||||
union {
|
||||
struct dst_entry dst;
|
||||
struct dn_route *rt_next;
|
||||
} u;
|
||||
|
||||
struct flowi fl;
|
||||
|
||||
__le16 rt_saddr;
|
||||
__le16 rt_daddr;
|
||||
__le16 rt_gateway;
|
||||
@@ -80,8 +81,6 @@ struct dn_route {
|
||||
|
||||
unsigned rt_flags;
|
||||
unsigned rt_type;
|
||||
|
||||
struct flowi fl;
|
||||
};
|
||||
|
||||
extern void dn_route_init(void);
|
||||
|
||||
@@ -37,9 +37,7 @@ struct sk_buff;
|
||||
|
||||
struct dst_entry
|
||||
{
|
||||
struct dst_entry *next;
|
||||
atomic_t __refcnt; /* client references */
|
||||
int __use;
|
||||
struct rcu_head rcu_head;
|
||||
struct dst_entry *child;
|
||||
struct net_device *dev;
|
||||
short error;
|
||||
@@ -50,7 +48,6 @@ struct dst_entry
|
||||
#define DST_NOPOLICY 4
|
||||
#define DST_NOHASH 8
|
||||
#define DST_BALANCED 0x10
|
||||
unsigned long lastuse;
|
||||
unsigned long expires;
|
||||
|
||||
unsigned short header_len; /* more space at head required */
|
||||
@@ -75,8 +72,16 @@ struct dst_entry
|
||||
#endif
|
||||
|
||||
struct dst_ops *ops;
|
||||
struct rcu_head rcu_head;
|
||||
|
||||
unsigned long lastuse;
|
||||
atomic_t __refcnt; /* client references */
|
||||
int __use;
|
||||
union {
|
||||
struct dst_entry *next;
|
||||
struct rtable *rt_next;
|
||||
struct rt6_info *rt6_next;
|
||||
struct dn_route *dn_next;
|
||||
};
|
||||
char info[0];
|
||||
};
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ struct rt6_info
|
||||
{
|
||||
union {
|
||||
struct dst_entry dst;
|
||||
struct rt6_info *next;
|
||||
} u;
|
||||
|
||||
struct inet6_dev *rt6i_idev;
|
||||
|
||||
@@ -53,9 +53,11 @@ struct rtable
|
||||
union
|
||||
{
|
||||
struct dst_entry dst;
|
||||
struct rtable *rt_next;
|
||||
} u;
|
||||
|
||||
/* Cache lookup keys */
|
||||
struct flowi fl;
|
||||
|
||||
struct in_device *idev;
|
||||
|
||||
unsigned rt_flags;
|
||||
@@ -69,9 +71,6 @@ struct rtable
|
||||
/* Info on neighbour */
|
||||
__be32 rt_gateway;
|
||||
|
||||
/* Cache lookup keys */
|
||||
struct flowi fl;
|
||||
|
||||
/* Miscellaneous cached information */
|
||||
__be32 rt_spec_dst; /* RFC1122 specific destination */
|
||||
struct inet_peer *peer; /* long-living peer info */
|
||||
|
||||
24
net/802/fc.c
24
net/802/fc.c
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* 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
|
||||
@@ -31,18 +31,18 @@
|
||||
#include <net/arp.h>
|
||||
|
||||
/*
|
||||
* Put the headers on a Fibre Channel packet.
|
||||
* 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)
|
||||
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
|
||||
/*
|
||||
* 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)
|
||||
@@ -60,7 +60,7 @@ static int fc_header(struct sk_buff *skb, struct net_device *dev,
|
||||
else
|
||||
{
|
||||
hdr_len = sizeof(struct fch_hdr);
|
||||
fch = (struct fch_hdr *)skb_push(skb, hdr_len);
|
||||
fch = (struct fch_hdr *)skb_push(skb, hdr_len);
|
||||
}
|
||||
|
||||
if(saddr)
|
||||
@@ -68,20 +68,20 @@ static int fc_header(struct sk_buff *skb, struct net_device *dev,
|
||||
else
|
||||
memcpy(fch->saddr,dev->dev_addr,dev->addr_len);
|
||||
|
||||
if(daddr)
|
||||
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)
|
||||
|
||||
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));
|
||||
@@ -100,7 +100,7 @@ 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;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* 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
|
||||
@@ -25,7 +25,7 @@
|
||||
* Alan Cox : New arp/rebuild header
|
||||
* Maciej W. Rozycki : IPv6 support
|
||||
*/
|
||||
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <asm/system.h>
|
||||
#include <linux/types.h>
|
||||
@@ -57,7 +57,7 @@ static int fddi_header(struct sk_buff *skb, struct net_device *dev,
|
||||
{
|
||||
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);
|
||||
@@ -74,7 +74,7 @@ static int fddi_header(struct sk_buff *skb, struct net_device *dev,
|
||||
}
|
||||
|
||||
/* Set the source and destination hardware addresses */
|
||||
|
||||
|
||||
if (saddr != NULL)
|
||||
memcpy(fddi->saddr, saddr, dev->addr_len);
|
||||
else
|
||||
@@ -95,7 +95,7 @@ static int fddi_header(struct sk_buff *skb, struct net_device *dev,
|
||||
* (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;
|
||||
@@ -105,7 +105,7 @@ static int fddi_rebuild_header(struct sk_buff *skb)
|
||||
/* Try to get ARP to resolve the header and fill destination address */
|
||||
return arp_find(fddi->daddr, skb);
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
printk("%s: Don't know how to resolve type %04X addresses.\n",
|
||||
skb->dev->name, ntohs(fddi->hdr.llc_snap.ethertype));
|
||||
@@ -120,19 +120,19 @@ static int fddi_rebuild_header(struct sk_buff *skb)
|
||||
* up. It's used to fill in specific skb fields and to set
|
||||
* the proper pointer to the start of packet data (skb->data).
|
||||
*/
|
||||
|
||||
|
||||
__be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct fddihdr *fddi = (struct fddihdr *)skb->data;
|
||||
__be16 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);
|
||||
@@ -143,9 +143,9 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
|
||||
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)
|
||||
@@ -153,7 +153,7 @@ __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
|
||||
else
|
||||
skb->pkt_type = PACKET_MULTICAST;
|
||||
}
|
||||
|
||||
|
||||
else if (dev->flags & IFF_PROMISC)
|
||||
{
|
||||
if (memcmp(fddi->daddr, dev->dev_addr, FDDI_K_ALEN))
|
||||
@@ -187,7 +187,7 @@ static void fddi_setup(struct net_device *dev)
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <asm/system.h>
|
||||
|
||||
/*
|
||||
* Create the HIPPI MAC header for an arbitrary protocol layer
|
||||
* 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)
|
||||
@@ -104,8 +104,8 @@ static int hippi_rebuild_header(struct sk_buff *skb)
|
||||
/*
|
||||
* Only IP is currently supported
|
||||
*/
|
||||
|
||||
if(hip->snap.ethertype != __constant_htons(ETH_P_IP))
|
||||
|
||||
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;
|
||||
@@ -122,11 +122,11 @@ static int hippi_rebuild_header(struct sk_buff *skb)
|
||||
/*
|
||||
* Determine the packet's protocol ID.
|
||||
*/
|
||||
|
||||
|
||||
__be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct hippi_hdr *hip;
|
||||
|
||||
|
||||
hip = (struct hippi_hdr *) skb->data;
|
||||
|
||||
/*
|
||||
@@ -173,10 +173,10 @@ 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.
|
||||
* Should be a generic flag.
|
||||
*/
|
||||
if (p->tbl->family != AF_INET6)
|
||||
p->ucast_probes = 0;
|
||||
@@ -193,7 +193,7 @@ static void hippi_setup(struct net_device *dev)
|
||||
dev->hard_header_parse = NULL;
|
||||
dev->hard_header_cache = NULL;
|
||||
dev->header_cache_update = NULL;
|
||||
dev->neigh_setup = hippi_neigh_setup_dev;
|
||||
dev->neigh_setup = hippi_neigh_setup_dev;
|
||||
|
||||
/*
|
||||
* We don't support HIPPI `ARP' for the time being, and probably
|
||||
@@ -210,9 +210,9 @@ static void hippi_setup(struct net_device *dev)
|
||||
|
||||
/*
|
||||
* HIPPI doesn't support broadcast+multicast and we only use
|
||||
* static ARP tables. ARP is disabled by hippi_neigh_setup_dev.
|
||||
* static ARP tables. ARP is disabled by hippi_neigh_setup_dev.
|
||||
*/
|
||||
dev->flags = 0;
|
||||
dev->flags = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -117,7 +117,7 @@ module_exit(snap_exit);
|
||||
*/
|
||||
struct datalink_proto *register_snap_client(unsigned char *desc,
|
||||
int (*rcvfunc)(struct sk_buff *,
|
||||
struct net_device *,
|
||||
struct net_device *,
|
||||
struct packet_type *,
|
||||
struct net_device *))
|
||||
{
|
||||
|
||||
136
net/802/tr.c
136
net/802/tr.c
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* NET3: Token ring 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
|
||||
@@ -12,7 +12,7 @@
|
||||
* 22 Jun 98 Paul Norton <p.norton@computer.org> Rearranged
|
||||
* tr_header and tr_type_trans to handle passing IPX SNAP and
|
||||
* 802.2 through the correct layers. Eliminated tr_reformat.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
@@ -45,7 +45,7 @@ static void rif_check_expire(unsigned long dummy);
|
||||
/*
|
||||
* Each RIF entry we learn is kept this way
|
||||
*/
|
||||
|
||||
|
||||
struct rif_cache {
|
||||
unsigned char addr[TR_ALEN];
|
||||
int iface;
|
||||
@@ -62,7 +62,7 @@ struct rif_cache {
|
||||
* We hash the RIF cache 32 ways. We do after all have to look it
|
||||
* up a lot.
|
||||
*/
|
||||
|
||||
|
||||
static struct rif_cache *rif_table[RIF_TABLE_SIZE];
|
||||
|
||||
static DEFINE_SPINLOCK(rif_lock);
|
||||
@@ -71,7 +71,7 @@ static DEFINE_SPINLOCK(rif_lock);
|
||||
/*
|
||||
* Garbage disposal timer.
|
||||
*/
|
||||
|
||||
|
||||
static struct timer_list rif_timer;
|
||||
|
||||
int sysctl_tr_rif_timeout = 60*10*HZ;
|
||||
@@ -96,16 +96,16 @@ static inline unsigned long rif_hash(const unsigned char *addr)
|
||||
* Put the headers on a token ring packet. Token ring source routing
|
||||
* makes this a little more exciting than on ethernet.
|
||||
*/
|
||||
|
||||
|
||||
static int tr_header(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type,
|
||||
void *daddr, void *saddr, unsigned len)
|
||||
void *daddr, void *saddr, unsigned len)
|
||||
{
|
||||
struct trh_hdr *trh;
|
||||
int hdr_len;
|
||||
|
||||
/*
|
||||
* Add the 802.2 SNAP header if IP as the IPv4/IPv6 code calls
|
||||
/*
|
||||
* Add the 802.2 SNAP header if IP as the IPv4/IPv6 code calls
|
||||
* dev->hard_header directly.
|
||||
*/
|
||||
if (type == ETH_P_IP || type == ETH_P_IPV6 || type == ETH_P_ARP)
|
||||
@@ -123,7 +123,7 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev,
|
||||
else
|
||||
{
|
||||
hdr_len = sizeof(struct trh_hdr);
|
||||
trh = (struct trh_hdr *)skb_push(skb, hdr_len);
|
||||
trh = (struct trh_hdr *)skb_push(skb, hdr_len);
|
||||
}
|
||||
|
||||
trh->ac=AC;
|
||||
@@ -137,8 +137,8 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev,
|
||||
/*
|
||||
* Build the destination and then source route the frame
|
||||
*/
|
||||
|
||||
if(daddr)
|
||||
|
||||
if(daddr)
|
||||
{
|
||||
memcpy(trh->daddr,daddr,dev->addr_len);
|
||||
tr_source_route(skb,trh,dev);
|
||||
@@ -147,13 +147,13 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev,
|
||||
|
||||
return -hdr_len;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* A neighbour discovery of some species (eg arp) has completed. We
|
||||
* can now send the packet.
|
||||
*/
|
||||
|
||||
static int tr_rebuild_header(struct sk_buff *skb)
|
||||
|
||||
static int tr_rebuild_header(struct sk_buff *skb)
|
||||
{
|
||||
struct trh_hdr *trh=(struct trh_hdr *)skb->data;
|
||||
struct trllc *trllc=(struct trllc *)(skb->data+sizeof(struct trh_hdr));
|
||||
@@ -162,7 +162,7 @@ static int tr_rebuild_header(struct sk_buff *skb)
|
||||
/*
|
||||
* FIXME: We don't yet support IPv6 over token rings
|
||||
*/
|
||||
|
||||
|
||||
if(trllc->ethertype != htons(ETH_P_IP)) {
|
||||
printk("tr_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(trllc->ethertype));
|
||||
return 0;
|
||||
@@ -172,39 +172,39 @@ static int tr_rebuild_header(struct sk_buff *skb)
|
||||
if(arp_find(trh->daddr, skb)) {
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
tr_source_route(skb,trh,dev);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
tr_source_route(skb,trh,dev);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Some of this is a bit hackish. We intercept RIF information
|
||||
* used for source routing. We also grab IP directly and don't feed
|
||||
* it via SNAP.
|
||||
*/
|
||||
|
||||
|
||||
__be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
|
||||
struct trh_hdr *trh=(struct trh_hdr *)skb->data;
|
||||
struct trllc *trllc;
|
||||
unsigned riflen=0;
|
||||
|
||||
|
||||
skb->mac.raw = skb->data;
|
||||
|
||||
if(trh->saddr[0] & TR_RII)
|
||||
|
||||
if(trh->saddr[0] & TR_RII)
|
||||
riflen = (ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8;
|
||||
|
||||
trllc = (struct trllc *)(skb->data+sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen);
|
||||
|
||||
skb_pull(skb,sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen);
|
||||
|
||||
if(*trh->daddr & 0x80)
|
||||
if(*trh->daddr & 0x80)
|
||||
{
|
||||
if(!memcmp(trh->daddr,dev->broadcast,TR_ALEN))
|
||||
if(!memcmp(trh->daddr,dev->broadcast,TR_ALEN))
|
||||
skb->pkt_type=PACKET_BROADCAST;
|
||||
else
|
||||
skb->pkt_type=PACKET_MULTICAST;
|
||||
@@ -213,7 +213,7 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
skb->pkt_type=PACKET_MULTICAST;
|
||||
}
|
||||
else if(dev->flags & IFF_PROMISC)
|
||||
else if(dev->flags & IFF_PROMISC)
|
||||
{
|
||||
if(memcmp(trh->daddr, dev->dev_addr, TR_ALEN))
|
||||
skb->pkt_type=PACKET_OTHERHOST;
|
||||
@@ -221,10 +221,10 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
|
||||
|
||||
if ((skb->pkt_type != PACKET_BROADCAST) &&
|
||||
(skb->pkt_type != PACKET_MULTICAST))
|
||||
tr_add_rif_info(trh,dev) ;
|
||||
tr_add_rif_info(trh,dev) ;
|
||||
|
||||
/*
|
||||
* Strip the SNAP header from ARP packets since we don't
|
||||
* Strip the SNAP header from ARP packets since we don't
|
||||
* pass them through to the 802.2/SNAP layers.
|
||||
*/
|
||||
|
||||
@@ -241,32 +241,32 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
|
||||
}
|
||||
|
||||
/*
|
||||
* We try to do source routing...
|
||||
* We try to do source routing...
|
||||
*/
|
||||
|
||||
void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *dev)
|
||||
void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *dev)
|
||||
{
|
||||
int slack;
|
||||
unsigned int hash;
|
||||
struct rif_cache *entry;
|
||||
unsigned char *olddata;
|
||||
unsigned long flags;
|
||||
static const unsigned char mcast_func_addr[]
|
||||
static const unsigned char mcast_func_addr[]
|
||||
= {0xC0,0x00,0x00,0x04,0x00,0x00};
|
||||
|
||||
|
||||
spin_lock_irqsave(&rif_lock, flags);
|
||||
|
||||
/*
|
||||
* Broadcasts are single route as stated in RFC 1042
|
||||
* Broadcasts are single route as stated in RFC 1042
|
||||
*/
|
||||
if( (!memcmp(&(trh->daddr[0]),&(dev->broadcast[0]),TR_ALEN)) ||
|
||||
(!memcmp(&(trh->daddr[0]),&(mcast_func_addr[0]), TR_ALEN)) )
|
||||
{
|
||||
trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK)
|
||||
trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK)
|
||||
| TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST);
|
||||
trh->saddr[0]|=TR_RII;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
hash = rif_hash(trh->daddr);
|
||||
/*
|
||||
@@ -277,7 +277,7 @@ void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *
|
||||
/*
|
||||
* If we found an entry we can route the frame.
|
||||
*/
|
||||
if(entry)
|
||||
if(entry)
|
||||
{
|
||||
#if TR_SR_DEBUG
|
||||
printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0],
|
||||
@@ -287,7 +287,7 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0],
|
||||
{
|
||||
trh->rcf=entry->rcf;
|
||||
memcpy(&trh->rseg[0],&entry->rseg[0],8*sizeof(unsigned short));
|
||||
trh->rcf^=htons(TR_RCF_DIR_BIT);
|
||||
trh->rcf^=htons(TR_RCF_DIR_BIT);
|
||||
trh->rcf&=htons(0x1fff); /* Issam Chehab <ichehab@madge1.demon.co.uk> */
|
||||
|
||||
trh->saddr[0]|=TR_RII;
|
||||
@@ -301,14 +301,14 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0],
|
||||
}
|
||||
entry->last_used=jiffies;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Without the information we simply have to shout
|
||||
* on the wire. The replies should rapidly clean this
|
||||
* situation up.
|
||||
*/
|
||||
trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK)
|
||||
trh->rcf=htons((((sizeof(trh->rcf)) << 8) & TR_RCF_LEN_MASK)
|
||||
| TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST);
|
||||
trh->saddr[0]|=TR_RII;
|
||||
#if TR_SR_DEBUG
|
||||
@@ -320,7 +320,7 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0],
|
||||
/* Compress the RIF here so we don't have to do it in the driver(s) */
|
||||
if (!(trh->saddr[0] & 0x80))
|
||||
slack = 18;
|
||||
else
|
||||
else
|
||||
slack = 18 - ((ntohs(trh->rcf) & TR_RCF_LEN_MASK)>>8);
|
||||
olddata = skb->data;
|
||||
spin_unlock_irqrestore(&rif_lock, flags);
|
||||
@@ -333,7 +333,7 @@ printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0],
|
||||
* We have learned some new RIF information for our source
|
||||
* routing.
|
||||
*/
|
||||
|
||||
|
||||
static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev)
|
||||
{
|
||||
unsigned int hash, rii_p = 0;
|
||||
@@ -343,29 +343,29 @@ static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev)
|
||||
|
||||
spin_lock_irqsave(&rif_lock, flags);
|
||||
saddr0 = trh->saddr[0];
|
||||
|
||||
|
||||
/*
|
||||
* Firstly see if the entry exists
|
||||
*/
|
||||
|
||||
if(trh->saddr[0] & TR_RII)
|
||||
if(trh->saddr[0] & TR_RII)
|
||||
{
|
||||
trh->saddr[0]&=0x7f;
|
||||
if (((ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8) > 2)
|
||||
{
|
||||
rii_p = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hash = rif_hash(trh->saddr);
|
||||
for(entry=rif_table[hash];entry && memcmp(&(entry->addr[0]),&(trh->saddr[0]),TR_ALEN);entry=entry->next);
|
||||
|
||||
if(entry==NULL)
|
||||
if(entry==NULL)
|
||||
{
|
||||
#if TR_SR_DEBUG
|
||||
printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n",
|
||||
trh->saddr[0],trh->saddr[1],trh->saddr[2],
|
||||
trh->saddr[3],trh->saddr[4],trh->saddr[5],
|
||||
trh->saddr[3],trh->saddr[4],trh->saddr[5],
|
||||
ntohs(trh->rcf));
|
||||
#endif
|
||||
/*
|
||||
@@ -377,7 +377,7 @@ printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n",
|
||||
*/
|
||||
entry=kmalloc(sizeof(struct rif_cache),GFP_ATOMIC);
|
||||
|
||||
if(!entry)
|
||||
if(!entry)
|
||||
{
|
||||
printk(KERN_DEBUG "tr.c: Couldn't malloc rif cache entry !\n");
|
||||
spin_unlock_irqrestore(&rif_lock, flags);
|
||||
@@ -400,13 +400,13 @@ printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n",
|
||||
{
|
||||
entry->local_ring = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* Y. Tahara added */
|
||||
{
|
||||
{
|
||||
/*
|
||||
* Update existing entries
|
||||
*/
|
||||
if (!entry->local_ring)
|
||||
if (!entry->local_ring)
|
||||
if (entry->rcf != (trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK)) &&
|
||||
!(trh->rcf & htons(TR_RCF_BROADCAST_MASK)))
|
||||
{
|
||||
@@ -417,9 +417,9 @@ printk("updating rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n",
|
||||
ntohs(trh->rcf));
|
||||
#endif
|
||||
entry->rcf = trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK);
|
||||
memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short));
|
||||
}
|
||||
entry->last_used=jiffies;
|
||||
memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short));
|
||||
}
|
||||
entry->last_used=jiffies;
|
||||
}
|
||||
trh->saddr[0]=saddr0; /* put the routing indicator back for tcpdump */
|
||||
spin_unlock_irqrestore(&rif_lock, flags);
|
||||
@@ -429,16 +429,16 @@ printk("updating rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n",
|
||||
* Scan the cache with a timer and see what we need to throw out.
|
||||
*/
|
||||
|
||||
static void rif_check_expire(unsigned long dummy)
|
||||
static void rif_check_expire(unsigned long dummy)
|
||||
{
|
||||
int i;
|
||||
unsigned long flags, next_interval = jiffies + sysctl_tr_rif_timeout/2;
|
||||
|
||||
spin_lock_irqsave(&rif_lock, flags);
|
||||
|
||||
|
||||
for(i =0; i < RIF_TABLE_SIZE; i++) {
|
||||
struct rif_cache *entry, **pentry;
|
||||
|
||||
|
||||
pentry = rif_table+i;
|
||||
while((entry=*pentry) != NULL) {
|
||||
unsigned long expires
|
||||
@@ -455,7 +455,7 @@ static void rif_check_expire(unsigned long dummy)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
spin_unlock_irqrestore(&rif_lock, flags);
|
||||
|
||||
mod_timer(&rif_timer, next_interval);
|
||||
@@ -466,7 +466,7 @@ static void rif_check_expire(unsigned long dummy)
|
||||
* Generate the /proc/net information for the token ring RIF
|
||||
* routing.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
||||
static struct rif_cache *rif_get_idx(loff_t pos)
|
||||
@@ -475,7 +475,7 @@ static struct rif_cache *rif_get_idx(loff_t pos)
|
||||
struct rif_cache *entry;
|
||||
loff_t off = 0;
|
||||
|
||||
for(i = 0; i < RIF_TABLE_SIZE; i++)
|
||||
for(i = 0; i < RIF_TABLE_SIZE; i++)
|
||||
for(entry = rif_table[i]; entry; entry = entry->next) {
|
||||
if (off == pos)
|
||||
return entry;
|
||||
@@ -504,7 +504,7 @@ static void *rif_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
||||
goto scan;
|
||||
}
|
||||
|
||||
if (ent->next)
|
||||
if (ent->next)
|
||||
return ent->next;
|
||||
|
||||
i = rif_hash(ent->addr);
|
||||
@@ -541,13 +541,13 @@ static int rif_seq_show(struct seq_file *seq, void *v)
|
||||
ttl/HZ);
|
||||
|
||||
if (entry->local_ring)
|
||||
seq_puts(seq, "local\n");
|
||||
seq_puts(seq, "local\n");
|
||||
else {
|
||||
|
||||
seq_printf(seq, "%04X", ntohs(entry->rcf));
|
||||
rcf_len = ((ntohs(entry->rcf) & TR_RCF_LEN_MASK)>>8)-2;
|
||||
rcf_len = ((ntohs(entry->rcf) & TR_RCF_LEN_MASK)>>8)-2;
|
||||
if (rcf_len)
|
||||
rcf_len >>= 1;
|
||||
rcf_len >>= 1;
|
||||
for(j = 1; j < rcf_len; j++) {
|
||||
if(j==1) {
|
||||
segment=ntohs(entry->rseg[j-1])>>4;
|
||||
@@ -559,7 +559,7 @@ static int rif_seq_show(struct seq_file *seq, void *v)
|
||||
}
|
||||
seq_putc(seq, '\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ static void tr_setup(struct net_device *dev)
|
||||
/*
|
||||
* Configure and register
|
||||
*/
|
||||
|
||||
|
||||
dev->hard_header = tr_header;
|
||||
dev->rebuild_header = tr_rebuild_header;
|
||||
|
||||
@@ -600,7 +600,7 @@ static void tr_setup(struct net_device *dev)
|
||||
dev->mtu = 2000;
|
||||
dev->addr_len = TR_ALEN;
|
||||
dev->tx_queue_len = 100; /* Long queues on tr */
|
||||
|
||||
|
||||
memset(dev->broadcast,0xFF, TR_ALEN);
|
||||
|
||||
/* New-style flags. */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Authors: Ben Greear <greearb@candelatech.com>
|
||||
* Please send support related email to: vlan@scry.wanfear.com
|
||||
* VLAN Home Page: http://www.candelatech.com/~greear/vlan.html
|
||||
*
|
||||
*
|
||||
* Fixes:
|
||||
* Fix for packet capture - Nick Eggleston <nick@dccinc.com>;
|
||||
* Add HW acceleration hooks - David S. Miller <davem@redhat.com>;
|
||||
@@ -72,7 +72,7 @@ static struct packet_type vlan_packet_type = {
|
||||
/*
|
||||
* Function vlan_proto_init (pro)
|
||||
*
|
||||
* Initialize VLAN protocol layer,
|
||||
* Initialize VLAN protocol layer,
|
||||
*
|
||||
*/
|
||||
static int __init vlan_proto_init(void)
|
||||
@@ -87,7 +87,7 @@ static int __init vlan_proto_init(void)
|
||||
/* proc file system initialization */
|
||||
err = vlan_proc_init();
|
||||
if (err < 0) {
|
||||
printk(KERN_ERR
|
||||
printk(KERN_ERR
|
||||
"%s %s: can't create entry in proc filesystem!\n",
|
||||
__FUNCTION__, VLAN_NAME);
|
||||
return err;
|
||||
@@ -108,7 +108,7 @@ static int __init vlan_proto_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Cleanup all vlan devices
|
||||
/* Cleanup all vlan devices
|
||||
* Note: devices that have been registered that but not
|
||||
* brought up will exist but have no module ref count.
|
||||
*/
|
||||
@@ -132,7 +132,7 @@ static void __exit vlan_cleanup_devices(void)
|
||||
/*
|
||||
* Module 'remove' entry point.
|
||||
* o delete /proc/net/router directory and static entries.
|
||||
*/
|
||||
*/
|
||||
static void __exit vlan_cleanup_module(void)
|
||||
{
|
||||
int i;
|
||||
@@ -184,7 +184,7 @@ struct net_device *__find_vlan_dev(struct net_device *real_dev,
|
||||
struct vlan_group *grp = __vlan_find_group(real_dev->ifindex);
|
||||
|
||||
if (grp)
|
||||
return grp->vlan_devices[VID];
|
||||
return grp->vlan_devices[VID];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ static int unregister_vlan_dev(struct net_device *real_dev,
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int unregister_vlan_device(const char *vlan_IF_name)
|
||||
@@ -295,7 +295,7 @@ static int unregister_vlan_device(const char *vlan_IF_name)
|
||||
if (ret == 1)
|
||||
ret = 0;
|
||||
} else {
|
||||
printk(VLAN_ERR
|
||||
printk(VLAN_ERR
|
||||
"%s: ERROR: Tried to remove a non-vlan device "
|
||||
"with VLAN code, name: %s priv_flags: %hX\n",
|
||||
__FUNCTION__, dev->name, dev->priv_flags);
|
||||
@@ -315,7 +315,7 @@ static int unregister_vlan_device(const char *vlan_IF_name)
|
||||
static void vlan_setup(struct net_device *new_dev)
|
||||
{
|
||||
SET_MODULE_OWNER(new_dev);
|
||||
|
||||
|
||||
/* new_dev->ifindex = 0; it will be set when added to
|
||||
* the global list.
|
||||
* iflink is set as well.
|
||||
@@ -324,7 +324,7 @@ static void vlan_setup(struct net_device *new_dev)
|
||||
|
||||
/* Make this thing known as a VLAN device */
|
||||
new_dev->priv_flags |= IFF_802_1Q_VLAN;
|
||||
|
||||
|
||||
/* Set us up to have no queue, as the underlying Hardware device
|
||||
* can do all the queueing we could want.
|
||||
*/
|
||||
@@ -461,7 +461,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
|
||||
default:
|
||||
snprintf(name, IFNAMSIZ, "vlan%.4i", VLAN_ID);
|
||||
};
|
||||
|
||||
|
||||
new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name,
|
||||
vlan_setup);
|
||||
|
||||
@@ -477,7 +477,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
|
||||
|
||||
new_dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) |
|
||||
(1<<__LINK_STATE_DORMANT))) |
|
||||
(1<<__LINK_STATE_PRESENT);
|
||||
(1<<__LINK_STATE_PRESENT);
|
||||
|
||||
/* need 4 bytes for extra VLAN header info,
|
||||
* hope the underlying device can handle it.
|
||||
@@ -496,7 +496,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
|
||||
VLAN_MEM_DBG("new_dev->priv malloc, addr: %p size: %i\n",
|
||||
new_dev->priv,
|
||||
sizeof(struct vlan_dev_info));
|
||||
|
||||
|
||||
memcpy(new_dev->broadcast, real_dev->broadcast, real_dev->addr_len);
|
||||
memcpy(new_dev->dev_addr, real_dev->dev_addr, real_dev->addr_len);
|
||||
new_dev->addr_len = real_dev->addr_len;
|
||||
@@ -521,7 +521,7 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
|
||||
printk(VLAN_DBG "About to go find the group for idx: %i\n",
|
||||
real_dev->ifindex);
|
||||
#endif
|
||||
|
||||
|
||||
if (register_netdevice(new_dev))
|
||||
goto out_free_newdev;
|
||||
|
||||
@@ -543,22 +543,22 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
|
||||
grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL);
|
||||
if (!grp)
|
||||
goto out_free_unregister;
|
||||
|
||||
|
||||
/* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */
|
||||
grp->real_dev_ifindex = real_dev->ifindex;
|
||||
|
||||
hlist_add_head_rcu(&grp->hlist,
|
||||
hlist_add_head_rcu(&grp->hlist,
|
||||
&vlan_group_hash[vlan_grp_hashfn(real_dev->ifindex)]);
|
||||
|
||||
if (real_dev->features & NETIF_F_HW_VLAN_RX)
|
||||
real_dev->vlan_rx_register(real_dev, grp);
|
||||
}
|
||||
|
||||
|
||||
grp->vlan_devices[VLAN_ID] = new_dev;
|
||||
|
||||
if (vlan_proc_add_dev(new_dev)<0)/* create it's proc entry */
|
||||
printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n",
|
||||
new_dev->name);
|
||||
printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n",
|
||||
new_dev->name);
|
||||
|
||||
if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
|
||||
real_dev->vlan_rx_add_vid(real_dev, VLAN_ID);
|
||||
@@ -635,7 +635,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
|
||||
vlandev = grp->vlan_devices[i];
|
||||
if (!vlandev)
|
||||
continue;
|
||||
|
||||
|
||||
flgs = vlandev->flags;
|
||||
if (flgs & IFF_UP)
|
||||
continue;
|
||||
@@ -643,7 +643,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
|
||||
dev_change_flags(vlandev, flgs | IFF_UP);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case NETDEV_UNREGISTER:
|
||||
/* Delete all VLANs for this dev. */
|
||||
for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
|
||||
@@ -755,8 +755,8 @@ static int vlan_ioctl_handler(void __user *arg)
|
||||
/* TODO: Implement
|
||||
err = vlan_dev_get_ingress_priority(args);
|
||||
if (copy_to_user((void*)arg, &args,
|
||||
sizeof(struct vlan_ioctl_args))) {
|
||||
err = -EFAULT;
|
||||
sizeof(struct vlan_ioctl_args))) {
|
||||
err = -EFAULT;
|
||||
}
|
||||
*/
|
||||
err = -EINVAL;
|
||||
@@ -765,8 +765,8 @@ static int vlan_ioctl_handler(void __user *arg)
|
||||
/* TODO: Implement
|
||||
err = vlan_dev_get_egress_priority(args.device1, &(args.args);
|
||||
if (copy_to_user((void*)arg, &args,
|
||||
sizeof(struct vlan_ioctl_args))) {
|
||||
err = -EFAULT;
|
||||
sizeof(struct vlan_ioctl_args))) {
|
||||
err = -EFAULT;
|
||||
}
|
||||
*/
|
||||
err = -EINVAL;
|
||||
@@ -788,7 +788,7 @@ static int vlan_ioctl_handler(void __user *arg)
|
||||
args.u.VID = vid;
|
||||
if (copy_to_user(arg, &args,
|
||||
sizeof(struct vlan_ioctl_args))) {
|
||||
err = -EFAULT;
|
||||
err = -EFAULT;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#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.
|
||||
*/
|
||||
* changing the log level at run-time..for some reason.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -24,7 +24,7 @@ I'll bet they might prove useful again... --Ben
|
||||
*/
|
||||
|
||||
/* This way they don't do anything! */
|
||||
#define VLAN_MEM_DBG(x, y, z)
|
||||
#define VLAN_MEM_DBG(x, y, z)
|
||||
#define VLAN_FMEM_DBG(x, y)
|
||||
|
||||
|
||||
@@ -51,10 +51,10 @@ struct net_device *__find_vlan_dev(struct net_device* real_dev,
|
||||
/* 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, struct net_device *orig_dev);
|
||||
struct packet_type *ptype, struct net_device *orig_dev);
|
||||
int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type, void *daddr, void *saddr,
|
||||
unsigned len);
|
||||
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);
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
* Authors: Ben Greear <greearb@candelatech.com>
|
||||
* Please send support related email to: vlan@scry.wanfear.com
|
||||
* VLAN Home Page: http://www.candelatech.com/~greear/vlan.html
|
||||
*
|
||||
*
|
||||
* Fixes: Mar 22 2001: Martin Bokaemper <mbokaemper@unispherenetworks.com>
|
||||
* - reset skb->pkt_type on incoming packets when MAC was changed
|
||||
* - see that changed MAC is saddr for outgoing packets
|
||||
* Oct 20, 2001: Ard van Breeman:
|
||||
* - Fix MC-list, finally.
|
||||
* - Flush MC-list on VLAN destroy.
|
||||
*
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -58,12 +58,12 @@ int vlan_dev_rebuild_header(struct sk_buff *skb)
|
||||
|
||||
/* TODO: Confirm this will work with VLAN headers... */
|
||||
return arp_find(veth->h_dest, skb);
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
printk(VLAN_DBG
|
||||
"%s: unable to resolve type %X addresses.\n",
|
||||
"%s: unable to resolve type %X addresses.\n",
|
||||
dev->name, ntohs(veth->h_vlan_encapsulated_proto));
|
||||
|
||||
|
||||
memcpy(veth->h_source, dev->dev_addr, ETH_ALEN);
|
||||
break;
|
||||
};
|
||||
@@ -91,7 +91,7 @@ static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine the packet's protocol ID. The rule here is that we
|
||||
* Determine the packet's protocol ID. The rule here is that we
|
||||
* assume 802.3 if the type field is short enough to be a length.
|
||||
* This is normal practice and works for any 'now in use' protocol.
|
||||
*
|
||||
@@ -113,7 +113,7 @@ static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
|
||||
*
|
||||
*/
|
||||
int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
|
||||
struct packet_type* ptype, struct net_device *orig_dev)
|
||||
struct packet_type* ptype, struct net_device *orig_dev)
|
||||
{
|
||||
unsigned char *rawp = NULL;
|
||||
struct vlan_hdr *vhdr = (struct vlan_hdr *)(skb->data);
|
||||
@@ -175,8 +175,8 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
|
||||
|
||||
#ifdef VLAN_DEBUG
|
||||
printk(VLAN_DBG "%s: dropping skb: %p because came in on wrong device, dev: %s real_dev: %s, skb_dev: %s\n",
|
||||
__FUNCTION__, skb, dev->name,
|
||||
VLAN_DEV_INFO(skb->dev)->real_dev->name,
|
||||
__FUNCTION__, skb, dev->name,
|
||||
VLAN_DEV_INFO(skb->dev)->real_dev->name,
|
||||
skb->dev->name);
|
||||
#endif
|
||||
kfree_skb(skb);
|
||||
@@ -191,7 +191,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
|
||||
|
||||
#ifdef VLAN_DEBUG
|
||||
printk(VLAN_DBG "%s: priority: %lu for TCI: %hu (hbo)\n",
|
||||
__FUNCTION__, (unsigned long)(skb->priority),
|
||||
__FUNCTION__, (unsigned long)(skb->priority),
|
||||
ntohs(vhdr->h_vlan_TCI));
|
||||
#endif
|
||||
|
||||
@@ -207,7 +207,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
|
||||
stats->multicast++;
|
||||
break;
|
||||
|
||||
case PACKET_OTHERHOST:
|
||||
case PACKET_OTHERHOST:
|
||||
/* Our lower layer thinks this is not local, let's make sure.
|
||||
* This allows the VLAN to have a different MAC than the underlying
|
||||
* device, and still route correctly.
|
||||
@@ -319,7 +319,7 @@ static inline unsigned short vlan_dev_get_egress_qos_mask(struct net_device* dev
|
||||
}
|
||||
|
||||
/*
|
||||
* Create the VLAN header for an arbitrary protocol layer
|
||||
* Create the VLAN header for an arbitrary protocol layer
|
||||
*
|
||||
* saddr=NULL means use device source address
|
||||
* daddr=NULL means leave destination address (eg unresolved arp)
|
||||
@@ -328,8 +328,8 @@ static inline unsigned short vlan_dev_get_egress_qos_mask(struct net_device* dev
|
||||
* physical devices.
|
||||
*/
|
||||
int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type, void *daddr, void *saddr,
|
||||
unsigned len)
|
||||
unsigned short type, void *daddr, void *saddr,
|
||||
unsigned len)
|
||||
{
|
||||
struct vlan_hdr *vhdr;
|
||||
unsigned short veth_TCI = 0;
|
||||
@@ -346,7 +346,7 @@ int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
|
||||
* fixes some programs that get confused when they see a VLAN device
|
||||
* sending a frame that is VLAN encoded (the consensus is that the VLAN
|
||||
* device should look completely like an Ethernet device when the
|
||||
* REORDER_HEADER flag is set) The drawback to this is some extra
|
||||
* REORDER_HEADER flag is set) The drawback to this is some extra
|
||||
* header shuffling in the hard_start_xmit. Users can turn off this
|
||||
* REORDER behaviour with the vconfig tool.
|
||||
*/
|
||||
@@ -553,7 +553,7 @@ int vlan_dev_set_egress_priority(char *dev_name, __u32 skb_prio, short vlan_prio
|
||||
struct net_device *dev = dev_get_by_name(dev_name);
|
||||
struct vlan_priority_tci_mapping *mp = NULL;
|
||||
struct vlan_priority_tci_mapping *np;
|
||||
|
||||
|
||||
if (dev) {
|
||||
if (dev->priv_flags & IFF_802_1Q_VLAN) {
|
||||
/* See if a priority mapping exists.. */
|
||||
@@ -610,13 +610,13 @@ int vlan_dev_set_vlan_flag(char *dev_name, __u32 flag, short flag_val)
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
printk(KERN_ERR
|
||||
printk(KERN_ERR
|
||||
"%s: %s is not a vlan device, priv_flags: %hX.\n",
|
||||
__FUNCTION__, dev->name, dev->priv_flags);
|
||||
dev_put(dev);
|
||||
}
|
||||
} else {
|
||||
printk(KERN_ERR "%s: Could not find device: %s\n",
|
||||
printk(KERN_ERR "%s: Could not find device: %s\n",
|
||||
__FUNCTION__, dev_name);
|
||||
}
|
||||
|
||||
@@ -700,7 +700,7 @@ int vlan_dev_set_mac_address(struct net_device *dev, void *addr_struct_p)
|
||||
}
|
||||
|
||||
static inline int vlan_dmi_equals(struct dev_mc_list *dmi1,
|
||||
struct dev_mc_list *dmi2)
|
||||
struct dev_mc_list *dmi2)
|
||||
{
|
||||
return ((dmi1->dmi_addrlen == dmi2->dmi_addrlen) &&
|
||||
(memcmp(dmi1->dmi_addr, dmi2->dmi_addr, dmi1->dmi_addrlen) == 0));
|
||||
@@ -810,7 +810,7 @@ int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
case SIOCGMIIPHY:
|
||||
case SIOCGMIIREG:
|
||||
case SIOCSMIIREG:
|
||||
if (real_dev->do_ioctl && netif_device_present(real_dev))
|
||||
if (real_dev->do_ioctl && netif_device_present(real_dev))
|
||||
err = real_dev->do_ioctl(real_dev, &ifrr, cmd);
|
||||
break;
|
||||
|
||||
@@ -818,7 +818,7 @@ int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
err = dev_ethtool(&ifrr);
|
||||
}
|
||||
|
||||
if (!err)
|
||||
if (!err)
|
||||
ifr->ifr_ifru = ifrr.ifr_ifru;
|
||||
|
||||
return err;
|
||||
|
||||
@@ -51,7 +51,7 @@ static int vlandev_seq_show(struct seq_file *seq, void *v);
|
||||
|
||||
|
||||
/*
|
||||
* Names of the proc directory entries
|
||||
* Names of the proc directory entries
|
||||
*/
|
||||
|
||||
static const char name_root[] = "vlan";
|
||||
@@ -66,7 +66,7 @@ static const char name_conf[] = "config";
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic /proc/net/vlan/<file> file and inode operations
|
||||
* Generic /proc/net/vlan/<file> file and inode operations
|
||||
*/
|
||||
|
||||
static struct seq_operations vlan_seq_ops = {
|
||||
@@ -111,13 +111,13 @@ static struct file_operations vlandev_fops = {
|
||||
*/
|
||||
|
||||
/*
|
||||
* /proc/net/vlan
|
||||
* /proc/net/vlan
|
||||
*/
|
||||
|
||||
static struct proc_dir_entry *proc_vlan_dir;
|
||||
|
||||
/*
|
||||
* /proc/net/vlan/config
|
||||
* /proc/net/vlan/config
|
||||
*/
|
||||
|
||||
static struct proc_dir_entry *proc_vlan_conf;
|
||||
@@ -238,15 +238,15 @@ int vlan_proc_rem_dev(struct net_device *vlandev)
|
||||
*/
|
||||
|
||||
/* starting at dev, find a VLAN device */
|
||||
static struct net_device *vlan_skip(struct net_device *dev)
|
||||
static struct net_device *vlan_skip(struct net_device *dev)
|
||||
{
|
||||
while (dev && !(dev->priv_flags & IFF_802_1Q_VLAN))
|
||||
while (dev && !(dev->priv_flags & IFF_802_1Q_VLAN))
|
||||
dev = dev->next;
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
/* start read of /proc/net/vlan/config */
|
||||
/* start read of /proc/net/vlan/config */
|
||||
static void *vlan_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
{
|
||||
struct net_device *dev;
|
||||
@@ -256,19 +256,19 @@ static void *vlan_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
|
||||
if (*pos == 0)
|
||||
return SEQ_START_TOKEN;
|
||||
|
||||
for (dev = vlan_skip(dev_base); dev && i < *pos;
|
||||
|
||||
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
|
||||
return vlan_skip((v == SEQ_START_TOKEN)
|
||||
? dev_base
|
||||
: ((struct net_device *)v)->next);
|
||||
}
|
||||
|
||||
@@ -287,13 +287,13 @@ static int vlan_seq_show(struct seq_file *seq, void *v)
|
||||
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",
|
||||
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,
|
||||
seq_printf(seq, "%-15s| %d | %s\n", vlandev->name,
|
||||
dev_info->vlan_id, dev_info->real_dev->name);
|
||||
}
|
||||
return 0;
|
||||
@@ -323,13 +323,13 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
|
||||
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",
|
||||
seq_printf(seq, fmt, "total headroom inc",
|
||||
dev_info->cnt_inc_headroom_on_tx);
|
||||
seq_printf(seq, fmt, "total encap on xmit",
|
||||
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,
|
||||
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],
|
||||
|
||||
@@ -895,7 +895,7 @@ struct aarp_iter_state {
|
||||
|
||||
/*
|
||||
* Get the aarp entry that is in the chain described
|
||||
* by the iterator.
|
||||
* by the iterator.
|
||||
* If pos is set then skip till that index.
|
||||
* pos = 1 is the first entry
|
||||
*/
|
||||
@@ -905,7 +905,7 @@ static struct aarp_entry *iter_next(struct aarp_iter_state *iter, loff_t *pos)
|
||||
struct aarp_entry **table = iter->table;
|
||||
loff_t off = 0;
|
||||
struct aarp_entry *entry;
|
||||
|
||||
|
||||
rescan:
|
||||
while(ct < AARP_HASH_SIZE) {
|
||||
for (entry = table[ct]; entry; entry = entry->next) {
|
||||
@@ -950,9 +950,9 @@ static void *aarp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
||||
++*pos;
|
||||
|
||||
/* first line after header */
|
||||
if (v == SEQ_START_TOKEN)
|
||||
if (v == SEQ_START_TOKEN)
|
||||
entry = iter_next(iter, NULL);
|
||||
|
||||
|
||||
/* next entry in current bucket */
|
||||
else if (entry->next)
|
||||
entry = entry->next;
|
||||
@@ -986,7 +986,7 @@ static int aarp_seq_show(struct seq_file *seq, void *v)
|
||||
unsigned long now = jiffies;
|
||||
|
||||
if (v == SEQ_START_TOKEN)
|
||||
seq_puts(seq,
|
||||
seq_puts(seq,
|
||||
"Address Interface Hardware Address"
|
||||
" Expires LastSend Retry Status\n");
|
||||
else {
|
||||
@@ -1014,7 +1014,7 @@ static int aarp_seq_show(struct seq_file *seq, void *v)
|
||||
: (iter->table == unresolved) ? "unresolved"
|
||||
: (iter->table == proxies) ? "proxies"
|
||||
: "unknown");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1030,7 +1030,7 @@ static int aarp_seq_open(struct inode *inode, struct file *file)
|
||||
struct seq_file *seq;
|
||||
int rc = -ENOMEM;
|
||||
struct aarp_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
|
||||
|
||||
|
||||
if (!s)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ int __init atalk_proc_init(void)
|
||||
p->proc_fops = &atalk_seq_socket_fops;
|
||||
|
||||
p = create_proc_entry("arp", S_IRUGO, atalk_proc_dir);
|
||||
if (!p)
|
||||
if (!p)
|
||||
goto out_arp;
|
||||
p->proc_fops = &atalk_seq_arp_fops;
|
||||
|
||||
|
||||
@@ -28,16 +28,16 @@
|
||||
* Bradford Johnson : IP-over-DDP (experimental)
|
||||
* Jay Schulist : Moved IP-over-DDP to its own
|
||||
* driver file. (ipddp.c & ipddp.h)
|
||||
* Jay Schulist : Made work as module with
|
||||
* Jay Schulist : Made work as module with
|
||||
* AppleTalk drivers, cleaned it.
|
||||
* Rob Newberry : Added proxy AARP and AARP
|
||||
* procfs, moved probing to AARP
|
||||
* module.
|
||||
* Adrian Sun/
|
||||
* Michael Zuelsdorff : fix for net.0 packets. don't
|
||||
* Adrian Sun/
|
||||
* Michael Zuelsdorff : fix for net.0 packets. don't
|
||||
* allow illegal ether/tokentalk
|
||||
* port assignment. we lose a
|
||||
* valid localtalk port as a
|
||||
* port assignment. we lose a
|
||||
* valid localtalk port as a
|
||||
* result.
|
||||
* Arnaldo C. de Melo : Cleanup, in preparation for
|
||||
* shared skb support 8)
|
||||
@@ -48,7 +48,7 @@
|
||||
* 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/capability.h>
|
||||
@@ -100,17 +100,17 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to,
|
||||
if (to->sat_port != at->src_port)
|
||||
continue;
|
||||
|
||||
if (to->sat_addr.s_net == ATADDR_ANYNET &&
|
||||
if (to->sat_addr.s_net == ATADDR_ANYNET &&
|
||||
to->sat_addr.s_node == ATADDR_BCAST)
|
||||
goto found;
|
||||
|
||||
if (to->sat_addr.s_net == at->src_net &&
|
||||
if (to->sat_addr.s_net == at->src_net &&
|
||||
(to->sat_addr.s_node == at->src_node ||
|
||||
to->sat_addr.s_node == ATADDR_BCAST ||
|
||||
to->sat_addr.s_node == ATADDR_ANYNODE))
|
||||
goto found;
|
||||
|
||||
/* XXXX.0 -- we got a request for this router. make sure
|
||||
/* XXXX.0 -- we got a request for this router. make sure
|
||||
* that the node is appropriately set. */
|
||||
if (to->sat_addr.s_node == ATADDR_ANYNODE &&
|
||||
to->sat_addr.s_net != ATADDR_ANYNET &&
|
||||
@@ -314,7 +314,7 @@ static int atif_proxy_probe_device(struct atalk_iface *atif,
|
||||
|
||||
if (probe_node == ATADDR_ANYNODE)
|
||||
probe_node = jiffies & 0xFF;
|
||||
|
||||
|
||||
/* Scan the networks */
|
||||
for (netct = 0; netct <= netrange; netct++) {
|
||||
/* Sweep the available nodes from a given start */
|
||||
@@ -417,7 +417,7 @@ static struct atalk_iface *atalk_find_interface(__be16 net, int node)
|
||||
if (node == ATADDR_ANYNODE && net != ATADDR_ANYNET &&
|
||||
ntohs(iface->nets.nr_firstnet) <= ntohs(net) &&
|
||||
ntohs(net) <= ntohs(iface->nets.nr_lastnet))
|
||||
break;
|
||||
break;
|
||||
}
|
||||
read_unlock_bh(&atalk_interfaces_lock);
|
||||
return iface;
|
||||
@@ -432,13 +432,13 @@ static struct atalk_iface *atalk_find_interface(__be16 net, int node)
|
||||
static struct atalk_route *atrtr_find(struct atalk_addr *target)
|
||||
{
|
||||
/*
|
||||
* we must search through all routes unless we find a
|
||||
* we must search through all routes unless we find a
|
||||
* host route, because some host routes might overlap
|
||||
* network routes
|
||||
*/
|
||||
struct atalk_route *net_route = NULL;
|
||||
struct atalk_route *r;
|
||||
|
||||
|
||||
read_lock_bh(&atalk_routes_lock);
|
||||
for (r = atalk_routes; r; r = r->next) {
|
||||
if (!(r->flags & RTF_UP))
|
||||
@@ -460,8 +460,8 @@ static struct atalk_route *atrtr_find(struct atalk_addr *target)
|
||||
net_route = r;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* if we found a network route but not a direct host
|
||||
* route, then return it
|
||||
*/
|
||||
@@ -540,15 +540,15 @@ static int atrtr_create(struct rtentry *r, struct net_device *devhint)
|
||||
for (iface = atalk_interfaces; iface; iface = iface->next) {
|
||||
if (!riface &&
|
||||
ntohs(ga->sat_addr.s_net) >=
|
||||
ntohs(iface->nets.nr_firstnet) &&
|
||||
ntohs(iface->nets.nr_firstnet) &&
|
||||
ntohs(ga->sat_addr.s_net) <=
|
||||
ntohs(iface->nets.nr_lastnet))
|
||||
ntohs(iface->nets.nr_lastnet))
|
||||
riface = iface;
|
||||
|
||||
if (ga->sat_addr.s_net == iface->address.s_net &&
|
||||
ga->sat_addr.s_node == iface->address.s_node)
|
||||
riface = iface;
|
||||
}
|
||||
}
|
||||
read_unlock_bh(&atalk_interfaces_lock);
|
||||
|
||||
retval = -ENETUNREACH;
|
||||
@@ -649,7 +649,7 @@ static int ddp_device_event(struct notifier_block *this, unsigned long event,
|
||||
{
|
||||
if (event == NETDEV_DOWN)
|
||||
/* Discard any use of this */
|
||||
atalk_dev_down(ptr);
|
||||
atalk_dev_down(ptr);
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
@@ -701,13 +701,13 @@ static int atif_ioctl(int cmd, void __user *arg)
|
||||
*/
|
||||
if ((dev->flags & IFF_POINTOPOINT) &&
|
||||
atalk_find_interface(sa->sat_addr.s_net,
|
||||
sa->sat_addr.s_node)) {
|
||||
sa->sat_addr.s_node)) {
|
||||
printk(KERN_DEBUG "AppleTalk: point-to-point "
|
||||
"interface added with "
|
||||
"existing address\n");
|
||||
add_route = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Phase 1 is fine on LocalTalk but we don't do
|
||||
* EtherTalk phase 1. Anyone wanting to add it go ahead.
|
||||
@@ -797,78 +797,78 @@ static int atif_ioctl(int cmd, void __user *arg)
|
||||
sa->sat_addr.s_node = ATADDR_BCAST;
|
||||
break;
|
||||
|
||||
case SIOCATALKDIFADDR:
|
||||
case SIOCDIFADDR:
|
||||
case SIOCATALKDIFADDR:
|
||||
case SIOCDIFADDR:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
if (sa->sat_family != AF_APPLETALK)
|
||||
return -EINVAL;
|
||||
atalk_dev_down(dev);
|
||||
break;
|
||||
break;
|
||||
|
||||
case SIOCSARP:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
if (sa->sat_family != AF_APPLETALK)
|
||||
return -EINVAL;
|
||||
if (!atif)
|
||||
return -EADDRNOTAVAIL;
|
||||
return -EPERM;
|
||||
if (sa->sat_family != AF_APPLETALK)
|
||||
return -EINVAL;
|
||||
if (!atif)
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
/*
|
||||
* for now, we only support proxy AARP on ELAP;
|
||||
* we should be able to do it for LocalTalk, too.
|
||||
*/
|
||||
if (dev->type != ARPHRD_ETHER)
|
||||
return -EPROTONOSUPPORT;
|
||||
/*
|
||||
* for now, we only support proxy AARP on ELAP;
|
||||
* we should be able to do it for LocalTalk, too.
|
||||
*/
|
||||
if (dev->type != ARPHRD_ETHER)
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
/*
|
||||
* atif points to the current interface on this network;
|
||||
* we aren't concerned about its current status (at
|
||||
/*
|
||||
* atif points to the current interface on this network;
|
||||
* we aren't concerned about its current status (at
|
||||
* least for now), but it has all the settings about
|
||||
* the network we're going to probe. Consequently, it
|
||||
* must exist.
|
||||
*/
|
||||
if (!atif)
|
||||
return -EADDRNOTAVAIL;
|
||||
*/
|
||||
if (!atif)
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
nr = (struct atalk_netrange *)&(atif->nets);
|
||||
/*
|
||||
* Phase 1 is fine on Localtalk but we don't do
|
||||
* Ethertalk phase 1. Anyone wanting to add it go ahead.
|
||||
*/
|
||||
if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2)
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
if (sa->sat_addr.s_node == ATADDR_BCAST ||
|
||||
sa->sat_addr.s_node == 254)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Check if the chosen address is used. If so we
|
||||
* error and ATCP will try another.
|
||||
*/
|
||||
if (atif_proxy_probe_device(atif, &(sa->sat_addr)) < 0)
|
||||
return -EADDRINUSE;
|
||||
|
||||
nr = (struct atalk_netrange *)&(atif->nets);
|
||||
/*
|
||||
* We now have an address on the local network, and
|
||||
* Phase 1 is fine on Localtalk but we don't do
|
||||
* Ethertalk phase 1. Anyone wanting to add it go ahead.
|
||||
*/
|
||||
if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2)
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
if (sa->sat_addr.s_node == ATADDR_BCAST ||
|
||||
sa->sat_addr.s_node == 254)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
* Check if the chosen address is used. If so we
|
||||
* error and ATCP will try another.
|
||||
*/
|
||||
if (atif_proxy_probe_device(atif, &(sa->sat_addr)) < 0)
|
||||
return -EADDRINUSE;
|
||||
|
||||
/*
|
||||
* We now have an address on the local network, and
|
||||
* the AARP code will defend it for us until we take it
|
||||
* down. We don't set up any routes right now, because
|
||||
* ATCP will install them manually via SIOCADDRT.
|
||||
*/
|
||||
break;
|
||||
*/
|
||||
break;
|
||||
|
||||
case SIOCDARP:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
if (sa->sat_family != AF_APPLETALK)
|
||||
return -EINVAL;
|
||||
if (!atif)
|
||||
return -EADDRNOTAVAIL;
|
||||
case SIOCDARP:
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
if (sa->sat_family != AF_APPLETALK)
|
||||
return -EINVAL;
|
||||
if (!atif)
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
/* give to aarp module to remove proxy entry */
|
||||
aarp_proxy_remove(atif->dev, &(sa->sat_addr));
|
||||
return 0;
|
||||
/* give to aarp module to remove proxy entry */
|
||||
aarp_proxy_remove(atif->dev, &(sa->sat_addr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return copy_to_user(arg, &atreq, sizeof(atreq)) ? -EFAULT : 0;
|
||||
@@ -899,7 +899,7 @@ static int atrtr_ioctl(unsigned int cmd, void __user *arg)
|
||||
dev = __dev_get_by_name(name);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
return atrtr_create(&rt, dev);
|
||||
}
|
||||
}
|
||||
@@ -917,7 +917,7 @@ static int atrtr_ioctl(unsigned int cmd, void __user *arg)
|
||||
* Checksum: This is 'optional'. It's quite likely also a good
|
||||
* candidate for assembler hackery 8)
|
||||
*/
|
||||
static unsigned long atalk_sum_partial(const unsigned char *data,
|
||||
static unsigned long atalk_sum_partial(const unsigned char *data,
|
||||
int len, unsigned long sum)
|
||||
{
|
||||
/* This ought to be unwrapped neatly. I'll trust gcc for now */
|
||||
@@ -945,7 +945,7 @@ static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset,
|
||||
if (copy > len)
|
||||
copy = len;
|
||||
sum = atalk_sum_partial(skb->data + offset, copy, sum);
|
||||
if ( (len -= copy) == 0)
|
||||
if ( (len -= copy) == 0)
|
||||
return sum;
|
||||
|
||||
offset += copy;
|
||||
@@ -1031,7 +1031,7 @@ static int atalk_create(struct socket *sock, int protocol)
|
||||
|
||||
/*
|
||||
* We permit SOCK_DGRAM and RAW is an extension. It is trivial to do
|
||||
* and gives you the full ELAP frame. Should be handy for CAP 8)
|
||||
* and gives you the full ELAP frame. Should be handy for CAP 8)
|
||||
*/
|
||||
if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
|
||||
goto out;
|
||||
@@ -1196,14 +1196,14 @@ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr,
|
||||
|
||||
if (addr->sat_addr.s_node == ATADDR_BCAST &&
|
||||
!sock_flag(sk, SOCK_BROADCAST)) {
|
||||
#if 1
|
||||
#if 1
|
||||
printk(KERN_WARNING "%s is broken and did not set "
|
||||
"SO_BROADCAST. It will break when 2.2 is "
|
||||
"released.\n",
|
||||
current->comm);
|
||||
#else
|
||||
return -EACCES;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
if (sock_flag(sk, SOCK_ZAPPED))
|
||||
@@ -1260,27 +1260,27 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr,
|
||||
#if defined(CONFIG_IPDDP) || defined(CONFIG_IPDDP_MODULE)
|
||||
static __inline__ int is_ip_over_ddp(struct sk_buff *skb)
|
||||
{
|
||||
return skb->data[12] == 22;
|
||||
return skb->data[12] == 22;
|
||||
}
|
||||
|
||||
static int handle_ip_over_ddp(struct sk_buff *skb)
|
||||
{
|
||||
struct net_device *dev = __dev_get_by_name("ipddp0");
|
||||
struct net_device *dev = __dev_get_by_name("ipddp0");
|
||||
struct net_device_stats *stats;
|
||||
|
||||
/* This needs to be able to handle ipddp"N" devices */
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
skb_pull(skb, 13);
|
||||
skb->dev = dev;
|
||||
skb->h.raw = skb->data;
|
||||
skb->protocol = htons(ETH_P_IP);
|
||||
skb_pull(skb, 13);
|
||||
skb->dev = dev;
|
||||
skb->h.raw = skb->data;
|
||||
|
||||
stats = dev->priv;
|
||||
stats->rx_packets++;
|
||||
stats->rx_bytes += skb->len + 13;
|
||||
netif_rx(skb); /* Send the SKB up to a higher place. */
|
||||
stats->rx_packets++;
|
||||
stats->rx_bytes += skb->len + 13;
|
||||
netif_rx(skb); /* Send the SKB up to a higher place. */
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
@@ -1298,7 +1298,7 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev,
|
||||
|
||||
/*
|
||||
* Don't route multicast, etc., packets, or packets sent to "this
|
||||
* network"
|
||||
* network"
|
||||
*/
|
||||
if (skb->pkt_type != PACKET_HOST || !ddp->deh_dnet) {
|
||||
/*
|
||||
@@ -1335,8 +1335,8 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev,
|
||||
ta.s_node = rt->gateway.s_node;
|
||||
}
|
||||
|
||||
/* Fix up skb->len field */
|
||||
skb_trim(skb, min_t(unsigned int, origlen,
|
||||
/* Fix up skb->len field */
|
||||
skb_trim(skb, min_t(unsigned int, origlen,
|
||||
(rt->dev->hard_header_len +
|
||||
ddp_dl->header_length + (len_hops & 1023))));
|
||||
|
||||
@@ -1358,12 +1358,12 @@ static void atalk_route_packet(struct sk_buff *skb, struct net_device *dev,
|
||||
/* 22 bytes - 12 ether, 2 len, 3 802.2 5 snap */
|
||||
struct sk_buff *nskb = skb_realloc_headroom(skb, 32);
|
||||
kfree_skb(skb);
|
||||
if (!nskb)
|
||||
if (!nskb)
|
||||
goto out;
|
||||
skb = nskb;
|
||||
} else
|
||||
skb = skb_unshare(skb, GFP_ATOMIC);
|
||||
|
||||
|
||||
/*
|
||||
* If the buffer didn't vanish into the lack of space bitbucket we can
|
||||
* send it.
|
||||
@@ -1395,13 +1395,13 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
struct sock *sock;
|
||||
struct atalk_iface *atif;
|
||||
struct sockaddr_at tosat;
|
||||
int origlen;
|
||||
int origlen;
|
||||
__u16 len_hops;
|
||||
|
||||
/* Don't mangle buffer if shared */
|
||||
if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
|
||||
if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
|
||||
goto out;
|
||||
|
||||
|
||||
/* Size check and make sure header is contiguous */
|
||||
if (!pskb_may_pull(skb, sizeof(*ddp)))
|
||||
goto freeit;
|
||||
@@ -1490,7 +1490,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
goto freeit;
|
||||
|
||||
/* Don't mangle buffer if shared */
|
||||
if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
|
||||
if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
@@ -1501,11 +1501,11 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
|
||||
/* Now fill in the long header */
|
||||
|
||||
/*
|
||||
* These two first. The mac overlays the new source/dest
|
||||
* network information so we MUST copy these before
|
||||
* we write the network numbers !
|
||||
*/
|
||||
/*
|
||||
* These two first. The mac overlays the new source/dest
|
||||
* network information so we MUST copy these before
|
||||
* we write the network numbers !
|
||||
*/
|
||||
|
||||
ddp->deh_dnode = skb->mac.raw[0]; /* From physical header */
|
||||
ddp->deh_snode = skb->mac.raw[1]; /* From physical header */
|
||||
@@ -1605,7 +1605,7 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
|
||||
skb = sock_alloc_send_skb(sk, size, (flags & MSG_DONTWAIT), &err);
|
||||
if (!skb)
|
||||
return err;
|
||||
|
||||
|
||||
skb->sk = sk;
|
||||
skb_reserve(skb, ddp_dl->header_length);
|
||||
skb_reserve(skb, dev->hard_header_len);
|
||||
|
||||
@@ -15,14 +15,14 @@ static int ltalk_change_mtu(struct net_device *dev, int mtu)
|
||||
}
|
||||
|
||||
static int ltalk_mac_addr(struct net_device *dev, void *addr)
|
||||
{
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static void ltalk_setup(struct net_device *dev)
|
||||
{
|
||||
/* Fill in the fields of the device structure with localtalk-generic values. */
|
||||
|
||||
|
||||
dev->change_mtu = ltalk_change_mtu;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
@@ -34,8 +34,8 @@ static void ltalk_setup(struct net_device *dev)
|
||||
dev->hard_header_len = LTALK_HLEN;
|
||||
dev->mtu = LTALK_MTU;
|
||||
dev->addr_len = LTALK_ALEN;
|
||||
dev->tx_queue_len = 10;
|
||||
|
||||
dev->tx_queue_len = 10;
|
||||
|
||||
dev->broadcast[0] = 0xFF;
|
||||
|
||||
dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
|
||||
|
||||
@@ -30,15 +30,15 @@ static ssize_t show_address(struct class_device *cdev, char *buf)
|
||||
|
||||
static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long flags;
|
||||
char *pos = buf;
|
||||
struct atm_dev *adev = to_atm_dev(cdev);
|
||||
struct atm_dev_addr *aaddr;
|
||||
struct atm_dev_addr *aaddr;
|
||||
int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin;
|
||||
int i, j;
|
||||
|
||||
spin_lock_irqsave(&adev->lock, flags);
|
||||
list_for_each_entry(aaddr, &adev->local, entry) {
|
||||
spin_lock_irqsave(&adev->lock, flags);
|
||||
list_for_each_entry(aaddr, &adev->local, entry) {
|
||||
for(i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) {
|
||||
if (j == *fmt) {
|
||||
pos += sprintf(pos, ".");
|
||||
@@ -49,7 +49,7 @@ static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
|
||||
}
|
||||
pos += sprintf(pos, "\n");
|
||||
}
|
||||
spin_unlock_irqrestore(&adev->lock, flags);
|
||||
spin_unlock_irqrestore(&adev->lock, flags);
|
||||
|
||||
return pos - buf;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ static ssize_t show_carrier(struct class_device *cdev, char *buf)
|
||||
|
||||
pos += sprintf(pos, "%d\n",
|
||||
adev->signal == ATM_PHY_SIG_LOST ? 0 : 1);
|
||||
|
||||
|
||||
return pos - buf;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ static ssize_t show_link_rate(struct class_device *cdev, char *buf)
|
||||
link_rate = adev->link_rate * 8 * 53;
|
||||
}
|
||||
pos += sprintf(pos, "%d\n", link_rate);
|
||||
|
||||
|
||||
return pos - buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
|
||||
ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc;
|
||||
DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev);
|
||||
if (!atm_may_send(atmvcc, skb->truesize)) {
|
||||
/* we free this here for now, because we cannot know in a higher
|
||||
/* we free this here for now, because we cannot know in a higher
|
||||
layer whether the skb point it supplied wasn't freed yet.
|
||||
now, it always is.
|
||||
*/
|
||||
@@ -718,7 +718,7 @@ static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
||||
|
||||
++*pos;
|
||||
|
||||
brd = list_entry(brd->br2684_devs.next,
|
||||
brd = list_entry(brd->br2684_devs.next,
|
||||
struct br2684_dev, br2684_devs);
|
||||
return (&brd->br2684_devs != &br2684_devs) ? brd : NULL;
|
||||
}
|
||||
|
||||
@@ -109,11 +109,11 @@ static inline int vcc_writable(struct sock *sk)
|
||||
struct atm_vcc *vcc = atm_sk(sk);
|
||||
|
||||
return (vcc->qos.txtp.max_sdu +
|
||||
atomic_read(&sk->sk_wmem_alloc)) <= sk->sk_sndbuf;
|
||||
atomic_read(&sk->sk_wmem_alloc)) <= sk->sk_sndbuf;
|
||||
}
|
||||
|
||||
static void vcc_write_space(struct sock *sk)
|
||||
{
|
||||
{
|
||||
read_lock(&sk->sk_callback_lock);
|
||||
|
||||
if (vcc_writable(sk)) {
|
||||
@@ -131,7 +131,7 @@ static struct proto vcc_proto = {
|
||||
.owner = THIS_MODULE,
|
||||
.obj_size = sizeof(struct atm_vcc),
|
||||
};
|
||||
|
||||
|
||||
int vcc_create(struct socket *sock, int protocol, int family)
|
||||
{
|
||||
struct sock *sk;
|
||||
@@ -359,7 +359,7 @@ static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,
|
||||
return error;
|
||||
vcc->dev = dev;
|
||||
write_lock_irq(&vcc_sklist_lock);
|
||||
if (test_bit(ATM_DF_REMOVED, &dev->flags) ||
|
||||
if (test_bit(ATM_DF_REMOVED, &dev->flags) ||
|
||||
(error = find_ci(vcc, &vpi, &vci))) {
|
||||
write_unlock_irq(&vcc_sklist_lock);
|
||||
goto fail_module_put;
|
||||
@@ -494,20 +494,20 @@ int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
|
||||
if (!skb)
|
||||
return error;
|
||||
|
||||
copied = skb->len;
|
||||
copied = skb->len;
|
||||
if (copied > size) {
|
||||
copied = size;
|
||||
copied = size;
|
||||
msg->msg_flags |= MSG_TRUNC;
|
||||
}
|
||||
|
||||
error = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
|
||||
if (error)
|
||||
return error;
|
||||
sock_recv_timestamp(msg, sk, skb);
|
||||
DPRINTK("RcvM %d -= %d\n", atomic_read(&sk->rmem_alloc), skb->truesize);
|
||||
atm_return(vcc, skb->truesize);
|
||||
skb_free_datagram(sk, skb);
|
||||
return copied;
|
||||
error = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
|
||||
if (error)
|
||||
return error;
|
||||
sock_recv_timestamp(msg, sk, skb);
|
||||
DPRINTK("RcvM %d -= %d\n", atomic_read(&sk->rmem_alloc), skb->truesize);
|
||||
atm_return(vcc, skb->truesize);
|
||||
skb_free_datagram(sk, skb);
|
||||
return copied;
|
||||
}
|
||||
|
||||
|
||||
@@ -675,7 +675,7 @@ static int check_qos(struct atm_qos *qos)
|
||||
int error;
|
||||
|
||||
if (!qos->txtp.traffic_class && !qos->rxtp.traffic_class)
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
if (qos->txtp.traffic_class != qos->rxtp.traffic_class &&
|
||||
qos->txtp.traffic_class && qos->rxtp.traffic_class &&
|
||||
qos->txtp.traffic_class != ATM_ANYCLASS &&
|
||||
@@ -786,11 +786,11 @@ static int __init atm_init(void)
|
||||
printk(KERN_ERR "atmsvc_init() failed with %d\n", error);
|
||||
goto out_atmpvc_exit;
|
||||
}
|
||||
if ((error = atm_proc_init()) < 0) {
|
||||
if ((error = atm_proc_init()) < 0) {
|
||||
printk(KERN_ERR "atm_proc_init() failed with %d\n",error);
|
||||
goto out_atmsvc_exit;
|
||||
}
|
||||
if ((error = atm_sysfs_init()) < 0) {
|
||||
if ((error = atm_sysfs_init()) < 0) {
|
||||
printk(KERN_ERR "atm_sysfs_init() failed with %d\n",error);
|
||||
goto out_atmproc_exit;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user