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:
Linus Torvalds 2007-02-11 11:38:13 -08:00
commit cb18eccff4
539 changed files with 9009 additions and 9004 deletions

View File

@ -68,9 +68,10 @@ extern void dn_rt_cache_flush(int delay);
struct dn_route { struct dn_route {
union { union {
struct dst_entry dst; struct dst_entry dst;
struct dn_route *rt_next;
} u; } u;
struct flowi fl;
__le16 rt_saddr; __le16 rt_saddr;
__le16 rt_daddr; __le16 rt_daddr;
__le16 rt_gateway; __le16 rt_gateway;
@ -80,8 +81,6 @@ struct dn_route {
unsigned rt_flags; unsigned rt_flags;
unsigned rt_type; unsigned rt_type;
struct flowi fl;
}; };
extern void dn_route_init(void); extern void dn_route_init(void);

View File

@ -37,9 +37,7 @@ struct sk_buff;
struct dst_entry struct dst_entry
{ {
struct dst_entry *next; struct rcu_head rcu_head;
atomic_t __refcnt; /* client references */
int __use;
struct dst_entry *child; struct dst_entry *child;
struct net_device *dev; struct net_device *dev;
short error; short error;
@ -50,7 +48,6 @@ struct dst_entry
#define DST_NOPOLICY 4 #define DST_NOPOLICY 4
#define DST_NOHASH 8 #define DST_NOHASH 8
#define DST_BALANCED 0x10 #define DST_BALANCED 0x10
unsigned long lastuse;
unsigned long expires; unsigned long expires;
unsigned short header_len; /* more space at head required */ unsigned short header_len; /* more space at head required */
@ -75,8 +72,16 @@ struct dst_entry
#endif #endif
struct dst_ops *ops; 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]; char info[0];
}; };

View File

@ -83,7 +83,6 @@ struct rt6_info
{ {
union { union {
struct dst_entry dst; struct dst_entry dst;
struct rt6_info *next;
} u; } u;
struct inet6_dev *rt6i_idev; struct inet6_dev *rt6i_idev;

View File

@ -53,9 +53,11 @@ struct rtable
union union
{ {
struct dst_entry dst; struct dst_entry dst;
struct rtable *rt_next;
} u; } u;
/* Cache lookup keys */
struct flowi fl;
struct in_device *idev; struct in_device *idev;
unsigned rt_flags; unsigned rt_flags;
@ -69,9 +71,6 @@ struct rtable
/* Info on neighbour */ /* Info on neighbour */
__be32 rt_gateway; __be32 rt_gateway;
/* Cache lookup keys */
struct flowi fl;
/* Miscellaneous cached information */ /* Miscellaneous cached information */
__be32 rt_spec_dst; /* RFC1122 specific destination */ __be32 rt_spec_dst; /* RFC1122 specific destination */
struct inet_peer *peer; /* long-living peer info */ struct inet_peer *peer; /* long-living peer info */

View File

@ -1,6 +1,6 @@
/* /*
* NET3: Fibre Channel device handling subroutines * NET3: Fibre Channel device handling subroutines
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
@ -31,18 +31,18 @@
#include <net/arp.h> #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, static int fc_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, unsigned short type,
void *daddr, void *saddr, unsigned len) void *daddr, void *saddr, unsigned len)
{ {
struct fch_hdr *fch; struct fch_hdr *fch;
int hdr_len; 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. * dev->hard_header directly.
*/ */
if (type == ETH_P_IP || type == ETH_P_ARP) 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 else
{ {
hdr_len = sizeof(struct fch_hdr); 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) if(saddr)
@ -68,20 +68,20 @@ static int fc_header(struct sk_buff *skb, struct net_device *dev,
else else
memcpy(fch->saddr,dev->dev_addr,dev->addr_len); memcpy(fch->saddr,dev->dev_addr,dev->addr_len);
if(daddr) if(daddr)
{ {
memcpy(fch->daddr,daddr,dev->addr_len); memcpy(fch->daddr,daddr,dev->addr_len);
return(hdr_len); return(hdr_len);
} }
return -hdr_len; return -hdr_len;
} }
/* /*
* A neighbour discovery of some species (eg arp) has completed. We * A neighbour discovery of some species (eg arp) has completed. We
* can now send the packet. * 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 fch_hdr *fch=(struct fch_hdr *)skb->data;
struct fcllc *fcllc=(struct fcllc *)(skb->data+sizeof(struct fch_hdr)); 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->hard_header = fc_header;
dev->rebuild_header = fc_rebuild_header; dev->rebuild_header = fc_rebuild_header;
dev->type = ARPHRD_IEEE802; dev->type = ARPHRD_IEEE802;
dev->hard_header_len = FC_HLEN; dev->hard_header_len = FC_HLEN;
dev->mtu = 2024; dev->mtu = 2024;

View File

@ -15,7 +15,7 @@
* Mark Evans, <evansmp@uhura.aston.ac.uk> * Mark Evans, <evansmp@uhura.aston.ac.uk>
* Florian La Roche, <rzsfl@rz.uni-sb.de> * Florian La Roche, <rzsfl@rz.uni-sb.de>
* Alan Cox, <gw4pts@gw4pts.ampr.org> * Alan Cox, <gw4pts@gw4pts.ampr.org>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
@ -25,7 +25,7 @@
* Alan Cox : New arp/rebuild header * Alan Cox : New arp/rebuild header
* Maciej W. Rozycki : IPv6 support * Maciej W. Rozycki : IPv6 support
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <asm/system.h> #include <asm/system.h>
#include <linux/types.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; int hl = FDDI_K_SNAP_HLEN;
struct fddihdr *fddi; struct fddihdr *fddi;
if(type != ETH_P_IP && type != ETH_P_IPV6 && type != ETH_P_ARP) if(type != ETH_P_IP && type != ETH_P_IPV6 && type != ETH_P_ARP)
hl=FDDI_K_8022_HLEN-3; hl=FDDI_K_8022_HLEN-3;
fddi = (struct fddihdr *)skb_push(skb, hl); 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 */ /* Set the source and destination hardware addresses */
if (saddr != NULL) if (saddr != NULL)
memcpy(fddi->saddr, saddr, dev->addr_len); memcpy(fddi->saddr, saddr, dev->addr_len);
else 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 * (or in future other address resolution) has completed on
* this sk_buff. We now let ARP fill in the other fields. * this sk_buff. We now let ARP fill in the other fields.
*/ */
static int fddi_rebuild_header(struct sk_buff *skb) static int fddi_rebuild_header(struct sk_buff *skb)
{ {
struct fddihdr *fddi = (struct fddihdr *)skb->data; 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 */ /* Try to get ARP to resolve the header and fill destination address */
return arp_find(fddi->daddr, skb); return arp_find(fddi->daddr, skb);
else else
#endif #endif
{ {
printk("%s: Don't know how to resolve type %04X addresses.\n", printk("%s: Don't know how to resolve type %04X addresses.\n",
skb->dev->name, ntohs(fddi->hdr.llc_snap.ethertype)); 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 * up. It's used to fill in specific skb fields and to set
* the proper pointer to the start of packet data (skb->data). * the proper pointer to the start of packet data (skb->data).
*/ */
__be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev) __be16 fddi_type_trans(struct sk_buff *skb, struct net_device *dev)
{ {
struct fddihdr *fddi = (struct fddihdr *)skb->data; struct fddihdr *fddi = (struct fddihdr *)skb->data;
__be16 type; __be16 type;
/* /*
* Set mac.raw field to point to FC byte, set data field to point * 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. * to start of packet data. Assume 802.2 SNAP frames for now.
*/ */
skb->mac.raw = skb->data; /* point to frame control (FC) */ skb->mac.raw = skb->data; /* point to frame control (FC) */
if(fddi->hdr.llc_8022_1.dsap==0xe0) if(fddi->hdr.llc_8022_1.dsap==0xe0)
{ {
skb_pull(skb, FDDI_K_8022_HLEN-3); 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 */ skb_pull(skb, FDDI_K_SNAP_HLEN); /* adjust for 21 byte header */
type=fddi->hdr.llc_snap.ethertype; type=fddi->hdr.llc_snap.ethertype;
} }
/* Set packet type based on destination address and flag settings */ /* Set packet type based on destination address and flag settings */
if (*fddi->daddr & 0x01) if (*fddi->daddr & 0x01)
{ {
if (memcmp(fddi->daddr, dev->broadcast, FDDI_K_ALEN) == 0) 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 else
skb->pkt_type = PACKET_MULTICAST; skb->pkt_type = PACKET_MULTICAST;
} }
else if (dev->flags & IFF_PROMISC) else if (dev->flags & IFF_PROMISC)
{ {
if (memcmp(fddi->daddr, dev->dev_addr, FDDI_K_ALEN)) 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->addr_len = FDDI_K_ALEN;
dev->tx_queue_len = 100; /* Long queues on FDDI */ dev->tx_queue_len = 100; /* Long queues on FDDI */
dev->flags = IFF_BROADCAST | IFF_MULTICAST; dev->flags = IFF_BROADCAST | IFF_MULTICAST;
memset(dev->broadcast, 0xFF, FDDI_K_ALEN); memset(dev->broadcast, 0xFF, FDDI_K_ALEN);
} }

View File

@ -39,7 +39,7 @@
#include <asm/system.h> #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 * saddr=NULL means use device source address
* daddr=NULL means leave destination address (eg unresolved arp) * 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 * 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)); printk(KERN_DEBUG "%s: unable to resolve type %X addresses.\n",skb->dev->name,ntohs(hip->snap.ethertype));
return 0; return 0;
@ -122,11 +122,11 @@ static int hippi_rebuild_header(struct sk_buff *skb)
/* /*
* Determine the packet's protocol ID. * Determine the packet's protocol ID.
*/ */
__be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev) __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev)
{ {
struct hippi_hdr *hip; struct hippi_hdr *hip;
hip = (struct hippi_hdr *) skb->data; 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 */ /* Never send broadcast/multicast ARP messages */
p->mcast_probes = 0; p->mcast_probes = 0;
/* In IPv6 unicast probes are valid even on NBMA, /* In IPv6 unicast probes are valid even on NBMA,
* because they are encapsulated in normal IPv6 protocol. * because they are encapsulated in normal IPv6 protocol.
* Should be a generic flag. * Should be a generic flag.
*/ */
if (p->tbl->family != AF_INET6) if (p->tbl->family != AF_INET6)
p->ucast_probes = 0; p->ucast_probes = 0;
@ -193,7 +193,7 @@ static void hippi_setup(struct net_device *dev)
dev->hard_header_parse = NULL; dev->hard_header_parse = NULL;
dev->hard_header_cache = NULL; dev->hard_header_cache = NULL;
dev->header_cache_update = 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 * 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 * 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;
} }
/** /**

View File

@ -117,7 +117,7 @@ module_exit(snap_exit);
*/ */
struct datalink_proto *register_snap_client(unsigned char *desc, struct datalink_proto *register_snap_client(unsigned char *desc,
int (*rcvfunc)(struct sk_buff *, int (*rcvfunc)(struct sk_buff *,
struct net_device *, struct net_device *,
struct packet_type *, struct packet_type *,
struct net_device *)) struct net_device *))
{ {

View File

@ -1,6 +1,6 @@
/* /*
* NET3: Token ring device handling subroutines * NET3: Token ring device handling subroutines
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
@ -12,7 +12,7 @@
* 22 Jun 98 Paul Norton <p.norton@computer.org> Rearranged * 22 Jun 98 Paul Norton <p.norton@computer.org> Rearranged
* tr_header and tr_type_trans to handle passing IPX SNAP and * tr_header and tr_type_trans to handle passing IPX SNAP and
* 802.2 through the correct layers. Eliminated tr_reformat. * 802.2 through the correct layers. Eliminated tr_reformat.
* *
*/ */
#include <asm/uaccess.h> #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 * Each RIF entry we learn is kept this way
*/ */
struct rif_cache { struct rif_cache {
unsigned char addr[TR_ALEN]; unsigned char addr[TR_ALEN];
int iface; int iface;
@ -62,7 +62,7 @@ struct rif_cache {
* We hash the RIF cache 32 ways. We do after all have to look it * We hash the RIF cache 32 ways. We do after all have to look it
* up a lot. * up a lot.
*/ */
static struct rif_cache *rif_table[RIF_TABLE_SIZE]; static struct rif_cache *rif_table[RIF_TABLE_SIZE];
static DEFINE_SPINLOCK(rif_lock); static DEFINE_SPINLOCK(rif_lock);
@ -71,7 +71,7 @@ static DEFINE_SPINLOCK(rif_lock);
/* /*
* Garbage disposal timer. * Garbage disposal timer.
*/ */
static struct timer_list rif_timer; static struct timer_list rif_timer;
int sysctl_tr_rif_timeout = 60*10*HZ; 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 * Put the headers on a token ring packet. Token ring source routing
* makes this a little more exciting than on ethernet. * makes this a little more exciting than on ethernet.
*/ */
static int tr_header(struct sk_buff *skb, struct net_device *dev, static int tr_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, unsigned short type,
void *daddr, void *saddr, unsigned len) void *daddr, void *saddr, unsigned len)
{ {
struct trh_hdr *trh; struct trh_hdr *trh;
int hdr_len; 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. * dev->hard_header directly.
*/ */
if (type == ETH_P_IP || type == ETH_P_IPV6 || type == ETH_P_ARP) 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 else
{ {
hdr_len = sizeof(struct trh_hdr); 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; 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 * Build the destination and then source route the frame
*/ */
if(daddr) if(daddr)
{ {
memcpy(trh->daddr,daddr,dev->addr_len); memcpy(trh->daddr,daddr,dev->addr_len);
tr_source_route(skb,trh,dev); 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; return -hdr_len;
} }
/* /*
* A neighbour discovery of some species (eg arp) has completed. We * A neighbour discovery of some species (eg arp) has completed. We
* can now send the packet. * 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 trh_hdr *trh=(struct trh_hdr *)skb->data;
struct trllc *trllc=(struct trllc *)(skb->data+sizeof(struct trh_hdr)); 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 * FIXME: We don't yet support IPv6 over token rings
*/ */
if(trllc->ethertype != htons(ETH_P_IP)) { if(trllc->ethertype != htons(ETH_P_IP)) {
printk("tr_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(trllc->ethertype)); printk("tr_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(trllc->ethertype));
return 0; return 0;
@ -172,39 +172,39 @@ static int tr_rebuild_header(struct sk_buff *skb)
if(arp_find(trh->daddr, skb)) { if(arp_find(trh->daddr, skb)) {
return 1; return 1;
} }
else else
#endif #endif
{ {
tr_source_route(skb,trh,dev); tr_source_route(skb,trh,dev);
return 0; return 0;
} }
} }
/* /*
* Some of this is a bit hackish. We intercept RIF information * Some of this is a bit hackish. We intercept RIF information
* used for source routing. We also grab IP directly and don't feed * used for source routing. We also grab IP directly and don't feed
* it via SNAP. * it via SNAP.
*/ */
__be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev) __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
{ {
struct trh_hdr *trh=(struct trh_hdr *)skb->data; struct trh_hdr *trh=(struct trh_hdr *)skb->data;
struct trllc *trllc; struct trllc *trllc;
unsigned riflen=0; unsigned riflen=0;
skb->mac.raw = skb->data; 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; riflen = (ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8;
trllc = (struct trllc *)(skb->data+sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen); trllc = (struct trllc *)(skb->data+sizeof(struct trh_hdr)-TR_MAXRIFLEN+riflen);
skb_pull(skb,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; skb->pkt_type=PACKET_BROADCAST;
else else
skb->pkt_type=PACKET_MULTICAST; 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; 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)) if(memcmp(trh->daddr, dev->dev_addr, TR_ALEN))
skb->pkt_type=PACKET_OTHERHOST; 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) && if ((skb->pkt_type != PACKET_BROADCAST) &&
(skb->pkt_type != PACKET_MULTICAST)) (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. * 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; int slack;
unsigned int hash; unsigned int hash;
struct rif_cache *entry; struct rif_cache *entry;
unsigned char *olddata; unsigned char *olddata;
unsigned long flags; unsigned long flags;
static const unsigned char mcast_func_addr[] static const unsigned char mcast_func_addr[]
= {0xC0,0x00,0x00,0x04,0x00,0x00}; = {0xC0,0x00,0x00,0x04,0x00,0x00};
spin_lock_irqsave(&rif_lock, flags); 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)) || if( (!memcmp(&(trh->daddr[0]),&(dev->broadcast[0]),TR_ALEN)) ||
(!memcmp(&(trh->daddr[0]),&(mcast_func_addr[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); | TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST);
trh->saddr[0]|=TR_RII; trh->saddr[0]|=TR_RII;
} }
else else
{ {
hash = rif_hash(trh->daddr); 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 we found an entry we can route the frame.
*/ */
if(entry) if(entry)
{ {
#if TR_SR_DEBUG #if TR_SR_DEBUG
printk("source routing for %02X:%02X:%02X:%02X:%02X:%02X\n",trh->daddr[0], 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; trh->rcf=entry->rcf;
memcpy(&trh->rseg[0],&entry->rseg[0],8*sizeof(unsigned short)); 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->rcf&=htons(0x1fff); /* Issam Chehab <ichehab@madge1.demon.co.uk> */
trh->saddr[0]|=TR_RII; 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; entry->last_used=jiffies;
} }
else else
{ {
/* /*
* Without the information we simply have to shout * Without the information we simply have to shout
* on the wire. The replies should rapidly clean this * on the wire. The replies should rapidly clean this
* situation up. * 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); | TR_RCF_FRAME2K | TR_RCF_LIMITED_BROADCAST);
trh->saddr[0]|=TR_RII; trh->saddr[0]|=TR_RII;
#if TR_SR_DEBUG #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) */ /* Compress the RIF here so we don't have to do it in the driver(s) */
if (!(trh->saddr[0] & 0x80)) if (!(trh->saddr[0] & 0x80))
slack = 18; slack = 18;
else else
slack = 18 - ((ntohs(trh->rcf) & TR_RCF_LEN_MASK)>>8); slack = 18 - ((ntohs(trh->rcf) & TR_RCF_LEN_MASK)>>8);
olddata = skb->data; olddata = skb->data;
spin_unlock_irqrestore(&rif_lock, flags); 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 * We have learned some new RIF information for our source
* routing. * routing.
*/ */
static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev) static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev)
{ {
unsigned int hash, rii_p = 0; 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); spin_lock_irqsave(&rif_lock, flags);
saddr0 = trh->saddr[0]; saddr0 = trh->saddr[0];
/* /*
* Firstly see if the entry exists * Firstly see if the entry exists
*/ */
if(trh->saddr[0] & TR_RII) if(trh->saddr[0] & TR_RII)
{ {
trh->saddr[0]&=0x7f; trh->saddr[0]&=0x7f;
if (((ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8) > 2) if (((ntohs(trh->rcf) & TR_RCF_LEN_MASK) >> 8) > 2)
{ {
rii_p = 1; rii_p = 1;
} }
} }
hash = rif_hash(trh->saddr); hash = rif_hash(trh->saddr);
for(entry=rif_table[hash];entry && memcmp(&(entry->addr[0]),&(trh->saddr[0]),TR_ALEN);entry=entry->next); 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 #if TR_SR_DEBUG
printk("adding rif_entry: addr:%02X:%02X:%02X:%02X:%02X:%02X rcf:%04X\n", 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[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)); ntohs(trh->rcf));
#endif #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); entry=kmalloc(sizeof(struct rif_cache),GFP_ATOMIC);
if(!entry) if(!entry)
{ {
printk(KERN_DEBUG "tr.c: Couldn't malloc rif cache entry !\n"); printk(KERN_DEBUG "tr.c: Couldn't malloc rif cache entry !\n");
spin_unlock_irqrestore(&rif_lock, flags); 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; entry->local_ring = 1;
} }
} }
else /* Y. Tahara added */ else /* Y. Tahara added */
{ {
/* /*
* Update existing entries * Update existing entries
*/ */
if (!entry->local_ring) if (!entry->local_ring)
if (entry->rcf != (trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK)) && if (entry->rcf != (trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK)) &&
!(trh->rcf & htons(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)); ntohs(trh->rcf));
#endif #endif
entry->rcf = trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK); entry->rcf = trh->rcf & htons((unsigned short)~TR_RCF_BROADCAST_MASK);
memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short)); memcpy(&(entry->rseg[0]),&(trh->rseg[0]),8*sizeof(unsigned short));
} }
entry->last_used=jiffies; entry->last_used=jiffies;
} }
trh->saddr[0]=saddr0; /* put the routing indicator back for tcpdump */ trh->saddr[0]=saddr0; /* put the routing indicator back for tcpdump */
spin_unlock_irqrestore(&rif_lock, flags); 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. * 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; int i;
unsigned long flags, next_interval = jiffies + sysctl_tr_rif_timeout/2; unsigned long flags, next_interval = jiffies + sysctl_tr_rif_timeout/2;
spin_lock_irqsave(&rif_lock, flags); spin_lock_irqsave(&rif_lock, flags);
for(i =0; i < RIF_TABLE_SIZE; i++) { for(i =0; i < RIF_TABLE_SIZE; i++) {
struct rif_cache *entry, **pentry; struct rif_cache *entry, **pentry;
pentry = rif_table+i; pentry = rif_table+i;
while((entry=*pentry) != NULL) { while((entry=*pentry) != NULL) {
unsigned long expires unsigned long expires
@ -455,7 +455,7 @@ static void rif_check_expire(unsigned long dummy)
} }
} }
} }
spin_unlock_irqrestore(&rif_lock, flags); spin_unlock_irqrestore(&rif_lock, flags);
mod_timer(&rif_timer, next_interval); 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 * Generate the /proc/net information for the token ring RIF
* routing. * routing.
*/ */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static struct rif_cache *rif_get_idx(loff_t pos) 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; struct rif_cache *entry;
loff_t off = 0; 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) { for(entry = rif_table[i]; entry; entry = entry->next) {
if (off == pos) if (off == pos)
return entry; return entry;
@ -504,7 +504,7 @@ static void *rif_seq_next(struct seq_file *seq, void *v, loff_t *pos)
goto scan; goto scan;
} }
if (ent->next) if (ent->next)
return ent->next; return ent->next;
i = rif_hash(ent->addr); i = rif_hash(ent->addr);
@ -541,13 +541,13 @@ static int rif_seq_show(struct seq_file *seq, void *v)
ttl/HZ); ttl/HZ);
if (entry->local_ring) if (entry->local_ring)
seq_puts(seq, "local\n"); seq_puts(seq, "local\n");
else { else {
seq_printf(seq, "%04X", ntohs(entry->rcf)); 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) if (rcf_len)
rcf_len >>= 1; rcf_len >>= 1;
for(j = 1; j < rcf_len; j++) { for(j = 1; j < rcf_len; j++) {
if(j==1) { if(j==1) {
segment=ntohs(entry->rseg[j-1])>>4; 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'); seq_putc(seq, '\n');
} }
} }
return 0; return 0;
} }
@ -591,7 +591,7 @@ static void tr_setup(struct net_device *dev)
/* /*
* Configure and register * Configure and register
*/ */
dev->hard_header = tr_header; dev->hard_header = tr_header;
dev->rebuild_header = tr_rebuild_header; dev->rebuild_header = tr_rebuild_header;
@ -600,7 +600,7 @@ static void tr_setup(struct net_device *dev)
dev->mtu = 2000; dev->mtu = 2000;
dev->addr_len = TR_ALEN; dev->addr_len = TR_ALEN;
dev->tx_queue_len = 100; /* Long queues on tr */ dev->tx_queue_len = 100; /* Long queues on tr */
memset(dev->broadcast,0xFF, TR_ALEN); memset(dev->broadcast,0xFF, TR_ALEN);
/* New-style flags. */ /* New-style flags. */

View File

@ -5,7 +5,7 @@
* Authors: Ben Greear <greearb@candelatech.com> * Authors: Ben Greear <greearb@candelatech.com>
* Please send support related email to: vlan@scry.wanfear.com * Please send support related email to: vlan@scry.wanfear.com
* VLAN Home Page: http://www.candelatech.com/~greear/vlan.html * VLAN Home Page: http://www.candelatech.com/~greear/vlan.html
* *
* Fixes: * Fixes:
* Fix for packet capture - Nick Eggleston <nick@dccinc.com>; * Fix for packet capture - Nick Eggleston <nick@dccinc.com>;
* Add HW acceleration hooks - David S. Miller <davem@redhat.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) * Function vlan_proto_init (pro)
* *
* Initialize VLAN protocol layer, * Initialize VLAN protocol layer,
* *
*/ */
static int __init vlan_proto_init(void) static int __init vlan_proto_init(void)
@ -87,7 +87,7 @@ static int __init vlan_proto_init(void)
/* proc file system initialization */ /* proc file system initialization */
err = vlan_proc_init(); err = vlan_proc_init();
if (err < 0) { if (err < 0) {
printk(KERN_ERR printk(KERN_ERR
"%s %s: can't create entry in proc filesystem!\n", "%s %s: can't create entry in proc filesystem!\n",
__FUNCTION__, VLAN_NAME); __FUNCTION__, VLAN_NAME);
return err; return err;
@ -108,7 +108,7 @@ static int __init vlan_proto_init(void)
return 0; return 0;
} }
/* Cleanup all vlan devices /* Cleanup all vlan devices
* Note: devices that have been registered that but not * Note: devices that have been registered that but not
* brought up will exist but have no module ref count. * 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. * Module 'remove' entry point.
* o delete /proc/net/router directory and static entries. * o delete /proc/net/router directory and static entries.
*/ */
static void __exit vlan_cleanup_module(void) static void __exit vlan_cleanup_module(void)
{ {
int i; 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); struct vlan_group *grp = __vlan_find_group(real_dev->ifindex);
if (grp) if (grp)
return grp->vlan_devices[VID]; return grp->vlan_devices[VID];
return NULL; 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) 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) if (ret == 1)
ret = 0; ret = 0;
} else { } else {
printk(VLAN_ERR printk(VLAN_ERR
"%s: ERROR: Tried to remove a non-vlan device " "%s: ERROR: Tried to remove a non-vlan device "
"with VLAN code, name: %s priv_flags: %hX\n", "with VLAN code, name: %s priv_flags: %hX\n",
__FUNCTION__, dev->name, dev->priv_flags); __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) static void vlan_setup(struct net_device *new_dev)
{ {
SET_MODULE_OWNER(new_dev); SET_MODULE_OWNER(new_dev);
/* new_dev->ifindex = 0; it will be set when added to /* new_dev->ifindex = 0; it will be set when added to
* the global list. * the global list.
* iflink is set as well. * 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 */ /* Make this thing known as a VLAN device */
new_dev->priv_flags |= IFF_802_1Q_VLAN; new_dev->priv_flags |= IFF_802_1Q_VLAN;
/* Set us up to have no queue, as the underlying Hardware device /* Set us up to have no queue, as the underlying Hardware device
* can do all the queueing we could want. * 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: default:
snprintf(name, IFNAMSIZ, "vlan%.4i", VLAN_ID); snprintf(name, IFNAMSIZ, "vlan%.4i", VLAN_ID);
}; };
new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name, new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name,
vlan_setup); 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) | new_dev->state = (real_dev->state & ((1<<__LINK_STATE_NOCARRIER) |
(1<<__LINK_STATE_DORMANT))) | (1<<__LINK_STATE_DORMANT))) |
(1<<__LINK_STATE_PRESENT); (1<<__LINK_STATE_PRESENT);
/* need 4 bytes for extra VLAN header info, /* need 4 bytes for extra VLAN header info,
* hope the underlying device can handle it. * 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", VLAN_MEM_DBG("new_dev->priv malloc, addr: %p size: %i\n",
new_dev->priv, new_dev->priv,
sizeof(struct vlan_dev_info)); sizeof(struct vlan_dev_info));
memcpy(new_dev->broadcast, real_dev->broadcast, real_dev->addr_len); memcpy(new_dev->broadcast, real_dev->broadcast, real_dev->addr_len);
memcpy(new_dev->dev_addr, real_dev->dev_addr, 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; 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", printk(VLAN_DBG "About to go find the group for idx: %i\n",
real_dev->ifindex); real_dev->ifindex);
#endif #endif
if (register_netdevice(new_dev)) if (register_netdevice(new_dev))
goto out_free_newdev; 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); grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL);
if (!grp) if (!grp)
goto out_free_unregister; goto out_free_unregister;
/* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */ /* printk(KERN_ALERT "VLAN REGISTER: Allocated new group.\n"); */
grp->real_dev_ifindex = real_dev->ifindex; 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)]); &vlan_group_hash[vlan_grp_hashfn(real_dev->ifindex)]);
if (real_dev->features & NETIF_F_HW_VLAN_RX) if (real_dev->features & NETIF_F_HW_VLAN_RX)
real_dev->vlan_rx_register(real_dev, grp); real_dev->vlan_rx_register(real_dev, grp);
} }
grp->vlan_devices[VLAN_ID] = new_dev; grp->vlan_devices[VLAN_ID] = new_dev;
if (vlan_proc_add_dev(new_dev)<0)/* create it's proc entry */ 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", printk(KERN_WARNING "VLAN: failed to add proc entry for %s\n",
new_dev->name); new_dev->name);
if (real_dev->features & NETIF_F_HW_VLAN_FILTER) if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
real_dev->vlan_rx_add_vid(real_dev, VLAN_ID); 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]; vlandev = grp->vlan_devices[i];
if (!vlandev) if (!vlandev)
continue; continue;
flgs = vlandev->flags; flgs = vlandev->flags;
if (flgs & IFF_UP) if (flgs & IFF_UP)
continue; continue;
@ -643,7 +643,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
dev_change_flags(vlandev, flgs | IFF_UP); dev_change_flags(vlandev, flgs | IFF_UP);
} }
break; break;
case NETDEV_UNREGISTER: case NETDEV_UNREGISTER:
/* Delete all VLANs for this dev. */ /* Delete all VLANs for this dev. */
for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) { for (i = 0; i < VLAN_GROUP_ARRAY_LEN; i++) {
@ -755,8 +755,8 @@ static int vlan_ioctl_handler(void __user *arg)
/* TODO: Implement /* TODO: Implement
err = vlan_dev_get_ingress_priority(args); err = vlan_dev_get_ingress_priority(args);
if (copy_to_user((void*)arg, &args, if (copy_to_user((void*)arg, &args,
sizeof(struct vlan_ioctl_args))) { sizeof(struct vlan_ioctl_args))) {
err = -EFAULT; err = -EFAULT;
} }
*/ */
err = -EINVAL; err = -EINVAL;
@ -765,8 +765,8 @@ static int vlan_ioctl_handler(void __user *arg)
/* TODO: Implement /* TODO: Implement
err = vlan_dev_get_egress_priority(args.device1, &(args.args); err = vlan_dev_get_egress_priority(args.device1, &(args.args);
if (copy_to_user((void*)arg, &args, if (copy_to_user((void*)arg, &args,
sizeof(struct vlan_ioctl_args))) { sizeof(struct vlan_ioctl_args))) {
err = -EFAULT; err = -EFAULT;
} }
*/ */
err = -EINVAL; err = -EINVAL;
@ -788,7 +788,7 @@ static int vlan_ioctl_handler(void __user *arg)
args.u.VID = vid; args.u.VID = vid;
if (copy_to_user(arg, &args, if (copy_to_user(arg, &args,
sizeof(struct vlan_ioctl_args))) { sizeof(struct vlan_ioctl_args))) {
err = -EFAULT; err = -EFAULT;
} }
break; break;

View File

@ -9,8 +9,8 @@
#define VLAN_ERR KERN_ERR #define VLAN_ERR KERN_ERR
#define VLAN_INF KERN_INFO #define VLAN_INF KERN_INFO
#define VLAN_DBG KERN_ALERT /* change these... to debug, having a hard time #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! */ /* 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) #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 */ /* found in vlan_dev.c */
int vlan_dev_rebuild_header(struct sk_buff *skb); int vlan_dev_rebuild_header(struct sk_buff *skb);
int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, 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, int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, void *daddr, void *saddr, unsigned short type, void *daddr, void *saddr,
unsigned len); unsigned len);
int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); 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_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_change_mtu(struct net_device *dev, int new_mtu);

View File

@ -5,14 +5,14 @@
* Authors: Ben Greear <greearb@candelatech.com> * Authors: Ben Greear <greearb@candelatech.com>
* Please send support related email to: vlan@scry.wanfear.com * Please send support related email to: vlan@scry.wanfear.com
* VLAN Home Page: http://www.candelatech.com/~greear/vlan.html * VLAN Home Page: http://www.candelatech.com/~greear/vlan.html
* *
* Fixes: Mar 22 2001: Martin Bokaemper <mbokaemper@unispherenetworks.com> * Fixes: Mar 22 2001: Martin Bokaemper <mbokaemper@unispherenetworks.com>
* - reset skb->pkt_type on incoming packets when MAC was changed * - reset skb->pkt_type on incoming packets when MAC was changed
* - see that changed MAC is saddr for outgoing packets * - see that changed MAC is saddr for outgoing packets
* Oct 20, 2001: Ard van Breeman: * Oct 20, 2001: Ard van Breeman:
* - Fix MC-list, finally. * - Fix MC-list, finally.
* - Flush MC-list on VLAN destroy. * - Flush MC-list on VLAN destroy.
* *
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * 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... */ /* TODO: Confirm this will work with VLAN headers... */
return arp_find(veth->h_dest, skb); return arp_find(veth->h_dest, skb);
#endif #endif
default: default:
printk(VLAN_DBG 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)); dev->name, ntohs(veth->h_vlan_encapsulated_proto));
memcpy(veth->h_source, dev->dev_addr, ETH_ALEN); memcpy(veth->h_source, dev->dev_addr, ETH_ALEN);
break; 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. * 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. * 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, 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; unsigned char *rawp = NULL;
struct vlan_hdr *vhdr = (struct vlan_hdr *)(skb->data); 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 #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", 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, __FUNCTION__, skb, dev->name,
VLAN_DEV_INFO(skb->dev)->real_dev->name, VLAN_DEV_INFO(skb->dev)->real_dev->name,
skb->dev->name); skb->dev->name);
#endif #endif
kfree_skb(skb); kfree_skb(skb);
@ -191,7 +191,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
#ifdef VLAN_DEBUG #ifdef VLAN_DEBUG
printk(VLAN_DBG "%s: priority: %lu for TCI: %hu (hbo)\n", 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)); ntohs(vhdr->h_vlan_TCI));
#endif #endif
@ -207,7 +207,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
stats->multicast++; stats->multicast++;
break; break;
case PACKET_OTHERHOST: case PACKET_OTHERHOST:
/* Our lower layer thinks this is not local, let's make sure. /* Our lower layer thinks this is not local, let's make sure.
* This allows the VLAN to have a different MAC than the underlying * This allows the VLAN to have a different MAC than the underlying
* device, and still route correctly. * 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 * saddr=NULL means use device source address
* daddr=NULL means leave destination address (eg unresolved arp) * 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. * physical devices.
*/ */
int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, void *daddr, void *saddr, unsigned short type, void *daddr, void *saddr,
unsigned len) unsigned len)
{ {
struct vlan_hdr *vhdr; struct vlan_hdr *vhdr;
unsigned short veth_TCI = 0; 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 * 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 * sending a frame that is VLAN encoded (the consensus is that the VLAN
* device should look completely like an Ethernet device when the * 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 * header shuffling in the hard_start_xmit. Users can turn off this
* REORDER behaviour with the vconfig tool. * 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 net_device *dev = dev_get_by_name(dev_name);
struct vlan_priority_tci_mapping *mp = NULL; struct vlan_priority_tci_mapping *mp = NULL;
struct vlan_priority_tci_mapping *np; struct vlan_priority_tci_mapping *np;
if (dev) { if (dev) {
if (dev->priv_flags & IFF_802_1Q_VLAN) { if (dev->priv_flags & IFF_802_1Q_VLAN) {
/* See if a priority mapping exists.. */ /* 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; return -EINVAL;
} }
} else { } else {
printk(KERN_ERR printk(KERN_ERR
"%s: %s is not a vlan device, priv_flags: %hX.\n", "%s: %s is not a vlan device, priv_flags: %hX.\n",
__FUNCTION__, dev->name, dev->priv_flags); __FUNCTION__, dev->name, dev->priv_flags);
dev_put(dev); dev_put(dev);
} }
} else { } else {
printk(KERN_ERR "%s: Could not find device: %s\n", printk(KERN_ERR "%s: Could not find device: %s\n",
__FUNCTION__, dev_name); __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, 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) && return ((dmi1->dmi_addrlen == dmi2->dmi_addrlen) &&
(memcmp(dmi1->dmi_addr, dmi2->dmi_addr, dmi1->dmi_addrlen) == 0)); (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 SIOCGMIIPHY:
case SIOCGMIIREG: case SIOCGMIIREG:
case SIOCSMIIREG: 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); err = real_dev->do_ioctl(real_dev, &ifrr, cmd);
break; break;
@ -818,7 +818,7 @@ int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
err = dev_ethtool(&ifrr); err = dev_ethtool(&ifrr);
} }
if (!err) if (!err)
ifr->ifr_ifru = ifrr.ifr_ifru; ifr->ifr_ifru = ifrr.ifr_ifru;
return err; return err;

View File

@ -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"; 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 = { 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; static struct proc_dir_entry *proc_vlan_dir;
/* /*
* /proc/net/vlan/config * /proc/net/vlan/config
*/ */
static struct proc_dir_entry *proc_vlan_conf; 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 */ /* 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; dev = dev->next;
return dev; 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) static void *vlan_seq_start(struct seq_file *seq, loff_t *pos)
{ {
struct net_device *dev; struct net_device *dev;
@ -256,19 +256,19 @@ static void *vlan_seq_start(struct seq_file *seq, loff_t *pos)
if (*pos == 0) if (*pos == 0)
return SEQ_START_TOKEN; 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); dev = vlan_skip(dev->next), ++i);
return (i == *pos) ? dev : NULL; return (i == *pos) ? dev : NULL;
} }
static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos) static void *vlan_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{ {
++*pos; ++*pos;
return vlan_skip((v == SEQ_START_TOKEN) return vlan_skip((v == SEQ_START_TOKEN)
? dev_base ? dev_base
: ((struct net_device *)v)->next); : ((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)) if (vlan_name_type < ARRAY_SIZE(vlan_name_type_str))
nmtype = vlan_name_type_str[vlan_name_type]; 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" ); nmtype ? nmtype : "UNKNOWN" );
} else { } else {
const struct net_device *vlandev = v; const struct net_device *vlandev = v;
const struct vlan_dev_info *dev_info = VLAN_DEV_INFO(vlandev); 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); dev_info->vlan_id, dev_info->real_dev->name);
} }
return 0; return 0;
@ -323,13 +323,13 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
seq_puts(seq, "\n"); seq_puts(seq, "\n");
seq_printf(seq, fmt, "total frames transmitted", stats->tx_packets); 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 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); 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); dev_info->cnt_encap_on_xmit);
seq_printf(seq, "Device: %s", dev_info->real_dev->name); seq_printf(seq, "Device: %s", dev_info->real_dev->name);
/* now show all PRIORITY mappings relating to this VLAN */ /* 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", "\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[0],
dev_info->ingress_priority_map[1], dev_info->ingress_priority_map[1],

View File

@ -895,7 +895,7 @@ struct aarp_iter_state {
/* /*
* Get the aarp entry that is in the chain described * 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. * If pos is set then skip till that index.
* pos = 1 is the first entry * 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; struct aarp_entry **table = iter->table;
loff_t off = 0; loff_t off = 0;
struct aarp_entry *entry; struct aarp_entry *entry;
rescan: rescan:
while(ct < AARP_HASH_SIZE) { while(ct < AARP_HASH_SIZE) {
for (entry = table[ct]; entry; entry = entry->next) { 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; ++*pos;
/* first line after header */ /* first line after header */
if (v == SEQ_START_TOKEN) if (v == SEQ_START_TOKEN)
entry = iter_next(iter, NULL); entry = iter_next(iter, NULL);
/* next entry in current bucket */ /* next entry in current bucket */
else if (entry->next) else if (entry->next)
entry = entry->next; entry = entry->next;
@ -986,7 +986,7 @@ static int aarp_seq_show(struct seq_file *seq, void *v)
unsigned long now = jiffies; unsigned long now = jiffies;
if (v == SEQ_START_TOKEN) if (v == SEQ_START_TOKEN)
seq_puts(seq, seq_puts(seq,
"Address Interface Hardware Address" "Address Interface Hardware Address"
" Expires LastSend Retry Status\n"); " Expires LastSend Retry Status\n");
else { else {
@ -1014,7 +1014,7 @@ static int aarp_seq_show(struct seq_file *seq, void *v)
: (iter->table == unresolved) ? "unresolved" : (iter->table == unresolved) ? "unresolved"
: (iter->table == proxies) ? "proxies" : (iter->table == proxies) ? "proxies"
: "unknown"); : "unknown");
} }
return 0; return 0;
} }
@ -1030,7 +1030,7 @@ static int aarp_seq_open(struct inode *inode, struct file *file)
struct seq_file *seq; struct seq_file *seq;
int rc = -ENOMEM; int rc = -ENOMEM;
struct aarp_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); struct aarp_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
if (!s) if (!s)
goto out; goto out;

View File

@ -292,7 +292,7 @@ int __init atalk_proc_init(void)
p->proc_fops = &atalk_seq_socket_fops; p->proc_fops = &atalk_seq_socket_fops;
p = create_proc_entry("arp", S_IRUGO, atalk_proc_dir); p = create_proc_entry("arp", S_IRUGO, atalk_proc_dir);
if (!p) if (!p)
goto out_arp; goto out_arp;
p->proc_fops = &atalk_seq_arp_fops; p->proc_fops = &atalk_seq_arp_fops;

View File

@ -28,16 +28,16 @@
* Bradford Johnson : IP-over-DDP (experimental) * Bradford Johnson : IP-over-DDP (experimental)
* Jay Schulist : Moved IP-over-DDP to its own * Jay Schulist : Moved IP-over-DDP to its own
* driver file. (ipddp.c & ipddp.h) * driver file. (ipddp.c & ipddp.h)
* Jay Schulist : Made work as module with * Jay Schulist : Made work as module with
* AppleTalk drivers, cleaned it. * AppleTalk drivers, cleaned it.
* Rob Newberry : Added proxy AARP and AARP * Rob Newberry : Added proxy AARP and AARP
* procfs, moved probing to AARP * procfs, moved probing to AARP
* module. * module.
* Adrian Sun/ * Adrian Sun/
* Michael Zuelsdorff : fix for net.0 packets. don't * Michael Zuelsdorff : fix for net.0 packets. don't
* allow illegal ether/tokentalk * allow illegal ether/tokentalk
* port assignment. we lose a * port assignment. we lose a
* valid localtalk port as a * valid localtalk port as a
* result. * result.
* Arnaldo C. de Melo : Cleanup, in preparation for * Arnaldo C. de Melo : Cleanup, in preparation for
* shared skb support 8) * shared skb support 8)
@ -48,7 +48,7 @@
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
* *
*/ */
#include <linux/capability.h> #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) if (to->sat_port != at->src_port)
continue; continue;
if (to->sat_addr.s_net == ATADDR_ANYNET && if (to->sat_addr.s_net == ATADDR_ANYNET &&
to->sat_addr.s_node == ATADDR_BCAST) to->sat_addr.s_node == ATADDR_BCAST)
goto found; 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 == at->src_node ||
to->sat_addr.s_node == ATADDR_BCAST || to->sat_addr.s_node == ATADDR_BCAST ||
to->sat_addr.s_node == ATADDR_ANYNODE)) to->sat_addr.s_node == ATADDR_ANYNODE))
goto found; 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. */ * that the node is appropriately set. */
if (to->sat_addr.s_node == ATADDR_ANYNODE && if (to->sat_addr.s_node == ATADDR_ANYNODE &&
to->sat_addr.s_net != ATADDR_ANYNET && 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) if (probe_node == ATADDR_ANYNODE)
probe_node = jiffies & 0xFF; probe_node = jiffies & 0xFF;
/* Scan the networks */ /* Scan the networks */
for (netct = 0; netct <= netrange; netct++) { for (netct = 0; netct <= netrange; netct++) {
/* Sweep the available nodes from a given start */ /* 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 && if (node == ATADDR_ANYNODE && net != ATADDR_ANYNET &&
ntohs(iface->nets.nr_firstnet) <= ntohs(net) && ntohs(iface->nets.nr_firstnet) <= ntohs(net) &&
ntohs(net) <= ntohs(iface->nets.nr_lastnet)) ntohs(net) <= ntohs(iface->nets.nr_lastnet))
break; break;
} }
read_unlock_bh(&atalk_interfaces_lock); read_unlock_bh(&atalk_interfaces_lock);
return iface; 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) 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 * host route, because some host routes might overlap
* network routes * network routes
*/ */
struct atalk_route *net_route = NULL; struct atalk_route *net_route = NULL;
struct atalk_route *r; struct atalk_route *r;
read_lock_bh(&atalk_routes_lock); read_lock_bh(&atalk_routes_lock);
for (r = atalk_routes; r; r = r->next) { for (r = atalk_routes; r; r = r->next) {
if (!(r->flags & RTF_UP)) if (!(r->flags & RTF_UP))
@ -460,8 +460,8 @@ static struct atalk_route *atrtr_find(struct atalk_addr *target)
net_route = r; net_route = r;
} }
} }
/* /*
* if we found a network route but not a direct host * if we found a network route but not a direct host
* route, then return it * 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) { for (iface = atalk_interfaces; iface; iface = iface->next) {
if (!riface && if (!riface &&
ntohs(ga->sat_addr.s_net) >= ntohs(ga->sat_addr.s_net) >=
ntohs(iface->nets.nr_firstnet) && ntohs(iface->nets.nr_firstnet) &&
ntohs(ga->sat_addr.s_net) <= ntohs(ga->sat_addr.s_net) <=
ntohs(iface->nets.nr_lastnet)) ntohs(iface->nets.nr_lastnet))
riface = iface; riface = iface;
if (ga->sat_addr.s_net == iface->address.s_net && if (ga->sat_addr.s_net == iface->address.s_net &&
ga->sat_addr.s_node == iface->address.s_node) ga->sat_addr.s_node == iface->address.s_node)
riface = iface; riface = iface;
} }
read_unlock_bh(&atalk_interfaces_lock); read_unlock_bh(&atalk_interfaces_lock);
retval = -ENETUNREACH; retval = -ENETUNREACH;
@ -649,7 +649,7 @@ static int ddp_device_event(struct notifier_block *this, unsigned long event,
{ {
if (event == NETDEV_DOWN) if (event == NETDEV_DOWN)
/* Discard any use of this */ /* Discard any use of this */
atalk_dev_down(ptr); atalk_dev_down(ptr);
return NOTIFY_DONE; return NOTIFY_DONE;
} }
@ -701,13 +701,13 @@ static int atif_ioctl(int cmd, void __user *arg)
*/ */
if ((dev->flags & IFF_POINTOPOINT) && if ((dev->flags & IFF_POINTOPOINT) &&
atalk_find_interface(sa->sat_addr.s_net, 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 " printk(KERN_DEBUG "AppleTalk: point-to-point "
"interface added with " "interface added with "
"existing address\n"); "existing address\n");
add_route = 0; add_route = 0;
} }
/* /*
* Phase 1 is fine on LocalTalk but we don't do * Phase 1 is fine on LocalTalk but we don't do
* EtherTalk phase 1. Anyone wanting to add it go ahead. * 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; sa->sat_addr.s_node = ATADDR_BCAST;
break; break;
case SIOCATALKDIFADDR: case SIOCATALKDIFADDR:
case SIOCDIFADDR: case SIOCDIFADDR:
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
if (sa->sat_family != AF_APPLETALK) if (sa->sat_family != AF_APPLETALK)
return -EINVAL; return -EINVAL;
atalk_dev_down(dev); atalk_dev_down(dev);
break; break;
case SIOCSARP: case SIOCSARP:
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
if (sa->sat_family != AF_APPLETALK) if (sa->sat_family != AF_APPLETALK)
return -EINVAL; return -EINVAL;
if (!atif) if (!atif)
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
/* /*
* for now, we only support proxy AARP on ELAP; * for now, we only support proxy AARP on ELAP;
* we should be able to do it for LocalTalk, too. * we should be able to do it for LocalTalk, too.
*/ */
if (dev->type != ARPHRD_ETHER) if (dev->type != ARPHRD_ETHER)
return -EPROTONOSUPPORT; return -EPROTONOSUPPORT;
/* /*
* atif points to the current interface on this network; * atif points to the current interface on this network;
* we aren't concerned about its current status (at * we aren't concerned about its current status (at
* least for now), but it has all the settings about * least for now), but it has all the settings about
* the network we're going to probe. Consequently, it * the network we're going to probe. Consequently, it
* must exist. * must exist.
*/ */
if (!atif) if (!atif)
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
nr = (struct atalk_netrange *)&(atif->nets); 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;
/* /*
* 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 * the AARP code will defend it for us until we take it
* down. We don't set up any routes right now, because * down. We don't set up any routes right now, because
* ATCP will install them manually via SIOCADDRT. * ATCP will install them manually via SIOCADDRT.
*/ */
break; break;
case SIOCDARP: case SIOCDARP:
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
if (sa->sat_family != AF_APPLETALK) if (sa->sat_family != AF_APPLETALK)
return -EINVAL; return -EINVAL;
if (!atif) if (!atif)
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
/* give to aarp module to remove proxy entry */ /* give to aarp module to remove proxy entry */
aarp_proxy_remove(atif->dev, &(sa->sat_addr)); aarp_proxy_remove(atif->dev, &(sa->sat_addr));
return 0; return 0;
} }
return copy_to_user(arg, &atreq, sizeof(atreq)) ? -EFAULT : 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); dev = __dev_get_by_name(name);
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
} }
return atrtr_create(&rt, dev); 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 * Checksum: This is 'optional'. It's quite likely also a good
* candidate for assembler hackery 8) * 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) int len, unsigned long sum)
{ {
/* This ought to be unwrapped neatly. I'll trust gcc for now */ /* 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) if (copy > len)
copy = len; copy = len;
sum = atalk_sum_partial(skb->data + offset, copy, sum); sum = atalk_sum_partial(skb->data + offset, copy, sum);
if ( (len -= copy) == 0) if ( (len -= copy) == 0)
return sum; return sum;
offset += copy; 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 * 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) if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
goto out; goto out;
@ -1196,14 +1196,14 @@ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr,
if (addr->sat_addr.s_node == ATADDR_BCAST && if (addr->sat_addr.s_node == ATADDR_BCAST &&
!sock_flag(sk, SOCK_BROADCAST)) { !sock_flag(sk, SOCK_BROADCAST)) {
#if 1 #if 1
printk(KERN_WARNING "%s is broken and did not set " printk(KERN_WARNING "%s is broken and did not set "
"SO_BROADCAST. It will break when 2.2 is " "SO_BROADCAST. It will break when 2.2 is "
"released.\n", "released.\n",
current->comm); current->comm);
#else #else
return -EACCES; return -EACCES;
#endif #endif
} }
if (sock_flag(sk, SOCK_ZAPPED)) 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) #if defined(CONFIG_IPDDP) || defined(CONFIG_IPDDP_MODULE)
static __inline__ int is_ip_over_ddp(struct sk_buff *skb) 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) 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; struct net_device_stats *stats;
/* This needs to be able to handle ipddp"N" devices */ /* This needs to be able to handle ipddp"N" devices */
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
skb_pull(skb, 13); skb_pull(skb, 13);
skb->dev = dev; skb->dev = dev;
skb->h.raw = skb->data; skb->h.raw = skb->data;
stats = dev->priv; stats = dev->priv;
stats->rx_packets++; stats->rx_packets++;
stats->rx_bytes += skb->len + 13; stats->rx_bytes += skb->len + 13;
netif_rx(skb); /* Send the SKB up to a higher place. */ netif_rx(skb); /* Send the SKB up to a higher place. */
return 0; return 0;
} }
#else #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 * Don't route multicast, etc., packets, or packets sent to "this
* network" * network"
*/ */
if (skb->pkt_type != PACKET_HOST || !ddp->deh_dnet) { 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; ta.s_node = rt->gateway.s_node;
} }
/* Fix up skb->len field */ /* Fix up skb->len field */
skb_trim(skb, min_t(unsigned int, origlen, skb_trim(skb, min_t(unsigned int, origlen,
(rt->dev->hard_header_len + (rt->dev->hard_header_len +
ddp_dl->header_length + (len_hops & 1023)))); 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 */ /* 22 bytes - 12 ether, 2 len, 3 802.2 5 snap */
struct sk_buff *nskb = skb_realloc_headroom(skb, 32); struct sk_buff *nskb = skb_realloc_headroom(skb, 32);
kfree_skb(skb); kfree_skb(skb);
if (!nskb) if (!nskb)
goto out; goto out;
skb = nskb; skb = nskb;
} else } else
skb = skb_unshare(skb, GFP_ATOMIC); skb = skb_unshare(skb, GFP_ATOMIC);
/* /*
* If the buffer didn't vanish into the lack of space bitbucket we can * If the buffer didn't vanish into the lack of space bitbucket we can
* send it. * send it.
@ -1395,13 +1395,13 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
struct sock *sock; struct sock *sock;
struct atalk_iface *atif; struct atalk_iface *atif;
struct sockaddr_at tosat; struct sockaddr_at tosat;
int origlen; int origlen;
__u16 len_hops; __u16 len_hops;
/* Don't mangle buffer if shared */ /* Don't mangle buffer if shared */
if (!(skb = skb_share_check(skb, GFP_ATOMIC))) if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
goto out; goto out;
/* Size check and make sure header is contiguous */ /* Size check and make sure header is contiguous */
if (!pskb_may_pull(skb, sizeof(*ddp))) if (!pskb_may_pull(skb, sizeof(*ddp)))
goto freeit; goto freeit;
@ -1490,7 +1490,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
goto freeit; goto freeit;
/* Don't mangle buffer if shared */ /* Don't mangle buffer if shared */
if (!(skb = skb_share_check(skb, GFP_ATOMIC))) if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
return 0; return 0;
/* /*
@ -1501,11 +1501,11 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
/* Now fill in the long header */ /* Now fill in the long header */
/* /*
* These two first. The mac overlays the new source/dest * These two first. The mac overlays the new source/dest
* network information so we MUST copy these before * network information so we MUST copy these before
* we write the network numbers ! * we write the network numbers !
*/ */
ddp->deh_dnode = skb->mac.raw[0]; /* From physical header */ ddp->deh_dnode = skb->mac.raw[0]; /* From physical header */
ddp->deh_snode = skb->mac.raw[1]; /* 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); skb = sock_alloc_send_skb(sk, size, (flags & MSG_DONTWAIT), &err);
if (!skb) if (!skb)
return err; return err;
skb->sk = sk; skb->sk = sk;
skb_reserve(skb, ddp_dl->header_length); skb_reserve(skb, ddp_dl->header_length);
skb_reserve(skb, dev->hard_header_len); skb_reserve(skb, dev->hard_header_len);

View File

@ -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) static int ltalk_mac_addr(struct net_device *dev, void *addr)
{ {
return -EINVAL; return -EINVAL;
} }
static void ltalk_setup(struct net_device *dev) static void ltalk_setup(struct net_device *dev)
{ {
/* Fill in the fields of the device structure with localtalk-generic values. */ /* Fill in the fields of the device structure with localtalk-generic values. */
dev->change_mtu = ltalk_change_mtu; dev->change_mtu = ltalk_change_mtu;
dev->hard_header = NULL; dev->hard_header = NULL;
dev->rebuild_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->hard_header_len = LTALK_HLEN;
dev->mtu = LTALK_MTU; dev->mtu = LTALK_MTU;
dev->addr_len = LTALK_ALEN; dev->addr_len = LTALK_ALEN;
dev->tx_queue_len = 10; dev->tx_queue_len = 10;
dev->broadcast[0] = 0xFF; dev->broadcast[0] = 0xFF;
dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;

View File

@ -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) static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
{ {
unsigned long flags; unsigned long flags;
char *pos = buf; char *pos = buf;
struct atm_dev *adev = to_atm_dev(cdev); 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 bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin;
int i, j; int i, j;
spin_lock_irqsave(&adev->lock, flags); spin_lock_irqsave(&adev->lock, flags);
list_for_each_entry(aaddr, &adev->local, entry) { list_for_each_entry(aaddr, &adev->local, entry) {
for(i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) { for(i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) {
if (j == *fmt) { if (j == *fmt) {
pos += sprintf(pos, "."); pos += sprintf(pos, ".");
@ -49,7 +49,7 @@ static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
} }
pos += sprintf(pos, "\n"); pos += sprintf(pos, "\n");
} }
spin_unlock_irqrestore(&adev->lock, flags); spin_unlock_irqrestore(&adev->lock, flags);
return pos - buf; return pos - buf;
} }
@ -61,7 +61,7 @@ static ssize_t show_carrier(struct class_device *cdev, char *buf)
pos += sprintf(pos, "%d\n", pos += sprintf(pos, "%d\n",
adev->signal == ATM_PHY_SIG_LOST ? 0 : 1); adev->signal == ATM_PHY_SIG_LOST ? 0 : 1);
return pos - buf; 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; link_rate = adev->link_rate * 8 * 53;
} }
pos += sprintf(pos, "%d\n", link_rate); pos += sprintf(pos, "%d\n", link_rate);
return pos - buf; return pos - buf;
} }

View File

@ -182,7 +182,7 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc; ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc;
DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev); DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev);
if (!atm_may_send(atmvcc, skb->truesize)) { 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. layer whether the skb point it supplied wasn't freed yet.
now, it always is. now, it always is.
*/ */
@ -718,7 +718,7 @@ static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos)
++*pos; ++*pos;
brd = list_entry(brd->br2684_devs.next, brd = list_entry(brd->br2684_devs.next,
struct br2684_dev, br2684_devs); struct br2684_dev, br2684_devs);
return (&brd->br2684_devs != &br2684_devs) ? brd : NULL; return (&brd->br2684_devs != &br2684_devs) ? brd : NULL;
} }

View File

@ -109,11 +109,11 @@ static inline int vcc_writable(struct sock *sk)
struct atm_vcc *vcc = atm_sk(sk); struct atm_vcc *vcc = atm_sk(sk);
return (vcc->qos.txtp.max_sdu + 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) static void vcc_write_space(struct sock *sk)
{ {
read_lock(&sk->sk_callback_lock); read_lock(&sk->sk_callback_lock);
if (vcc_writable(sk)) { if (vcc_writable(sk)) {
@ -131,7 +131,7 @@ static struct proto vcc_proto = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.obj_size = sizeof(struct atm_vcc), .obj_size = sizeof(struct atm_vcc),
}; };
int vcc_create(struct socket *sock, int protocol, int family) int vcc_create(struct socket *sock, int protocol, int family)
{ {
struct sock *sk; struct sock *sk;
@ -359,7 +359,7 @@ static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,
return error; return error;
vcc->dev = dev; vcc->dev = dev;
write_lock_irq(&vcc_sklist_lock); 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))) { (error = find_ci(vcc, &vpi, &vci))) {
write_unlock_irq(&vcc_sklist_lock); write_unlock_irq(&vcc_sklist_lock);
goto fail_module_put; goto fail_module_put;
@ -494,20 +494,20 @@ int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
if (!skb) if (!skb)
return error; return error;
copied = skb->len; copied = skb->len;
if (copied > size) { if (copied > size) {
copied = size; copied = size;
msg->msg_flags |= MSG_TRUNC; msg->msg_flags |= MSG_TRUNC;
} }
error = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); error = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
if (error) if (error)
return error; return error;
sock_recv_timestamp(msg, sk, skb); sock_recv_timestamp(msg, sk, skb);
DPRINTK("RcvM %d -= %d\n", atomic_read(&sk->rmem_alloc), skb->truesize); DPRINTK("RcvM %d -= %d\n", atomic_read(&sk->rmem_alloc), skb->truesize);
atm_return(vcc, skb->truesize); atm_return(vcc, skb->truesize);
skb_free_datagram(sk, skb); skb_free_datagram(sk, skb);
return copied; return copied;
} }
@ -675,7 +675,7 @@ static int check_qos(struct atm_qos *qos)
int error; int error;
if (!qos->txtp.traffic_class && !qos->rxtp.traffic_class) if (!qos->txtp.traffic_class && !qos->rxtp.traffic_class)
return -EINVAL; return -EINVAL;
if (qos->txtp.traffic_class != qos->rxtp.traffic_class && if (qos->txtp.traffic_class != qos->rxtp.traffic_class &&
qos->txtp.traffic_class && qos->rxtp.traffic_class && qos->txtp.traffic_class && qos->rxtp.traffic_class &&
qos->txtp.traffic_class != ATM_ANYCLASS && 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); printk(KERN_ERR "atmsvc_init() failed with %d\n", error);
goto out_atmpvc_exit; 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); printk(KERN_ERR "atm_proc_init() failed with %d\n",error);
goto out_atmsvc_exit; 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); printk(KERN_ERR "atm_sysfs_init() failed with %d\n",error);
goto out_atmproc_exit; goto out_atmproc_exit;
} }

View File

@ -1,5 +1,5 @@
/* net/atm/common.h - ATM sockets (common part for PVC and SVC) */ /* net/atm/common.h - ATM sockets (common part for PVC and SVC) */
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */

View File

@ -76,7 +76,7 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
} }
skb = skb_peek(&sk->sk_receive_queue); skb = skb_peek(&sk->sk_receive_queue);
error = put_user(skb ? skb->len : 0, error = put_user(skb ? skb->len : 0,
(int __user *)argp) ? -EFAULT : 0; (int __user *)argp) ? -EFAULT : 0;
goto done; goto done;
} }
case SIOCGSTAMP: /* borrowed from IP */ case SIOCGSTAMP: /* borrowed from IP */

View File

@ -1,5 +1,5 @@
/* /*
* lec.c: Lan Emulation driver * lec.c: Lan Emulation driver
* *
* Marko Kiiskila <mkiiskila@yahoo.com> * Marko Kiiskila <mkiiskila@yahoo.com>
*/ */
@ -1457,7 +1457,7 @@ static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr,
static void lec_arp_check_expire(struct work_struct *work); static void lec_arp_check_expire(struct work_struct *work);
static void lec_arp_expire_arp(unsigned long data); static void lec_arp_expire_arp(unsigned long data);
/* /*
* Arp table funcs * Arp table funcs
*/ */
@ -1473,9 +1473,9 @@ static void lec_arp_init(struct lec_priv *priv)
for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) { for (i = 0; i < LEC_ARP_TABLE_SIZE; i++) {
INIT_HLIST_HEAD(&priv->lec_arp_tables[i]); INIT_HLIST_HEAD(&priv->lec_arp_tables[i]);
} }
INIT_HLIST_HEAD(&priv->lec_arp_empty_ones); INIT_HLIST_HEAD(&priv->lec_arp_empty_ones);
INIT_HLIST_HEAD(&priv->lec_no_forward); INIT_HLIST_HEAD(&priv->lec_no_forward);
INIT_HLIST_HEAD(&priv->mcast_fwds); INIT_HLIST_HEAD(&priv->mcast_fwds);
spin_lock_init(&priv->lec_arp_lock); spin_lock_init(&priv->lec_arp_lock);
INIT_DELAYED_WORK(&priv->lec_arp_work, lec_arp_check_expire); INIT_DELAYED_WORK(&priv->lec_arp_work, lec_arp_check_expire);
schedule_delayed_work(&priv->lec_arp_work, LEC_ARP_REFRESH_INTERVAL); schedule_delayed_work(&priv->lec_arp_work, LEC_ARP_REFRESH_INTERVAL);
@ -1770,7 +1770,7 @@ static void lec_arp_destroy(struct lec_priv *priv)
spin_unlock_irqrestore(&priv->lec_arp_lock, flags); spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
} }
/* /*
* Find entry by mac_address * Find entry by mac_address
*/ */
static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
@ -1949,7 +1949,7 @@ restart:
/* /*
* Try to find vcc where mac_address is attached. * Try to find vcc where mac_address is attached.
* *
*/ */
static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
unsigned char *mac_to_find, int is_rdesc, unsigned char *mac_to_find, int is_rdesc,
@ -2075,7 +2075,7 @@ lec_addr_delete(struct lec_priv *priv, unsigned char *atm_addr,
} }
/* /*
* Notifies: Response to arp_request (atm_addr != NULL) * Notifies: Response to arp_request (atm_addr != NULL)
*/ */
static void static void
lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr, lec_arp_update(struct lec_priv *priv, unsigned char *mac_addr,
@ -2176,7 +2176,7 @@ out:
} }
/* /*
* Notifies: Vcc setup ready * Notifies: Vcc setup ready
*/ */
static void static void
lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data, lec_vcc_added(struct lec_priv *priv, struct atmlec_ioc *ioc_data,
@ -2380,7 +2380,7 @@ lec_set_flush_tran_id(struct lec_priv *priv,
if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) { if (!memcmp(atm_addr, entry->atm_addr, ATM_ESA_LEN)) {
entry->flush_tran_id = tran_id; entry->flush_tran_id = tran_id;
DPRINTK("Set flush transaction id to %lx for %p\n", DPRINTK("Set flush transaction id to %lx for %p\n",
tran_id, entry); tran_id, entry);
} }
} }
spin_unlock_irqrestore(&priv->lec_arp_lock, flags); spin_unlock_irqrestore(&priv->lec_arp_lock, flags);

View File

@ -52,12 +52,12 @@ struct lane2_ops {
/* /*
* ATM LAN Emulation supports both LLC & Dix Ethernet EtherType * ATM LAN Emulation supports both LLC & Dix Ethernet EtherType
* frames. * frames.
* *
* 1. Dix Ethernet EtherType frames encoded by placing EtherType * 1. Dix Ethernet EtherType frames encoded by placing EtherType
* field in h_type field. Data follows immediatelly after header. * field in h_type field. Data follows immediatelly after header.
* 2. LLC Data frames whose total length, including LLC field and data, * 2. LLC Data frames whose total length, including LLC field and data,
* but not padding required to meet the minimum data frame length, * but not padding required to meet the minimum data frame length,
* is less than 1536(0x0600) MUST be encoded by placing that length * is less than 1536(0x0600) MUST be encoded by placing that length
* in the h_type field. The LLC field follows header immediatelly. * in the h_type field. The LLC field follows header immediatelly.
* 3. LLC data frames longer than this maximum MUST be encoded by placing * 3. LLC data frames longer than this maximum MUST be encoded by placing

View File

@ -32,7 +32,7 @@
#include "resources.h" #include "resources.h"
/* /*
* mpc.c: Implementation of MPOA client kernel part * mpc.c: Implementation of MPOA client kernel part
*/ */
#if 0 #if 0
@ -80,17 +80,17 @@ static struct llc_snap_hdr llc_snap_mpoa_ctrl = {
0xaa, 0xaa, 0x03, 0xaa, 0xaa, 0x03,
{0x00, 0x00, 0x5e}, {0x00, 0x00, 0x5e},
{0x00, 0x03} /* For MPOA control PDUs */ {0x00, 0x03} /* For MPOA control PDUs */
}; };
static struct llc_snap_hdr llc_snap_mpoa_data = { static struct llc_snap_hdr llc_snap_mpoa_data = {
0xaa, 0xaa, 0x03, 0xaa, 0xaa, 0x03,
{0x00, 0x00, 0x00}, {0x00, 0x00, 0x00},
{0x08, 0x00} /* This is for IP PDUs only */ {0x08, 0x00} /* This is for IP PDUs only */
}; };
static struct llc_snap_hdr llc_snap_mpoa_data_tagged = { static struct llc_snap_hdr llc_snap_mpoa_data_tagged = {
0xaa, 0xaa, 0x03, 0xaa, 0xaa, 0x03,
{0x00, 0x00, 0x00}, {0x00, 0x00, 0x00},
{0x88, 0x4c} /* This is for tagged data PDUs */ {0x88, 0x4c} /* This is for tagged data PDUs */
}; };
static struct notifier_block mpoa_notifier = { static struct notifier_block mpoa_notifier = {
mpoa_event_listener, mpoa_event_listener,
@ -106,12 +106,12 @@ static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
static struct mpoa_client *find_mpc_by_itfnum(int itf) static struct mpoa_client *find_mpc_by_itfnum(int itf)
{ {
struct mpoa_client *mpc; struct mpoa_client *mpc;
mpc = mpcs; /* our global linked list */ mpc = mpcs; /* our global linked list */
while (mpc != NULL) { while (mpc != NULL) {
if (mpc->dev_num == itf) if (mpc->dev_num == itf)
return mpc; return mpc;
mpc = mpc->next; mpc = mpc->next;
} }
return NULL; /* not found */ return NULL; /* not found */
@ -120,7 +120,7 @@ static struct mpoa_client *find_mpc_by_itfnum(int itf)
static struct mpoa_client *find_mpc_by_vcc(struct atm_vcc *vcc) static struct mpoa_client *find_mpc_by_vcc(struct atm_vcc *vcc)
{ {
struct mpoa_client *mpc; struct mpoa_client *mpc;
mpc = mpcs; /* our global linked list */ mpc = mpcs; /* our global linked list */
while (mpc != NULL) { while (mpc != NULL) {
if (mpc->mpoad_vcc == vcc) if (mpc->mpoad_vcc == vcc)
@ -134,7 +134,7 @@ static struct mpoa_client *find_mpc_by_vcc(struct atm_vcc *vcc)
static struct mpoa_client *find_mpc_by_lec(struct net_device *dev) static struct mpoa_client *find_mpc_by_lec(struct net_device *dev)
{ {
struct mpoa_client *mpc; struct mpoa_client *mpc;
mpc = mpcs; /* our global linked list */ mpc = mpcs; /* our global linked list */
while (mpc != NULL) { while (mpc != NULL) {
if (mpc->dev == dev) if (mpc->dev == dev)
@ -190,7 +190,7 @@ struct atm_mpoa_qos *atm_mpoa_search_qos(__be32 dst_ip)
} }
return qos; return qos;
} }
/* /*
* Returns 0 for failure * Returns 0 for failure
@ -245,7 +245,7 @@ static struct net_device *find_lec_by_itfnum(int itf)
sprintf(name, "lec%d", itf); sprintf(name, "lec%d", itf);
dev = dev_get_by_name(name); dev = dev_get_by_name(name);
return dev; return dev;
} }
@ -265,25 +265,25 @@ static struct mpoa_client *alloc_mpc(void)
mpc->parameters.mpc_p2 = MPC_P2; mpc->parameters.mpc_p2 = MPC_P2;
memset(mpc->parameters.mpc_p3,0,sizeof(mpc->parameters.mpc_p3)); memset(mpc->parameters.mpc_p3,0,sizeof(mpc->parameters.mpc_p3));
mpc->parameters.mpc_p4 = MPC_P4; mpc->parameters.mpc_p4 = MPC_P4;
mpc->parameters.mpc_p5 = MPC_P5; mpc->parameters.mpc_p5 = MPC_P5;
mpc->parameters.mpc_p6 = MPC_P6; mpc->parameters.mpc_p6 = MPC_P6;
mpcs = mpc; mpcs = mpc;
return mpc; return mpc;
} }
/* /*
* *
* start_mpc() puts the MPC on line. All the packets destined * start_mpc() puts the MPC on line. All the packets destined
* to the lec underneath us are now being monitored and * to the lec underneath us are now being monitored and
* shortcuts will be established. * shortcuts will be established.
* *
*/ */
static void start_mpc(struct mpoa_client *mpc, struct net_device *dev) static void start_mpc(struct mpoa_client *mpc, struct net_device *dev)
{ {
dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name); dprintk("mpoa: (%s) start_mpc:\n", mpc->dev->name);
if (dev->hard_start_xmit == NULL) { if (dev->hard_start_xmit == NULL) {
printk("mpoa: (%s) start_mpc: dev->hard_start_xmit == NULL, not starting\n", printk("mpoa: (%s) start_mpc: dev->hard_start_xmit == NULL, not starting\n",
dev->name); dev->name);
@ -297,8 +297,8 @@ static void start_mpc(struct mpoa_client *mpc, struct net_device *dev)
static void stop_mpc(struct mpoa_client *mpc) static void stop_mpc(struct mpoa_client *mpc)
{ {
dprintk("mpoa: (%s) stop_mpc:", mpc->dev->name); dprintk("mpoa: (%s) stop_mpc:", mpc->dev->name);
/* Lets not nullify lec device's dev->hard_start_xmit */ /* Lets not nullify lec device's dev->hard_start_xmit */
if (mpc->dev->hard_start_xmit != mpc_send_packet) { if (mpc->dev->hard_start_xmit != mpc_send_packet) {
@ -309,7 +309,7 @@ static void stop_mpc(struct mpoa_client *mpc)
mpc->dev->hard_start_xmit = mpc->old_hard_start_xmit; mpc->dev->hard_start_xmit = mpc->old_hard_start_xmit;
mpc->old_hard_start_xmit = NULL; mpc->old_hard_start_xmit = NULL;
/* close_shortcuts(mpc); ??? FIXME */ /* close_shortcuts(mpc); ??? FIXME */
return; return;
} }
@ -358,7 +358,7 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr,
uint8_t length, mpoa_device_type, number_of_mps_macs; uint8_t length, mpoa_device_type, number_of_mps_macs;
uint8_t *end_of_tlvs; uint8_t *end_of_tlvs;
struct mpoa_client *mpc; struct mpoa_client *mpc;
mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */ mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */
dprintk("mpoa: (%s) lane2_assoc_ind: received TLV(s), ", dev->name); dprintk("mpoa: (%s) lane2_assoc_ind: received TLV(s), ", dev->name);
dprintk("total length of all TLVs %d\n", sizeoftlvs); dprintk("total length of all TLVs %d\n", sizeoftlvs);
@ -377,7 +377,7 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr,
printk("TLV value extends past its buffer, aborting parse\n"); printk("TLV value extends past its buffer, aborting parse\n");
return; return;
} }
if (type == 0) { if (type == 0) {
printk("mpoa: (%s) lane2_assoc_ind: TLV type was 0, returning\n", dev->name); printk("mpoa: (%s) lane2_assoc_ind: TLV type was 0, returning\n", dev->name);
return; return;
@ -412,10 +412,10 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr,
continue; /* someone should read the spec */ continue; /* someone should read the spec */
} }
dprintk("this MPS has %d MAC addresses\n", number_of_mps_macs); dprintk("this MPS has %d MAC addresses\n", number_of_mps_macs);
/* ok, now we can go and tell our daemon the control address of MPS */ /* ok, now we can go and tell our daemon the control address of MPS */
send_set_mps_ctrl_addr(tlvs, mpc); send_set_mps_ctrl_addr(tlvs, mpc);
tlvs = copy_macs(mpc, mac_addr, tlvs, number_of_mps_macs, mpoa_device_type); tlvs = copy_macs(mpc, mac_addr, tlvs, number_of_mps_macs, mpoa_device_type);
if (tlvs == NULL) return; if (tlvs == NULL) return;
} }
@ -474,7 +474,7 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc)
iph = (struct iphdr *)buff; iph = (struct iphdr *)buff;
ipaddr = iph->daddr; ipaddr = iph->daddr;
ddprintk("mpoa: (%s) send_via_shortcut: ipaddr 0x%x\n", mpc->dev->name, ipaddr); ddprintk("mpoa: (%s) send_via_shortcut: ipaddr 0x%x\n", mpc->dev->name, ipaddr);
entry = mpc->in_ops->get(ipaddr, mpc); entry = mpc->in_ops->get(ipaddr, mpc);
if (entry == NULL) { if (entry == NULL) {
@ -483,15 +483,15 @@ static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc)
return 1; return 1;
} }
if (mpc->in_ops->cache_hit(entry, mpc) != OPEN){ /* threshold not exceeded or VCC not ready */ if (mpc->in_ops->cache_hit(entry, mpc) != OPEN){ /* threshold not exceeded or VCC not ready */
ddprintk("mpoa: (%s) send_via_shortcut: cache_hit: returns != OPEN\n", mpc->dev->name); ddprintk("mpoa: (%s) send_via_shortcut: cache_hit: returns != OPEN\n", mpc->dev->name);
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return 1; return 1;
} }
ddprintk("mpoa: (%s) send_via_shortcut: using shortcut\n", mpc->dev->name); ddprintk("mpoa: (%s) send_via_shortcut: using shortcut\n", mpc->dev->name);
/* MPOA spec A.1.4, MPOA client must decrement IP ttl at least by one */ /* MPOA spec A.1.4, MPOA client must decrement IP ttl at least by one */
if (iph->ttl <= 1) { if (iph->ttl <= 1) {
ddprintk("mpoa: (%s) send_via_shortcut: IP ttl = %u, using LANE\n", mpc->dev->name, iph->ttl); ddprintk("mpoa: (%s) send_via_shortcut: IP ttl = %u, using LANE\n", mpc->dev->name, iph->ttl);
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return 1; return 1;
} }
@ -529,7 +529,7 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev)
struct mpoa_client *mpc; struct mpoa_client *mpc;
struct ethhdr *eth; struct ethhdr *eth;
int i = 0; int i = 0;
mpc = find_mpc_by_lec(dev); /* this should NEVER fail */ mpc = find_mpc_by_lec(dev); /* this should NEVER fail */
if(mpc == NULL) { if(mpc == NULL) {
printk("mpoa: (%s) mpc_send_packet: no MPC found\n", dev->name); printk("mpoa: (%s) mpc_send_packet: no MPC found\n", dev->name);
@ -549,7 +549,7 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev)
non_ip: non_ip:
retval = mpc->old_hard_start_xmit(skb,dev); retval = mpc->old_hard_start_xmit(skb,dev);
return retval; return retval;
} }
@ -569,11 +569,11 @@ static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
ipaddr = ioc_data.ipaddr; ipaddr = ioc_data.ipaddr;
if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF) if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF)
return -EINVAL; return -EINVAL;
mpc = find_mpc_by_itfnum(ioc_data.dev_num); mpc = find_mpc_by_itfnum(ioc_data.dev_num);
if (mpc == NULL) if (mpc == NULL)
return -EINVAL; return -EINVAL;
if (ioc_data.type == MPC_SOCKET_INGRESS) { if (ioc_data.type == MPC_SOCKET_INGRESS) {
in_entry = mpc->in_ops->get(ipaddr, mpc); in_entry = mpc->in_ops->get(ipaddr, mpc);
if (in_entry == NULL || in_entry->entry_state < INGRESS_RESOLVED) { if (in_entry == NULL || in_entry->entry_state < INGRESS_RESOLVED) {
@ -604,7 +604,7 @@ static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev)
struct mpoa_client *mpc; struct mpoa_client *mpc;
in_cache_entry *in_entry; in_cache_entry *in_entry;
eg_cache_entry *eg_entry; eg_cache_entry *eg_entry;
mpc = find_mpc_by_lec(dev); mpc = find_mpc_by_lec(dev);
if (mpc == NULL) { if (mpc == NULL) {
printk("mpoa: (%s) mpc_vcc_close: close for unknown MPC\n", dev->name); printk("mpoa: (%s) mpc_vcc_close: close for unknown MPC\n", dev->name);
@ -640,14 +640,14 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
struct mpoa_client *mpc; struct mpoa_client *mpc;
__be32 tag; __be32 tag;
char *tmp; char *tmp;
ddprintk("mpoa: (%s) mpc_push:\n", dev->name); ddprintk("mpoa: (%s) mpc_push:\n", dev->name);
if (skb == NULL) { if (skb == NULL) {
dprintk("mpoa: (%s) mpc_push: null skb, closing VCC\n", dev->name); dprintk("mpoa: (%s) mpc_push: null skb, closing VCC\n", dev->name);
mpc_vcc_close(vcc, dev); mpc_vcc_close(vcc, dev);
return; return;
} }
skb->dev = dev; skb->dev = dev;
if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) { if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) {
struct sock *sk = sk_atm(vcc); struct sock *sk = sk_atm(vcc);
@ -693,11 +693,11 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
return; return;
} }
/* /*
* See if ingress MPC is using shortcut we opened as a return channel. * See if ingress MPC is using shortcut we opened as a return channel.
* This means we have a bi-directional vcc opened by us. * This means we have a bi-directional vcc opened by us.
*/ */
if (eg->shortcut == NULL) { if (eg->shortcut == NULL) {
eg->shortcut = vcc; eg->shortcut = vcc;
printk("mpoa: (%s) mpc_push: egress SVC in use\n", dev->name); printk("mpoa: (%s) mpc_push: egress SVC in use\n", dev->name);
@ -743,7 +743,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg)
struct mpoa_client *mpc; struct mpoa_client *mpc;
struct lec_priv *priv; struct lec_priv *priv;
int err; int err;
if (mpcs == NULL) { if (mpcs == NULL) {
init_timer(&mpc_timer); init_timer(&mpc_timer);
mpc_timer_refresh(); mpc_timer_refresh();
@ -755,7 +755,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg)
return err; return err;
} }
} }
mpc = find_mpc_by_itfnum(arg); mpc = find_mpc_by_itfnum(arg);
if (mpc == NULL) { if (mpc == NULL) {
dprintk("mpoa: mpoad_attach: allocating new mpc for itf %d\n", arg); dprintk("mpoa: mpoad_attach: allocating new mpc for itf %d\n", arg);
@ -776,7 +776,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg)
dev_put(mpc->dev); dev_put(mpc->dev);
mpc->dev = NULL; mpc->dev = NULL;
} else } else
priv->lane2_ops->associate_indicator = lane2_assoc_ind; priv->lane2_ops->associate_indicator = lane2_assoc_ind;
} }
mpc->mpoad_vcc = vcc; mpc->mpoad_vcc = vcc;
@ -788,7 +788,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg)
if (mpc->dev) { if (mpc->dev) {
char empty[ATM_ESA_LEN]; char empty[ATM_ESA_LEN];
memset(empty, 0, ATM_ESA_LEN); memset(empty, 0, ATM_ESA_LEN);
start_mpc(mpc, mpc->dev); start_mpc(mpc, mpc->dev);
/* set address if mpcd e.g. gets killed and restarted. /* set address if mpcd e.g. gets killed and restarted.
* If we do not do it now we have to wait for the next LE_ARP * If we do not do it now we have to wait for the next LE_ARP
@ -806,7 +806,7 @@ static void send_set_mps_ctrl_addr(char *addr, struct mpoa_client *mpc)
struct k_message mesg; struct k_message mesg;
memcpy (mpc->mps_ctrl_addr, addr, ATM_ESA_LEN); memcpy (mpc->mps_ctrl_addr, addr, ATM_ESA_LEN);
mesg.type = SET_MPS_CTRL_ADDR; mesg.type = SET_MPS_CTRL_ADDR;
memcpy(mesg.MPS_ctrl, addr, ATM_ESA_LEN); memcpy(mesg.MPS_ctrl, addr, ATM_ESA_LEN);
msg_to_mpoad(&mesg, mpc); msg_to_mpoad(&mesg, mpc);
@ -828,7 +828,7 @@ static void mpoad_close(struct atm_vcc *vcc)
printk("mpoa: mpoad_close: close for non-present mpoad\n"); printk("mpoa: mpoad_close: close for non-present mpoad\n");
return; return;
} }
mpc->mpoad_vcc = NULL; mpc->mpoad_vcc = NULL;
if (mpc->dev) { if (mpc->dev) {
struct lec_priv *priv = (struct lec_priv *)mpc->dev->priv; struct lec_priv *priv = (struct lec_priv *)mpc->dev->priv;
@ -844,7 +844,7 @@ static void mpoad_close(struct atm_vcc *vcc)
atm_return(vcc, skb->truesize); atm_return(vcc, skb->truesize);
kfree_skb(skb); kfree_skb(skb);
} }
printk("mpoa: (%s) going down\n", printk("mpoa: (%s) going down\n",
(mpc->dev) ? mpc->dev->name : "<unknown>"); (mpc->dev) ? mpc->dev->name : "<unknown>");
module_put(THIS_MODULE); module_put(THIS_MODULE);
@ -857,11 +857,11 @@ static void mpoad_close(struct atm_vcc *vcc)
*/ */
static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb) static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb)
{ {
struct mpoa_client *mpc = find_mpc_by_vcc(vcc); struct mpoa_client *mpc = find_mpc_by_vcc(vcc);
struct k_message *mesg = (struct k_message*)skb->data; struct k_message *mesg = (struct k_message*)skb->data;
atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
if (mpc == NULL) { if (mpc == NULL) {
printk("mpoa: msg_from_mpoad: no mpc found\n"); printk("mpoa: msg_from_mpoad: no mpc found\n");
return 0; return 0;
@ -938,7 +938,7 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc)
skb_put(skb, sizeof(struct k_message)); skb_put(skb, sizeof(struct k_message));
memcpy(skb->data, mesg, sizeof(struct k_message)); memcpy(skb->data, mesg, sizeof(struct k_message));
atm_force_charge(mpc->mpoad_vcc, skb->truesize); atm_force_charge(mpc->mpoad_vcc, skb->truesize);
sk = sk_atm(mpc->mpoad_vcc); sk = sk_atm(mpc->mpoad_vcc);
skb_queue_tail(&sk->sk_receive_queue, skb); skb_queue_tail(&sk->sk_receive_queue, skb);
sk->sk_data_ready(sk, skb->len); sk->sk_data_ready(sk, skb->len);
@ -955,7 +955,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo
dev = (struct net_device *)dev_ptr; dev = (struct net_device *)dev_ptr;
if (dev->name == NULL || strncmp(dev->name, "lec", 3)) if (dev->name == NULL || strncmp(dev->name, "lec", 3))
return NOTIFY_DONE; /* we are only interested in lec:s */ return NOTIFY_DONE; /* we are only interested in lec:s */
switch (event) { switch (event) {
case NETDEV_REGISTER: /* a new lec device was allocated */ case NETDEV_REGISTER: /* a new lec device was allocated */
priv = (struct lec_priv *)dev->priv; priv = (struct lec_priv *)dev->priv;
@ -1043,7 +1043,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc)
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return; return;
} }
if(entry->entry_state == INGRESS_INVALID){ if(entry->entry_state == INGRESS_INVALID){
entry->entry_state = INGRESS_RESOLVING; entry->entry_state = INGRESS_RESOLVING;
msg->type = SND_MPOA_RES_RQST; msg->type = SND_MPOA_RES_RQST;
@ -1053,7 +1053,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc)
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return; return;
} }
printk("mpoa: (%s) MPOA_trigger_rcvd: entry already in resolving state\n", printk("mpoa: (%s) MPOA_trigger_rcvd: entry already in resolving state\n",
(mpc->dev) ? mpc->dev->name : "<unknown>"); (mpc->dev) ? mpc->dev->name : "<unknown>");
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
@ -1062,7 +1062,7 @@ static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc)
/* /*
* Things get complicated because we have to check if there's an egress * Things get complicated because we have to check if there's an egress
* shortcut with suitable traffic parameters we could use. * shortcut with suitable traffic parameters we could use.
*/ */
static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry) static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_client *client, in_cache_entry *entry)
{ {
@ -1079,7 +1079,7 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
else if(eg_entry->shortcut->qos.txtp.max_pcr > 0) else if(eg_entry->shortcut->qos.txtp.max_pcr > 0)
entry->shortcut = eg_entry->shortcut; entry->shortcut = eg_entry->shortcut;
} }
if(entry->shortcut){ if(entry->shortcut){
dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(dst_ip)); dprintk("mpoa: (%s) using egress SVC to reach %u.%u.%u.%u\n",client->dev->name, NIPQUAD(dst_ip));
client->eg_ops->put(eg_entry); client->eg_ops->put(eg_entry);
return; return;
@ -1094,7 +1094,7 @@ static void check_qos_and_open_shortcut(struct k_message *msg, struct mpoa_clien
{ {
msg->qos = qos->qos; msg->qos = qos->qos;
printk("mpoa: (%s) trying to get a CBR shortcut\n",client->dev->name); printk("mpoa: (%s) trying to get a CBR shortcut\n",client->dev->name);
} }
else memset(&msg->qos,0,sizeof(struct atm_qos)); else memset(&msg->qos,0,sizeof(struct atm_qos));
msg_to_mpoad(msg, client); msg_to_mpoad(msg, client);
return; return;
@ -1111,7 +1111,7 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name); printk("\nmpoa: (%s) ARGH, received res. reply for an entry that doesn't exist.\n", mpc->dev->name);
return; return;
} }
ddprintk(" entry_state = %d ", entry->entry_state); ddprintk(" entry_state = %d ", entry->entry_state);
if (entry->entry_state == INGRESS_RESOLVED) { if (entry->entry_state == INGRESS_RESOLVED) {
printk("\nmpoa: (%s) MPOA_res_reply_rcvd for RESOLVED entry!\n", mpc->dev->name); printk("\nmpoa: (%s) MPOA_res_reply_rcvd for RESOLVED entry!\n", mpc->dev->name);
@ -1126,7 +1126,7 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
ddprintk("entry->shortcut = %p\n", entry->shortcut); ddprintk("entry->shortcut = %p\n", entry->shortcut);
if(entry->entry_state == INGRESS_RESOLVING && entry->shortcut != NULL){ if(entry->entry_state == INGRESS_RESOLVING && entry->shortcut != NULL){
entry->entry_state = INGRESS_RESOLVED; entry->entry_state = INGRESS_RESOLVED;
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return; /* Shortcut already open... */ return; /* Shortcut already open... */
} }
@ -1137,7 +1137,7 @@ static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
return; return;
} }
check_qos_and_open_shortcut(msg, mpc, entry); check_qos_and_open_shortcut(msg, mpc, entry);
entry->entry_state = INGRESS_RESOLVED; entry->entry_state = INGRESS_RESOLVED;
mpc->in_ops->put(entry); mpc->in_ops->put(entry);
@ -1169,13 +1169,13 @@ static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
} while (entry != NULL); } while (entry != NULL);
return; return;
} }
static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc) static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
{ {
__be32 cache_id = msg->content.eg_info.cache_id; __be32 cache_id = msg->content.eg_info.cache_id;
eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc); eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(cache_id, mpc);
if (entry == NULL) { if (entry == NULL) {
dprintk("mpoa: (%s) egress_purge_rcvd: purge for a non-existing entry\n", mpc->dev->name); dprintk("mpoa: (%s) egress_purge_rcvd: purge for a non-existing entry\n", mpc->dev->name);
return; return;
@ -1188,7 +1188,7 @@ static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
mpc->eg_ops->put(entry); mpc->eg_ops->put(entry);
return; return;
} }
static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry) static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry)
{ {
@ -1259,7 +1259,7 @@ static void MPOA_cache_impos_rcvd( struct k_message * msg, struct mpoa_client *
{ {
uint16_t holding_time; uint16_t holding_time;
eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(msg->content.eg_info.cache_id, mpc); eg_cache_entry *entry = mpc->eg_ops->get_by_cache_id(msg->content.eg_info.cache_id, mpc);
holding_time = msg->content.eg_info.holding_time; holding_time = msg->content.eg_info.holding_time;
dprintk("mpoa: (%s) MPOA_cache_impos_rcvd: entry = %p, holding_time = %u\n", dprintk("mpoa: (%s) MPOA_cache_impos_rcvd: entry = %p, holding_time = %u\n",
mpc->dev->name, entry, holding_time); mpc->dev->name, entry, holding_time);
@ -1272,13 +1272,13 @@ static void MPOA_cache_impos_rcvd( struct k_message * msg, struct mpoa_client *
mpc->eg_ops->update(entry, holding_time); mpc->eg_ops->update(entry, holding_time);
return; return;
} }
write_lock_irq(&mpc->egress_lock); write_lock_irq(&mpc->egress_lock);
mpc->eg_ops->remove_entry(entry, mpc); mpc->eg_ops->remove_entry(entry, mpc);
write_unlock_irq(&mpc->egress_lock); write_unlock_irq(&mpc->egress_lock);
mpc->eg_ops->put(entry); mpc->eg_ops->put(entry);
return; return;
} }
@ -1328,7 +1328,7 @@ static void set_mps_mac_addr_rcvd(struct k_message *msg, struct mpoa_client *cli
return; return;
} }
client->number_of_mps_macs = 1; client->number_of_mps_macs = 1;
return; return;
} }
@ -1364,7 +1364,7 @@ static void mpc_timer_refresh(void)
mpc_timer.data = mpc_timer.expires; mpc_timer.data = mpc_timer.expires;
mpc_timer.function = mpc_cache_check; mpc_timer.function = mpc_cache_check;
add_timer(&mpc_timer); add_timer(&mpc_timer);
return; return;
} }
@ -1373,7 +1373,7 @@ static void mpc_cache_check( unsigned long checking_time )
struct mpoa_client *mpc = mpcs; struct mpoa_client *mpc = mpcs;
static unsigned long previous_resolving_check_time; static unsigned long previous_resolving_check_time;
static unsigned long previous_refresh_time; static unsigned long previous_refresh_time;
while( mpc != NULL ){ while( mpc != NULL ){
mpc->in_ops->clear_count(mpc); mpc->in_ops->clear_count(mpc);
mpc->eg_ops->clear_expired(mpc); mpc->eg_ops->clear_expired(mpc);
@ -1388,7 +1388,7 @@ static void mpc_cache_check( unsigned long checking_time )
mpc = mpc->next; mpc = mpc->next;
} }
mpc_timer_refresh(); mpc_timer_refresh();
return; return;
} }

View File

@ -12,32 +12,32 @@
int msg_to_mpoad(struct k_message *msg, struct mpoa_client *mpc); int msg_to_mpoad(struct k_message *msg, struct mpoa_client *mpc);
struct mpoa_client { struct mpoa_client {
struct mpoa_client *next; struct mpoa_client *next;
struct net_device *dev; /* lec in question */ struct net_device *dev; /* lec in question */
int dev_num; /* e.g. 2 for lec2 */ int dev_num; /* e.g. 2 for lec2 */
int (*old_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev); int (*old_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
struct atm_vcc *mpoad_vcc; /* control channel to mpoad */ struct atm_vcc *mpoad_vcc; /* control channel to mpoad */
uint8_t mps_ctrl_addr[ATM_ESA_LEN]; /* MPS control ATM address */ uint8_t mps_ctrl_addr[ATM_ESA_LEN]; /* MPS control ATM address */
uint8_t our_ctrl_addr[ATM_ESA_LEN]; /* MPC's control ATM address */ uint8_t our_ctrl_addr[ATM_ESA_LEN]; /* MPC's control ATM address */
rwlock_t ingress_lock; rwlock_t ingress_lock;
struct in_cache_ops *in_ops; /* ingress cache operations */ struct in_cache_ops *in_ops; /* ingress cache operations */
in_cache_entry *in_cache; /* the ingress cache of this MPC */ in_cache_entry *in_cache; /* the ingress cache of this MPC */
rwlock_t egress_lock; rwlock_t egress_lock;
struct eg_cache_ops *eg_ops; /* egress cache operations */ struct eg_cache_ops *eg_ops; /* egress cache operations */
eg_cache_entry *eg_cache; /* the egress cache of this MPC */ eg_cache_entry *eg_cache; /* the egress cache of this MPC */
uint8_t *mps_macs; /* array of MPS MAC addresses, >=1 */ uint8_t *mps_macs; /* array of MPS MAC addresses, >=1 */
int number_of_mps_macs; /* number of the above MAC addresses */ int number_of_mps_macs; /* number of the above MAC addresses */
struct mpc_parameters parameters; /* parameters for this client */ struct mpc_parameters parameters; /* parameters for this client */
}; };
struct atm_mpoa_qos { struct atm_mpoa_qos {
struct atm_mpoa_qos *next; struct atm_mpoa_qos *next;
__be32 ipaddr; __be32 ipaddr;
struct atm_qos qos; struct atm_qos qos;
}; };

View File

@ -369,7 +369,7 @@ static eg_cache_entry *eg_cache_get_by_vcc(struct atm_vcc *vcc, struct mpoa_clie
while (entry != NULL){ while (entry != NULL){
if (entry->shortcut == vcc) { if (entry->shortcut == vcc) {
atomic_inc(&entry->use); atomic_inc(&entry->use);
read_unlock_irqrestore(&mpc->egress_lock, flags); read_unlock_irqrestore(&mpc->egress_lock, flags);
return entry; return entry;
} }
entry = entry->next; entry = entry->next;
@ -388,7 +388,7 @@ static eg_cache_entry *eg_cache_get_by_src_ip(__be32 ipaddr, struct mpoa_client
while(entry != NULL){ while(entry != NULL){
if(entry->latest_ip_addr == ipaddr) { if(entry->latest_ip_addr == ipaddr) {
atomic_inc(&entry->use); atomic_inc(&entry->use);
read_unlock_irq(&mpc->egress_lock); read_unlock_irq(&mpc->egress_lock);
return entry; return entry;
} }
entry = entry->next; entry = entry->next;

View File

@ -12,66 +12,66 @@ struct mpoa_client;
void atm_mpoa_init_cache(struct mpoa_client *mpc); void atm_mpoa_init_cache(struct mpoa_client *mpc);
typedef struct in_cache_entry { typedef struct in_cache_entry {
struct in_cache_entry *next; struct in_cache_entry *next;
struct in_cache_entry *prev; struct in_cache_entry *prev;
struct timeval tv; struct timeval tv;
struct timeval reply_wait; struct timeval reply_wait;
struct timeval hold_down; struct timeval hold_down;
uint32_t packets_fwded; uint32_t packets_fwded;
uint16_t entry_state; uint16_t entry_state;
uint32_t retry_time; uint32_t retry_time;
uint32_t refresh_time; uint32_t refresh_time;
uint32_t count; uint32_t count;
struct atm_vcc *shortcut; struct atm_vcc *shortcut;
uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN]; uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
struct in_ctrl_info ctrl_info; struct in_ctrl_info ctrl_info;
atomic_t use; atomic_t use;
} in_cache_entry; } in_cache_entry;
struct in_cache_ops{ struct in_cache_ops{
in_cache_entry *(*add_entry)(__be32 dst_ip, in_cache_entry *(*add_entry)(__be32 dst_ip,
struct mpoa_client *client); struct mpoa_client *client);
in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client); in_cache_entry *(*get)(__be32 dst_ip, struct mpoa_client *client);
in_cache_entry *(*get_with_mask)(__be32 dst_ip, in_cache_entry *(*get_with_mask)(__be32 dst_ip,
struct mpoa_client *client, struct mpoa_client *client,
__be32 mask); __be32 mask);
in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, in_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc,
struct mpoa_client *client); struct mpoa_client *client);
void (*put)(in_cache_entry *entry); void (*put)(in_cache_entry *entry);
void (*remove_entry)(in_cache_entry *delEntry, void (*remove_entry)(in_cache_entry *delEntry,
struct mpoa_client *client ); struct mpoa_client *client );
int (*cache_hit)(in_cache_entry *entry, int (*cache_hit)(in_cache_entry *entry,
struct mpoa_client *client); struct mpoa_client *client);
void (*clear_count)(struct mpoa_client *client); void (*clear_count)(struct mpoa_client *client);
void (*check_resolving)(struct mpoa_client *client); void (*check_resolving)(struct mpoa_client *client);
void (*refresh)(struct mpoa_client *client); void (*refresh)(struct mpoa_client *client);
void (*destroy_cache)(struct mpoa_client *mpc); void (*destroy_cache)(struct mpoa_client *mpc);
}; };
typedef struct eg_cache_entry{ typedef struct eg_cache_entry{
struct eg_cache_entry *next; struct eg_cache_entry *next;
struct eg_cache_entry *prev; struct eg_cache_entry *prev;
struct timeval tv; struct timeval tv;
uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN]; uint8_t MPS_ctrl_ATM_addr[ATM_ESA_LEN];
struct atm_vcc *shortcut; struct atm_vcc *shortcut;
uint32_t packets_rcvd; uint32_t packets_rcvd;
uint16_t entry_state; uint16_t entry_state;
__be32 latest_ip_addr; /* The src IP address of the last packet */ __be32 latest_ip_addr; /* The src IP address of the last packet */
struct eg_ctrl_info ctrl_info; struct eg_ctrl_info ctrl_info;
atomic_t use; atomic_t use;
} eg_cache_entry; } eg_cache_entry;
struct eg_cache_ops{ struct eg_cache_ops{
eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client); eg_cache_entry *(*add_entry)(struct k_message *msg, struct mpoa_client *client);
eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client); eg_cache_entry *(*get_by_cache_id)(__be32 cache_id, struct mpoa_client *client);
eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client); eg_cache_entry *(*get_by_tag)(__be32 cache_id, struct mpoa_client *client);
eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client); eg_cache_entry *(*get_by_vcc)(struct atm_vcc *vcc, struct mpoa_client *client);
eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client); eg_cache_entry *(*get_by_src_ip)(__be32 ipaddr, struct mpoa_client *client);
void (*put)(eg_cache_entry *entry); void (*put)(eg_cache_entry *entry);
void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client); void (*remove_entry)(eg_cache_entry *entry, struct mpoa_client *client);
void (*update)(eg_cache_entry *entry, uint16_t holding_time); void (*update)(eg_cache_entry *entry, uint16_t holding_time);
void (*clear_expired)(struct mpoa_client *client); void (*clear_expired)(struct mpoa_client *client);
void (*destroy_cache)(struct mpoa_client *mpc); void (*destroy_cache)(struct mpoa_client *mpc);
}; };
@ -85,7 +85,7 @@ struct eg_cache_ops{
/* VCC states */ /* VCC states */
#define OPEN 1 #define OPEN 1
#define CLOSED 0 #define CLOSED 0
/* Egress cache entry states */ /* Egress cache entry states */

View File

@ -2,7 +2,7 @@
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
@ -16,7 +16,7 @@
/* /*
* mpoa_proc.c: Implementation MPOA client's proc * mpoa_proc.c: Implementation MPOA client's proc
* file system statistics * file system statistics
*/ */
#if 1 #if 1
@ -32,7 +32,7 @@ extern struct proc_dir_entry *atm_proc_root; /* from proc.c. */
static int proc_mpc_open(struct inode *inode, struct file *file); static int proc_mpc_open(struct inode *inode, struct file *file);
static ssize_t proc_mpc_write(struct file *file, const char __user *buff, static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
size_t nbytes, loff_t *ppos); size_t nbytes, loff_t *ppos);
static int parse_qos(const char *buff); static int parse_qos(const char *buff);
@ -52,18 +52,18 @@ static struct file_operations mpc_file_operations = {
* Returns the state of an ingress cache entry as a string * Returns the state of an ingress cache entry as a string
*/ */
static const char *ingress_state_string(int state){ static const char *ingress_state_string(int state){
switch(state) { switch(state) {
case INGRESS_RESOLVING: case INGRESS_RESOLVING:
return "resolving "; return "resolving ";
break; break;
case INGRESS_RESOLVED: case INGRESS_RESOLVED:
return "resolved "; return "resolved ";
break; break;
case INGRESS_INVALID: case INGRESS_INVALID:
return "invalid "; return "invalid ";
break; break;
case INGRESS_REFRESHING: case INGRESS_REFRESHING:
return "refreshing "; return "refreshing ";
break; break;
default: default:
return ""; return "";
@ -74,15 +74,15 @@ static const char *ingress_state_string(int state){
* Returns the state of an egress cache entry as a string * Returns the state of an egress cache entry as a string
*/ */
static const char *egress_state_string(int state){ static const char *egress_state_string(int state){
switch(state) { switch(state) {
case EGRESS_RESOLVED: case EGRESS_RESOLVED:
return "resolved "; return "resolved ";
break; break;
case EGRESS_PURGE: case EGRESS_PURGE:
return "purge "; return "purge ";
break; break;
case EGRESS_INVALID: case EGRESS_INVALID:
return "invalid "; return "invalid ";
break; break;
default: default:
return ""; return "";
@ -135,7 +135,7 @@ static int mpc_show(struct seq_file *m, void *v)
return 0; return 0;
} }
seq_printf(m, "\nInterface %d:\n\n", mpc->dev_num); seq_printf(m, "\nInterface %d:\n\n", mpc->dev_num);
seq_printf(m, "Ingress Entries:\nIP address State Holding time Packets fwded VPI VCI\n"); seq_printf(m, "Ingress Entries:\nIP address State Holding time Packets fwded VPI VCI\n");
do_gettimeofday(&now); do_gettimeofday(&now);
@ -163,7 +163,7 @@ static int mpc_show(struct seq_file *m, void *v)
egress_state_string(eg_entry->entry_state), egress_state_string(eg_entry->entry_state),
(eg_entry->ctrl_info.holding_time-(now.tv_sec-eg_entry->tv.tv_sec)), (eg_entry->ctrl_info.holding_time-(now.tv_sec-eg_entry->tv.tv_sec)),
eg_entry->packets_rcvd); eg_entry->packets_rcvd);
/* latest IP address */ /* latest IP address */
temp = (unsigned char *)&eg_entry->latest_ip_addr; temp = (unsigned char *)&eg_entry->latest_ip_addr;
sprintf(ip_string, "%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]); sprintf(ip_string, "%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]);
@ -190,51 +190,51 @@ static int proc_mpc_open(struct inode *inode, struct file *file)
} }
static ssize_t proc_mpc_write(struct file *file, const char __user *buff, static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
size_t nbytes, loff_t *ppos) size_t nbytes, loff_t *ppos)
{ {
char *page, *p; char *page, *p;
unsigned len; unsigned len;
if (nbytes == 0) if (nbytes == 0)
return 0; return 0;
if (nbytes >= PAGE_SIZE) if (nbytes >= PAGE_SIZE)
nbytes = PAGE_SIZE-1; nbytes = PAGE_SIZE-1;
page = (char *)__get_free_page(GFP_KERNEL); page = (char *)__get_free_page(GFP_KERNEL);
if (!page) if (!page)
return -ENOMEM; return -ENOMEM;
for (p = page, len = 0; len < nbytes; p++, len++) { for (p = page, len = 0; len < nbytes; p++, len++) {
if (get_user(*p, buff++)) { if (get_user(*p, buff++)) {
free_page((unsigned long)page); free_page((unsigned long)page);
return -EFAULT; return -EFAULT;
} }
if (*p == '\0' || *p == '\n') if (*p == '\0' || *p == '\n')
break; break;
} }
*p = '\0'; *p = '\0';
if (!parse_qos(page)) if (!parse_qos(page))
printk("mpoa: proc_mpc_write: could not parse '%s'\n", page); printk("mpoa: proc_mpc_write: could not parse '%s'\n", page);
free_page((unsigned long)page); free_page((unsigned long)page);
return len; return len;
} }
static int parse_qos(const char *buff) static int parse_qos(const char *buff)
{ {
/* possible lines look like this /* possible lines look like this
* add 130.230.54.142 tx=max_pcr,max_sdu rx=max_pcr,max_sdu * add 130.230.54.142 tx=max_pcr,max_sdu rx=max_pcr,max_sdu
*/ */
unsigned char ip[4]; unsigned char ip[4];
int tx_pcr, tx_sdu, rx_pcr, rx_sdu; int tx_pcr, tx_sdu, rx_pcr, rx_sdu;
__be32 ipaddr; __be32 ipaddr;
struct atm_qos qos; struct atm_qos qos;
memset(&qos, 0, sizeof(struct atm_qos)); memset(&qos, 0, sizeof(struct atm_qos));
if (sscanf(buff, "del %hhu.%hhu.%hhu.%hhu", if (sscanf(buff, "del %hhu.%hhu.%hhu.%hhu",
ip, ip+1, ip+2, ip+3) == 4) { ip, ip+1, ip+2, ip+3) == 4) {
@ -250,14 +250,14 @@ static int parse_qos(const char *buff)
ip, ip+1, ip+2, ip+3, &tx_pcr, &tx_sdu, &rx_pcr, &rx_sdu) != 8) ip, ip+1, ip+2, ip+3, &tx_pcr, &tx_sdu, &rx_pcr, &rx_sdu) != 8)
return 0; return 0;
ipaddr = *(__be32 *)ip; ipaddr = *(__be32 *)ip;
qos.txtp.traffic_class = ATM_CBR; qos.txtp.traffic_class = ATM_CBR;
qos.txtp.max_pcr = tx_pcr; qos.txtp.max_pcr = tx_pcr;
qos.txtp.max_sdu = tx_sdu; qos.txtp.max_sdu = tx_sdu;
qos.rxtp.traffic_class = ATM_CBR; qos.rxtp.traffic_class = ATM_CBR;
qos.rxtp.max_pcr = rx_pcr; qos.rxtp.max_pcr = rx_pcr;
qos.rxtp.max_sdu = rx_sdu; qos.rxtp.max_sdu = rx_sdu;
qos.aal = ATM_AAL5; qos.aal = ATM_AAL5;
dprintk("mpoa: mpoa_proc.c: parse_qos(): setting qos paramameters to tx=%d,%d rx=%d,%d\n", dprintk("mpoa: mpoa_proc.c: parse_qos(): setting qos paramameters to tx=%d,%d rx=%d,%d\n",
qos.txtp.max_pcr, qos.txtp.max_pcr,
qos.txtp.max_sdu, qos.txtp.max_sdu,
@ -276,11 +276,11 @@ int mpc_proc_init(void)
{ {
struct proc_dir_entry *p; struct proc_dir_entry *p;
p = create_proc_entry(STAT_FILE_NAME, 0, atm_proc_root); p = create_proc_entry(STAT_FILE_NAME, 0, atm_proc_root);
if (!p) { if (!p) {
printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME); printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME);
return -ENOMEM; return -ENOMEM;
} }
p->proc_fops = &mpc_file_operations; p->proc_fops = &mpc_file_operations;
p->owner = THIS_MODULE; p->owner = THIS_MODULE;
return 0; return 0;

View File

@ -86,7 +86,7 @@ static int __vcc_walk(struct sock **sock, int family, int *bucket, loff_t l)
break; break;
} }
l--; l--;
} }
try_again: try_again:
for (; sk; sk = sk_next(sk)) { for (; sk; sk = sk_next(sk)) {
l -= compare_family(sk, family); l -= compare_family(sk, family);
@ -205,7 +205,7 @@ static void vcc_info(struct seq_file *seq, struct atm_vcc *vcc)
seq_printf(seq, "%p ", vcc); seq_printf(seq, "%p ", vcc);
if (!vcc->dev) if (!vcc->dev)
seq_printf(seq, "Unassigned "); seq_printf(seq, "Unassigned ");
else else
seq_printf(seq, "%3d %3d %5d ", vcc->dev->number, vcc->vpi, seq_printf(seq, "%3d %3d %5d ", vcc->dev->number, vcc->vpi,
vcc->vci); vcc->vci);
switch (sk->sk_family) { switch (sk->sk_family) {
@ -249,7 +249,7 @@ static int atm_dev_seq_show(struct seq_file *seq, void *v)
static char atm_dev_banner[] = static char atm_dev_banner[] =
"Itf Type ESI/\"MAC\"addr " "Itf Type ESI/\"MAC\"addr "
"AAL(TX,err,RX,err,drop) ... [refcnt]\n"; "AAL(TX,err,RX,err,drop) ... [refcnt]\n";
if (v == (void *)1) if (v == (void *)1)
seq_puts(seq, atm_dev_banner); seq_puts(seq, atm_dev_banner);
else { else {
@ -257,21 +257,21 @@ static int atm_dev_seq_show(struct seq_file *seq, void *v)
atm_dev_info(seq, dev); atm_dev_info(seq, dev);
} }
return 0; return 0;
} }
static struct seq_operations atm_dev_seq_ops = { static struct seq_operations atm_dev_seq_ops = {
.start = atm_dev_seq_start, .start = atm_dev_seq_start,
.next = atm_dev_seq_next, .next = atm_dev_seq_next,
.stop = atm_dev_seq_stop, .stop = atm_dev_seq_stop,
.show = atm_dev_seq_show, .show = atm_dev_seq_show,
}; };
static int atm_dev_seq_open(struct inode *inode, struct file *file) static int atm_dev_seq_open(struct inode *inode, struct file *file)
{ {
return seq_open(file, &atm_dev_seq_ops); return seq_open(file, &atm_dev_seq_ops);
} }
static struct file_operations devices_seq_fops = { static struct file_operations devices_seq_fops = {
.open = atm_dev_seq_open, .open = atm_dev_seq_open,
.read = seq_read, .read = seq_read,
@ -281,7 +281,7 @@ static struct file_operations devices_seq_fops = {
static int pvc_seq_show(struct seq_file *seq, void *v) static int pvc_seq_show(struct seq_file *seq, void *v)
{ {
static char atm_pvc_banner[] = static char atm_pvc_banner[] =
"Itf VPI VCI AAL RX(PCR,Class) TX(PCR,Class)\n"; "Itf VPI VCI AAL RX(PCR,Class) TX(PCR,Class)\n";
if (v == (void *)1) if (v == (void *)1)
@ -316,31 +316,31 @@ static struct file_operations pvc_seq_fops = {
static int vcc_seq_show(struct seq_file *seq, void *v) static int vcc_seq_show(struct seq_file *seq, void *v)
{ {
if (v == (void *)1) { if (v == (void *)1) {
seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s", seq_printf(seq, sizeof(void *) == 4 ? "%-8s%s" : "%-16s%s",
"Address ", "Itf VPI VCI Fam Flags Reply " "Address ", "Itf VPI VCI Fam Flags Reply "
"Send buffer Recv buffer [refcnt]\n"); "Send buffer Recv buffer [refcnt]\n");
} else { } else {
struct vcc_state *state = seq->private; struct vcc_state *state = seq->private;
struct atm_vcc *vcc = atm_sk(state->sk); struct atm_vcc *vcc = atm_sk(state->sk);
vcc_info(seq, vcc); vcc_info(seq, vcc);
} }
return 0; return 0;
} }
static struct seq_operations vcc_seq_ops = { static struct seq_operations vcc_seq_ops = {
.start = vcc_seq_start, .start = vcc_seq_start,
.next = vcc_seq_next, .next = vcc_seq_next,
.stop = vcc_seq_stop, .stop = vcc_seq_stop,
.show = vcc_seq_show, .show = vcc_seq_show,
}; };
static int vcc_seq_open(struct inode *inode, struct file *file) static int vcc_seq_open(struct inode *inode, struct file *file)
{ {
return __vcc_seq_open(inode, file, 0, &vcc_seq_ops); return __vcc_seq_open(inode, file, 0, &vcc_seq_ops);
} }
static struct file_operations vcc_seq_fops = { static struct file_operations vcc_seq_fops = {
.open = vcc_seq_open, .open = vcc_seq_open,
.read = seq_read, .read = seq_read,
@ -350,7 +350,7 @@ static struct file_operations vcc_seq_fops = {
static int svc_seq_show(struct seq_file *seq, void *v) static int svc_seq_show(struct seq_file *seq, void *v)
{ {
static char atm_svc_banner[] = static char atm_svc_banner[] =
"Itf VPI VCI State Remote\n"; "Itf VPI VCI State Remote\n";
if (v == (void *)1) if (v == (void *)1)
@ -472,7 +472,7 @@ static void atm_proc_dirs_remove(void)
static struct atm_proc_entry *e; static struct atm_proc_entry *e;
for (e = atm_proc_ents; e->name; e++) { for (e = atm_proc_ents; e->name; e++) {
if (e->dirent) if (e->dirent)
remove_proc_entry(e->name, atm_proc_root); remove_proc_entry(e->name, atm_proc_root);
} }
remove_proc_entry("net/atm", NULL); remove_proc_entry("net/atm", NULL);

View File

@ -72,7 +72,7 @@ static int pvc_setsockopt(struct socket *sock, int level, int optname,
static int pvc_getsockopt(struct socket *sock, int level, int optname, static int pvc_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen) char __user *optval, int __user *optlen)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int error; int error;
@ -91,7 +91,7 @@ static int pvc_getname(struct socket *sock,struct sockaddr *sockaddr,
struct atm_vcc *vcc = ATM_SD(sock); struct atm_vcc *vcc = ATM_SD(sock);
if (!vcc->dev || !test_bit(ATM_VF_ADDR,&vcc->flags)) return -ENOTCONN; if (!vcc->dev || !test_bit(ATM_VF_ADDR,&vcc->flags)) return -ENOTCONN;
*sockaddr_len = sizeof(struct sockaddr_atmpvc); *sockaddr_len = sizeof(struct sockaddr_atmpvc);
addr = (struct sockaddr_atmpvc *) sockaddr; addr = (struct sockaddr_atmpvc *) sockaddr;
addr->sap_family = AF_ATMPVC; addr->sap_family = AF_ATMPVC;
addr->sap_addr.itf = vcc->dev->number; addr->sap_addr.itf = vcc->dev->number;

View File

@ -56,12 +56,12 @@ static int atm_send_aal0(struct atm_vcc *vcc,struct sk_buff *skb)
* still work * still work
*/ */
if (!capable(CAP_NET_ADMIN) && if (!capable(CAP_NET_ADMIN) &&
(((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) != (((u32 *) skb->data)[0] & (ATM_HDR_VPI_MASK | ATM_HDR_VCI_MASK)) !=
((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT))) ((vcc->vpi << ATM_HDR_VPI_SHIFT) | (vcc->vci << ATM_HDR_VCI_SHIFT)))
{ {
kfree_skb(skb); kfree_skb(skb);
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
} }
return vcc->dev->ops->send(vcc,skb); return vcc->dev->ops->send(vcc,skb);
} }

View File

@ -142,8 +142,8 @@ void atm_dev_deregister(struct atm_dev *dev)
set_bit(ATM_DF_REMOVED, &dev->flags); set_bit(ATM_DF_REMOVED, &dev->flags);
/* /*
* if we remove current device from atm_devs list, new device * if we remove current device from atm_devs list, new device
* with same number can appear, such we need deregister proc, * with same number can appear, such we need deregister proc,
* release async all vccs and remove them from vccs list too * release async all vccs and remove them from vccs list too
*/ */
mutex_lock(&atm_dev_mutex); mutex_lock(&atm_dev_mutex);
@ -228,7 +228,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
*tmp_p++ = dev->number; *tmp_p++ = dev->number;
} }
mutex_unlock(&atm_dev_mutex); mutex_unlock(&atm_dev_mutex);
error = ((copy_to_user(buf, tmp_buf, size)) || error = ((copy_to_user(buf, tmp_buf, size)) ||
put_user(size, &iobuf->length)) put_user(size, &iobuf->length))
? -EFAULT : 0; ? -EFAULT : 0;
kfree(tmp_buf); kfree(tmp_buf);
@ -247,7 +247,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
if (!(dev = try_then_request_module(atm_dev_lookup(number), if (!(dev = try_then_request_module(atm_dev_lookup(number),
"atm-device-%d", number))) "atm-device-%d", number)))
return -ENODEV; return -ENODEV;
switch (cmd) { switch (cmd) {
case ATM_GETTYPE: case ATM_GETTYPE:
size = strlen(dev->type) + 1; size = strlen(dev->type) + 1;
@ -390,7 +390,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
goto done; goto done;
} }
} }
if (size) if (size)
error = put_user(size, &sioc->length) error = put_user(size, &sioc->length)
? -EFAULT : 0; ? -EFAULT : 0;
@ -414,15 +414,15 @@ static __inline__ void *dev_get_idx(loff_t left)
void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos)
{ {
mutex_lock(&atm_dev_mutex); mutex_lock(&atm_dev_mutex);
return *pos ? dev_get_idx(*pos) : (void *) 1; return *pos ? dev_get_idx(*pos) : (void *) 1;
} }
void atm_dev_seq_stop(struct seq_file *seq, void *v) void atm_dev_seq_stop(struct seq_file *seq, void *v)
{ {
mutex_unlock(&atm_dev_mutex); mutex_unlock(&atm_dev_mutex);
} }
void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{ {
++*pos; ++*pos;

View File

@ -1,7 +1,7 @@
/* net/atm/signaling.h - ATM signaling */ /* net/atm/signaling.h - ATM signaling */
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
#ifndef NET_ATM_SIGNALING_H #ifndef NET_ATM_SIGNALING_H
#define NET_ATM_SIGNALING_H #define NET_ATM_SIGNALING_H

View File

@ -89,7 +89,7 @@ static int svc_release(struct socket *sock)
clear_bit(ATM_VF_READY, &vcc->flags); clear_bit(ATM_VF_READY, &vcc->flags);
/* VCC pointer is used as a reference, so we must not free it /* VCC pointer is used as a reference, so we must not free it
(thereby subjecting it to re-use) before all pending connections (thereby subjecting it to re-use) before all pending connections
are closed */ are closed */
svc_disconnect(vcc); svc_disconnect(vcc);
vcc_release(sock); vcc_release(sock);
} }
@ -144,7 +144,7 @@ static int svc_bind(struct socket *sock,struct sockaddr *sockaddr,
error = -EUNATCH; error = -EUNATCH;
goto out; goto out;
} }
if (!sk->sk_err) if (!sk->sk_err)
set_bit(ATM_VF_BOUND,&vcc->flags); set_bit(ATM_VF_BOUND,&vcc->flags);
error = -sk->sk_err; error = -sk->sk_err;
out: out:
@ -229,7 +229,7 @@ static int svc_connect(struct socket *sock,struct sockaddr *sockaddr,
* This is tricky: * This is tricky:
* Kernel ---close--> Demon * Kernel ---close--> Demon
* Kernel <--close--- Demon * Kernel <--close--- Demon
* or * or
* Kernel ---close--> Demon * Kernel ---close--> Demon
* Kernel <--error--- Demon * Kernel <--error--- Demon
* or * or
@ -470,13 +470,13 @@ static int svc_setsockopt(struct socket *sock, int level, int optname,
} }
set_bit(ATM_VF_HASSAP, &vcc->flags); set_bit(ATM_VF_HASSAP, &vcc->flags);
break; break;
case SO_MULTIPOINT: case SO_MULTIPOINT:
if (level != SOL_ATM || optlen != sizeof(int)) { if (level != SOL_ATM || optlen != sizeof(int)) {
error = -EINVAL; error = -EINVAL;
goto out; goto out;
} }
if (get_user(value, (int __user *) optval)) { if (get_user(value, (int __user *) optval)) {
error = -EFAULT; error = -EFAULT;
goto out; goto out;
} }
if (value == 1) { if (value == 1) {
@ -486,7 +486,7 @@ static int svc_setsockopt(struct socket *sock, int level, int optname,
} else { } else {
error = -EINVAL; error = -EINVAL;
} }
break; break;
default: default:
error = vcc_setsockopt(sock, level, optname, error = vcc_setsockopt(sock, level, optname,
optval, optlen); optval, optlen);
@ -539,7 +539,7 @@ static int svc_addparty(struct socket *sock, struct sockaddr *sockaddr,
set_bit(ATM_VF_WAITING, &vcc->flags); set_bit(ATM_VF_WAITING, &vcc->flags);
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
sigd_enq(vcc, as_addparty, NULL, NULL, sigd_enq(vcc, as_addparty, NULL, NULL,
(struct sockaddr_atmsvc *) sockaddr); (struct sockaddr_atmsvc *) sockaddr);
if (flags & O_NONBLOCK) { if (flags & O_NONBLOCK) {
finish_wait(sk->sk_sleep, &wait); finish_wait(sk->sk_sleep, &wait);
error = -EINPROGRESS; error = -EINPROGRESS;
@ -587,26 +587,26 @@ out:
static int svc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) static int svc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{ {
int error, ep_ref; int error, ep_ref;
struct sockaddr_atmsvc sa; struct sockaddr_atmsvc sa;
struct atm_vcc *vcc = ATM_SD(sock); struct atm_vcc *vcc = ATM_SD(sock);
switch (cmd) { switch (cmd) {
case ATM_ADDPARTY: case ATM_ADDPARTY:
if (!test_bit(ATM_VF_SESSION, &vcc->flags)) if (!test_bit(ATM_VF_SESSION, &vcc->flags))
return -EINVAL; return -EINVAL;
if (copy_from_user(&sa, (void __user *) arg, sizeof(sa))) if (copy_from_user(&sa, (void __user *) arg, sizeof(sa)))
return -EFAULT; return -EFAULT;
error = svc_addparty(sock, (struct sockaddr *) &sa, sizeof(sa), 0); error = svc_addparty(sock, (struct sockaddr *) &sa, sizeof(sa), 0);
break; break;
case ATM_DROPPARTY: case ATM_DROPPARTY:
if (!test_bit(ATM_VF_SESSION, &vcc->flags)) if (!test_bit(ATM_VF_SESSION, &vcc->flags))
return -EINVAL; return -EINVAL;
if (copy_from_user(&ep_ref, (void __user *) arg, sizeof(int))) if (copy_from_user(&ep_ref, (void __user *) arg, sizeof(int)))
return -EFAULT; return -EFAULT;
error = svc_dropparty(sock, ep_ref); error = svc_dropparty(sock, ep_ref);
break; break;
default: default:
error = vcc_ioctl(sock, cmd, arg); error = vcc_ioctl(sock, cmd, arg);
} }

View File

@ -263,9 +263,9 @@ static void ax25_destroy_timer(unsigned long data)
{ {
ax25_cb *ax25=(ax25_cb *)data; ax25_cb *ax25=(ax25_cb *)data;
struct sock *sk; struct sock *sk;
sk=ax25->sk; sk=ax25->sk;
bh_lock_sock(sk); bh_lock_sock(sk);
sock_hold(sk); sock_hold(sk);
ax25_destroy_socket(ax25); ax25_destroy_socket(ax25);
@ -369,57 +369,57 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
ax25_disconnect(ax25, ENETRESET); ax25_disconnect(ax25, ENETRESET);
break; break;
case AX25_WINDOW: case AX25_WINDOW:
if (ax25->modulus == AX25_MODULUS) { if (ax25->modulus == AX25_MODULUS) {
if (ax25_ctl.arg < 1 || ax25_ctl.arg > 7) if (ax25_ctl.arg < 1 || ax25_ctl.arg > 7)
return -EINVAL; return -EINVAL;
} else { } else {
if (ax25_ctl.arg < 1 || ax25_ctl.arg > 63) if (ax25_ctl.arg < 1 || ax25_ctl.arg > 63)
return -EINVAL; return -EINVAL;
} }
ax25->window = ax25_ctl.arg; ax25->window = ax25_ctl.arg;
break; break;
case AX25_T1: case AX25_T1:
if (ax25_ctl.arg < 1) if (ax25_ctl.arg < 1)
return -EINVAL;
ax25->rtt = (ax25_ctl.arg * HZ) / 2;
ax25->t1 = ax25_ctl.arg * HZ;
break;
case AX25_T2:
if (ax25_ctl.arg < 1)
return -EINVAL;
ax25->t2 = ax25_ctl.arg * HZ;
break;
case AX25_N2:
if (ax25_ctl.arg < 1 || ax25_ctl.arg > 31)
return -EINVAL; return -EINVAL;
ax25->n2count = 0; ax25->rtt = (ax25_ctl.arg * HZ) / 2;
ax25->n2 = ax25_ctl.arg; ax25->t1 = ax25_ctl.arg * HZ;
break; break;
case AX25_T3: case AX25_T2:
if (ax25_ctl.arg < 0) if (ax25_ctl.arg < 1)
return -EINVAL; return -EINVAL;
ax25->t3 = ax25_ctl.arg * HZ; ax25->t2 = ax25_ctl.arg * HZ;
break; break;
case AX25_IDLE: case AX25_N2:
if (ax25_ctl.arg < 0) if (ax25_ctl.arg < 1 || ax25_ctl.arg > 31)
return -EINVAL; return -EINVAL;
ax25->idle = ax25_ctl.arg * 60 * HZ; ax25->n2count = 0;
break; ax25->n2 = ax25_ctl.arg;
break;
case AX25_PACLEN: case AX25_T3:
if (ax25_ctl.arg < 16 || ax25_ctl.arg > 65535) if (ax25_ctl.arg < 0)
return -EINVAL; return -EINVAL;
ax25->paclen = ax25_ctl.arg; ax25->t3 = ax25_ctl.arg * HZ;
break; break;
default: case AX25_IDLE:
return -EINVAL; if (ax25_ctl.arg < 0)
return -EINVAL;
ax25->idle = ax25_ctl.arg * 60 * HZ;
break;
case AX25_PACLEN:
if (ax25_ctl.arg < 16 || ax25_ctl.arg > 65535)
return -EINVAL;
ax25->paclen = ax25_ctl.arg;
break;
default:
return -EINVAL;
} }
return 0; return 0;
@ -1209,7 +1209,7 @@ static int __must_check ax25_connect(struct socket *sock,
if (sk->sk_type == SOCK_SEQPACKET && if (sk->sk_type == SOCK_SEQPACKET &&
(ax25t=ax25_find_cb(&ax25->source_addr, &fsa->fsa_ax25.sax25_call, digi, (ax25t=ax25_find_cb(&ax25->source_addr, &fsa->fsa_ax25.sax25_call, digi,
ax25->ax25_dev->dev))) { ax25->ax25_dev->dev))) {
kfree(digi); kfree(digi);
err = -EADDRINUSE; /* Already such a connection */ err = -EADDRINUSE; /* Already such a connection */
ax25_cb_put(ax25t); ax25_cb_put(ax25t);
@ -1456,7 +1456,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
err = -EMSGSIZE; err = -EMSGSIZE;
goto out; goto out;
} }
if (usax != NULL) { if (usax != NULL) {
if (usax->sax25_family != AF_AX25) { if (usax->sax25_family != AF_AX25) {
err = -EINVAL; err = -EINVAL;
@ -1470,8 +1470,8 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
else if (addr_len != sizeof(struct full_sockaddr_ax25)) { else if (addr_len != sizeof(struct full_sockaddr_ax25)) {
/* support for old structure may go away some time */ /* support for old structure may go away some time */
if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) || if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
(addr_len > sizeof(struct full_sockaddr_ax25))) { (addr_len > sizeof(struct full_sockaddr_ax25))) {
err = -EINVAL; err = -EINVAL;
goto out; goto out;
} }
@ -1624,7 +1624,7 @@ static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock,
/* Now we can treat all alike */ /* Now we can treat all alike */
skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
flags & MSG_DONTWAIT, &err); flags & MSG_DONTWAIT, &err);
if (skb == NULL) if (skb == NULL)
goto out; goto out;
@ -1869,7 +1869,7 @@ static void *ax25_info_next(struct seq_file *seq, void *v, loff_t *pos)
return hlist_entry( ((struct ax25_cb *)v)->ax25_node.next, return hlist_entry( ((struct ax25_cb *)v)->ax25_node.next,
struct ax25_cb, ax25_node); struct ax25_cb, ax25_node);
} }
static void ax25_info_stop(struct seq_file *seq, void *v) static void ax25_info_stop(struct seq_file *seq, void *v)
{ {
spin_unlock_bh(&ax25_list_lock); spin_unlock_bh(&ax25_list_lock);

View File

@ -126,10 +126,10 @@ int ax25cmp(const ax25_address *a, const ax25_address *b)
ct++; ct++;
} }
if ((a->ax25_call[ct] & 0x1E) == (b->ax25_call[ct] & 0x1E)) /* SSID without control bit */ if ((a->ax25_call[ct] & 0x1E) == (b->ax25_call[ct] & 0x1E)) /* SSID without control bit */
return 0; return 0;
return 2; /* Partial match */ return 2; /* Partial match */
} }
EXPORT_SYMBOL(ax25cmp); EXPORT_SYMBOL(ax25cmp);

View File

@ -55,46 +55,46 @@ int ax25_hard_header(struct sk_buff *skb, struct net_device *dev, unsigned short
if (type == ETH_P_AX25) if (type == ETH_P_AX25)
return 0; return 0;
/* header is an AX.25 UI frame from us to them */ /* header is an AX.25 UI frame from us to them */
buff = skb_push(skb, AX25_HEADER_LEN); buff = skb_push(skb, AX25_HEADER_LEN);
*buff++ = 0x00; /* KISS DATA */ *buff++ = 0x00; /* KISS DATA */
if (daddr != NULL) if (daddr != NULL)
memcpy(buff, daddr, dev->addr_len); /* Address specified */ memcpy(buff, daddr, dev->addr_len); /* Address specified */
buff[6] &= ~AX25_CBIT; buff[6] &= ~AX25_CBIT;
buff[6] &= ~AX25_EBIT; buff[6] &= ~AX25_EBIT;
buff[6] |= AX25_SSSID_SPARE; buff[6] |= AX25_SSSID_SPARE;
buff += AX25_ADDR_LEN; buff += AX25_ADDR_LEN;
if (saddr != NULL) if (saddr != NULL)
memcpy(buff, saddr, dev->addr_len); memcpy(buff, saddr, dev->addr_len);
else else
memcpy(buff, dev->dev_addr, dev->addr_len); memcpy(buff, dev->dev_addr, dev->addr_len);
buff[6] &= ~AX25_CBIT; buff[6] &= ~AX25_CBIT;
buff[6] |= AX25_EBIT; buff[6] |= AX25_EBIT;
buff[6] |= AX25_SSSID_SPARE; buff[6] |= AX25_SSSID_SPARE;
buff += AX25_ADDR_LEN; buff += AX25_ADDR_LEN;
*buff++ = AX25_UI; /* UI */ *buff++ = AX25_UI; /* UI */
/* Append a suitable AX.25 PID */ /* Append a suitable AX.25 PID */
switch (type) { switch (type) {
case ETH_P_IP: case ETH_P_IP:
*buff++ = AX25_P_IP; *buff++ = AX25_P_IP;
break; break;
case ETH_P_ARP: case ETH_P_ARP:
*buff++ = AX25_P_ARP; *buff++ = AX25_P_ARP;
break; break;
default: default:
printk(KERN_ERR "AX.25: ax25_hard_header - wrong protocol type 0x%2.2x\n", type); printk(KERN_ERR "AX.25: ax25_hard_header - wrong protocol type 0x%2.2x\n", type);
*buff++ = 0; *buff++ = 0;
break; break;
} }
if (daddr != NULL) if (daddr != NULL)
return AX25_HEADER_LEN; return AX25_HEADER_LEN;
return -AX25_HEADER_LEN; /* Unfinished header */ return -AX25_HEADER_LEN; /* Unfinished header */
} }
@ -114,8 +114,8 @@ int ax25_rebuild_header(struct sk_buff *skb)
dst = (ax25_address *)(bp + 1); dst = (ax25_address *)(bp + 1);
src = (ax25_address *)(bp + 8); src = (ax25_address *)(bp + 8);
if (arp_find(bp + 1, skb)) if (arp_find(bp + 1, skb))
return 1; return 1;
route = ax25_get_route(dst, NULL); route = ax25_get_route(dst, NULL);
if (route) { if (route) {
@ -127,8 +127,8 @@ int ax25_rebuild_header(struct sk_buff *skb)
if (dev == NULL) if (dev == NULL)
dev = skb->dev; dev = skb->dev;
if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) { if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) {
goto put; goto put;
} }
if (bp[16] == AX25_P_IP) { if (bp[16] == AX25_P_IP) {
@ -175,8 +175,8 @@ int ax25_rebuild_header(struct sk_buff *skb)
ourskb->nh.raw = ourskb->data; ourskb->nh.raw = ourskb->data;
ax25=ax25_send_frame( ax25=ax25_send_frame(
ourskb, ourskb,
ax25_dev->values[AX25_VALUES_PACLEN], ax25_dev->values[AX25_VALUES_PACLEN],
&src_c, &src_c,
&dst_c, digipeat, dev); &dst_c, digipeat, dev);
if (ax25) { if (ax25) {
@ -186,13 +186,13 @@ int ax25_rebuild_header(struct sk_buff *skb)
} }
} }
bp[7] &= ~AX25_CBIT; bp[7] &= ~AX25_CBIT;
bp[7] &= ~AX25_EBIT; bp[7] &= ~AX25_EBIT;
bp[7] |= AX25_SSSID_SPARE; bp[7] |= AX25_SSSID_SPARE;
bp[14] &= ~AX25_CBIT; bp[14] &= ~AX25_CBIT;
bp[14] |= AX25_EBIT; bp[14] |= AX25_EBIT;
bp[14] |= AX25_SSSID_SPARE; bp[14] |= AX25_SSSID_SPARE;
skb_pull(skb, AX25_KISS_HEADER_LEN); skb_pull(skb, AX25_KISS_HEADER_LEN);
@ -211,7 +211,7 @@ put:
if (route) if (route)
ax25_put_route(route); ax25_put_route(route);
return 1; return 1;
} }
#else /* INET */ #else /* INET */

View File

@ -87,7 +87,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
ax25_rt = ax25_route_list; ax25_rt = ax25_route_list;
while (ax25_rt != NULL) { while (ax25_rt != NULL) {
if (ax25cmp(&ax25_rt->callsign, &route->dest_addr) == 0 && if (ax25cmp(&ax25_rt->callsign, &route->dest_addr) == 0 &&
ax25_rt->dev == ax25_dev->dev) { ax25_rt->dev == ax25_dev->dev) {
kfree(ax25_rt->digipeat); kfree(ax25_rt->digipeat);
ax25_rt->digipeat = NULL; ax25_rt->digipeat = NULL;
if (route->digi_count != 0) { if (route->digi_count != 0) {
@ -252,8 +252,8 @@ static void *ax25_rt_seq_start(struct seq_file *seq, loff_t *pos)
{ {
struct ax25_route *ax25_rt; struct ax25_route *ax25_rt;
int i = 1; int i = 1;
read_lock(&ax25_route_lock); read_lock(&ax25_route_lock);
if (*pos == 0) if (*pos == 0)
return SEQ_START_TOKEN; return SEQ_START_TOKEN;
@ -269,7 +269,7 @@ static void *ax25_rt_seq_start(struct seq_file *seq, loff_t *pos)
static void *ax25_rt_seq_next(struct seq_file *seq, void *v, loff_t *pos) static void *ax25_rt_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{ {
++*pos; ++*pos;
return (v == SEQ_START_TOKEN) ? ax25_route_list : return (v == SEQ_START_TOKEN) ? ax25_route_list :
((struct ax25_route *) v)->next; ((struct ax25_route *) v)->next;
} }

View File

@ -34,7 +34,7 @@
void ax25_std_heartbeat_expiry(ax25_cb *ax25) void ax25_std_heartbeat_expiry(ax25_cb *ax25)
{ {
struct sock *sk=ax25->sk; struct sock *sk=ax25->sk;
if (sk) if (sk)
bh_lock_sock(sk); bh_lock_sock(sk);

View File

@ -56,7 +56,7 @@ void ax25_frames_acked(ax25_cb *ax25, unsigned short nr)
*/ */
if (ax25->va != nr) { if (ax25->va != nr) {
while (skb_peek(&ax25->ack_queue) != NULL && ax25->va != nr) { while (skb_peek(&ax25->ack_queue) != NULL && ax25->va != nr) {
skb = skb_dequeue(&ax25->ack_queue); skb = skb_dequeue(&ax25->ack_queue);
kfree_skb(skb); kfree_skb(skb);
ax25->va = (ax25->va + 1) % ax25->modulus; ax25->va = (ax25->va + 1) % ax25->modulus;
} }
@ -65,7 +65,7 @@ void ax25_frames_acked(ax25_cb *ax25, unsigned short nr)
void ax25_requeue_frames(ax25_cb *ax25) void ax25_requeue_frames(ax25_cb *ax25)
{ {
struct sk_buff *skb, *skb_prev = NULL; struct sk_buff *skb, *skb_prev = NULL;
/* /*
* Requeue all the un-ack-ed frames on the output queue to be picked * Requeue all the un-ack-ed frames on the output queue to be picked

View File

@ -164,7 +164,7 @@ static void *ax25_uid_seq_next(struct seq_file *seq, void *v, loff_t *pos)
++*pos; ++*pos;
return hlist_entry(((ax25_uid_assoc *)v)->uid_node.next, return hlist_entry(((ax25_uid_assoc *)v)->uid_node.next,
ax25_uid_assoc, uid_node); ax25_uid_assoc, uid_node);
} }
static void ax25_uid_seq_stop(struct seq_file *seq, void *v) static void ax25_uid_seq_stop(struct seq_file *seq, void *v)

View File

@ -1,4 +1,4 @@
/* /*
BlueZ - Bluetooth protocol stack for Linux BlueZ - Bluetooth protocol stack for Linux
Copyright (C) 2000-2001 Qualcomm Incorporated Copyright (C) 2000-2001 Qualcomm Incorporated
@ -12,13 +12,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -119,7 +119,7 @@ static int bt_sock_create(struct socket *sock, int proto)
read_unlock(&bt_proto_lock); read_unlock(&bt_proto_lock);
return err; return err;
} }
void bt_sock_link(struct bt_sock_list *l, struct sock *sk) void bt_sock_link(struct bt_sock_list *l, struct sock *sk)
@ -265,7 +265,7 @@ unsigned int bt_sock_poll(struct file * file, struct socket *sock, poll_table *w
if (sk->sk_shutdown == SHUTDOWN_MASK) if (sk->sk_shutdown == SHUTDOWN_MASK)
mask |= POLLHUP; mask |= POLLHUP;
if (!skb_queue_empty(&sk->sk_receive_queue) || if (!skb_queue_empty(&sk->sk_receive_queue) ||
(sk->sk_shutdown & RCV_SHUTDOWN)) (sk->sk_shutdown & RCV_SHUTDOWN))
mask |= POLLIN | POLLRDNORM; mask |= POLLIN | POLLRDNORM;

View File

@ -1,7 +1,7 @@
/* /*
BNEP protocol definition for Linux Bluetooth stack (BlueZ). BNEP protocol definition for Linux Bluetooth stack (BlueZ).
Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation. published by the Free Software Foundation.
@ -60,7 +60,7 @@
// Extension types // Extension types
#define BNEP_EXT_CONTROL 0x00 #define BNEP_EXT_CONTROL 0x00
// Response messages // Response messages
#define BNEP_SUCCESS 0x00 #define BNEP_SUCCESS 0x00
#define BNEP_CONN_INVALID_DST 0x01 #define BNEP_CONN_INVALID_DST 0x01
@ -81,7 +81,7 @@
#define BNEP_CONNECT_TO 15 #define BNEP_CONNECT_TO 15
#define BNEP_FILTER_TO 15 #define BNEP_FILTER_TO 15
// Headers // Headers
#define BNEP_TYPE_MASK 0x7f #define BNEP_TYPE_MASK 0x7f
#define BNEP_EXT_HEADER 0x80 #define BNEP_EXT_HEADER 0x80
@ -132,7 +132,7 @@ struct bnep_conndel_req {
struct bnep_conninfo { struct bnep_conninfo {
__u32 flags; __u32 flags;
__u16 role; __u16 role;
__u16 state; __u16 state;
__u8 dst[ETH_ALEN]; __u8 dst[ETH_ALEN];
char device[16]; char device[16];
}; };
@ -155,10 +155,10 @@ int bnep_get_conninfo(struct bnep_conninfo *ci);
// BNEP sessions // BNEP sessions
struct bnep_session { struct bnep_session {
struct list_head list; struct list_head list;
unsigned int role; unsigned int role;
unsigned long state; unsigned long state;
unsigned long flags; unsigned long flags;
atomic_t killed; atomic_t killed;
struct ethhdr eh; struct ethhdr eh;
@ -166,7 +166,7 @@ struct bnep_session {
struct bnep_proto_filter proto_filter[BNEP_MAX_PROTO_FILTERS]; struct bnep_proto_filter proto_filter[BNEP_MAX_PROTO_FILTERS];
u64 mc_filter; u64 mc_filter;
struct socket *sock; struct socket *sock;
struct net_device *dev; struct net_device *dev;
struct net_device_stats stats; struct net_device_stats stats;
@ -178,7 +178,7 @@ int bnep_sock_cleanup(void);
static inline int bnep_mc_hash(__u8 *addr) static inline int bnep_mc_hash(__u8 *addr)
{ {
return (crc32_be(~0, addr, ETH_ALEN) >> 26); return (crc32_be(~0, addr, ETH_ALEN) >> 26);
} }
#endif #endif

View File

@ -1,4 +1,4 @@
/* /*
BNEP implementation for Linux Bluetooth stack (BlueZ). BNEP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2001-2002 Inventel Systemes Copyright (C) 2001-2002 Inventel Systemes
Written 2001-2002 by Written 2001-2002 by
@ -15,19 +15,19 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
/* /*
* $Id: core.c,v 1.20 2002/08/04 21:23:58 maxk Exp $ * $Id: core.c,v 1.20 2002/08/04 21:23:58 maxk Exp $
*/ */
#include <linux/module.h> #include <linux/module.h>
@ -74,7 +74,7 @@ static struct bnep_session *__bnep_get_session(u8 *dst)
BT_DBG(""); BT_DBG("");
list_for_each(p, &bnep_session_list) { list_for_each(p, &bnep_session_list) {
s = list_entry(p, struct bnep_session, list); s = list_entry(p, struct bnep_session, list);
if (!compare_ether_addr(dst, s->eh.h_source)) if (!compare_ether_addr(dst, s->eh.h_source))
return s; return s;
} }
@ -87,7 +87,7 @@ static void __bnep_link_session(struct bnep_session *s)
by the socket layer which has to hold the refference to this module. by the socket layer which has to hold the refference to this module.
*/ */
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
list_add(&s->list, &bnep_session_list); list_add(&s->list, &bnep_session_list);
} }
static void __bnep_unlink_session(struct bnep_session *s) static void __bnep_unlink_session(struct bnep_session *s)
@ -203,7 +203,7 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len)
memcpy(a1, data, ETH_ALEN); data += ETH_ALEN; memcpy(a1, data, ETH_ALEN); data += ETH_ALEN;
a2 = data; data += ETH_ALEN; a2 = data; data += ETH_ALEN;
BT_DBG("mc filter %s -> %s", BT_DBG("mc filter %s -> %s",
batostr((void *) a1), batostr((void *) a2)); batostr((void *) a1), batostr((void *) a2));
@ -277,7 +277,7 @@ static int bnep_rx_extension(struct bnep_session *s, struct sk_buff *skb)
} }
BT_DBG("type 0x%x len %d", h->type, h->len); BT_DBG("type 0x%x len %d", h->type, h->len);
switch (h->type & BNEP_TYPE_MASK) { switch (h->type & BNEP_TYPE_MASK) {
case BNEP_EXT_CONTROL: case BNEP_EXT_CONTROL:
bnep_rx_control(s, skb->data, skb->len); bnep_rx_control(s, skb->data, skb->len);
@ -293,7 +293,7 @@ static int bnep_rx_extension(struct bnep_session *s, struct sk_buff *skb)
break; break;
} }
} while (!err && (h->type & BNEP_EXT_HEADER)); } while (!err && (h->type & BNEP_EXT_HEADER));
return err; return err;
} }
@ -319,7 +319,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
if ((type & BNEP_TYPE_MASK) > BNEP_RX_TYPES) if ((type & BNEP_TYPE_MASK) > BNEP_RX_TYPES)
goto badframe; goto badframe;
if ((type & BNEP_TYPE_MASK) == BNEP_CONTROL) { if ((type & BNEP_TYPE_MASK) == BNEP_CONTROL) {
bnep_rx_control(s, skb->data, skb->len); bnep_rx_control(s, skb->data, skb->len);
kfree_skb(skb); kfree_skb(skb);
@ -345,7 +345,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
goto badframe; goto badframe;
s->eh.h_proto = get_unaligned((__be16 *) (skb->data - 2)); s->eh.h_proto = get_unaligned((__be16 *) (skb->data - 2));
} }
/* We have to alloc new skb and copy data here :(. Because original skb /* We have to alloc new skb and copy data here :(. Because original skb
* may not be modified and because of the alignment requirements. */ * may not be modified and because of the alignment requirements. */
nskb = alloc_skb(2 + ETH_HLEN + skb->len, GFP_KERNEL); nskb = alloc_skb(2 + ETH_HLEN + skb->len, GFP_KERNEL);
@ -361,7 +361,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
case BNEP_COMPRESSED: case BNEP_COMPRESSED:
memcpy(__skb_put(nskb, ETH_HLEN), &s->eh, ETH_HLEN); memcpy(__skb_put(nskb, ETH_HLEN), &s->eh, ETH_HLEN);
break; break;
case BNEP_COMPRESSED_SRC_ONLY: case BNEP_COMPRESSED_SRC_ONLY:
memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN); memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN);
memcpy(__skb_put(nskb, ETH_ALEN), skb->mac.raw, ETH_ALEN); memcpy(__skb_put(nskb, ETH_ALEN), skb->mac.raw, ETH_ALEN);
@ -381,7 +381,7 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
memcpy(__skb_put(nskb, skb->len), skb->data, skb->len); memcpy(__skb_put(nskb, skb->len), skb->data, skb->len);
kfree_skb(skb); kfree_skb(skb);
s->stats.rx_packets++; s->stats.rx_packets++;
nskb->dev = dev; nskb->dev = dev;
nskb->ip_summed = CHECKSUM_NONE; nskb->ip_summed = CHECKSUM_NONE;
@ -435,7 +435,7 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
iv[il++] = (struct kvec) { eh->h_source, ETH_ALEN }; iv[il++] = (struct kvec) { eh->h_source, ETH_ALEN };
len += ETH_ALEN; len += ETH_ALEN;
break; break;
case BNEP_COMPRESSED_DST_ONLY: case BNEP_COMPRESSED_DST_ONLY:
iv[il++] = (struct kvec) { eh->h_dest, ETH_ALEN }; iv[il++] = (struct kvec) { eh->h_dest, ETH_ALEN };
len += ETH_ALEN; len += ETH_ALEN;
@ -445,7 +445,7 @@ static inline int bnep_tx_frame(struct bnep_session *s, struct sk_buff *skb)
send: send:
iv[il++] = (struct kvec) { skb->data, skb->len }; iv[il++] = (struct kvec) { skb->data, skb->len };
len += skb->len; len += skb->len;
/* FIXME: linearize skb */ /* FIXME: linearize skb */
{ {
len = kernel_sendmsg(sock, &s->msg, iv, il, len); len = kernel_sendmsg(sock, &s->msg, iv, il, len);
@ -471,7 +471,7 @@ static int bnep_session(void *arg)
BT_DBG(""); BT_DBG("");
daemonize("kbnepd %s", dev->name); daemonize("kbnepd %s", dev->name);
set_user_nice(current, -15); set_user_nice(current, -15);
current->flags |= PF_NOFREEZE; current->flags |= PF_NOFREEZE;
@ -488,13 +488,13 @@ static int bnep_session(void *arg)
if (sk->sk_state != BT_CONNECTED) if (sk->sk_state != BT_CONNECTED)
break; break;
// TX // TX
while ((skb = skb_dequeue(&sk->sk_write_queue))) while ((skb = skb_dequeue(&sk->sk_write_queue)))
if (bnep_tx_frame(s, skb)) if (bnep_tx_frame(s, skb))
break; break;
netif_wake_queue(dev); netif_wake_queue(dev);
schedule(); schedule();
} }
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
@ -573,7 +573,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
s->sock = sock; s->sock = sock;
s->role = req->role; s->role = req->role;
s->state = BT_CONNECTED; s->state = BT_CONNECTED;
s->msg.msg_flags = MSG_NOSIGNAL; s->msg.msg_flags = MSG_NOSIGNAL;
#ifdef CONFIG_BT_BNEP_MC_FILTER #ifdef CONFIG_BT_BNEP_MC_FILTER
@ -594,7 +594,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
} }
__bnep_link_session(s); __bnep_link_session(s);
err = kernel_thread(bnep_session, s, CLONE_KERNEL); err = kernel_thread(bnep_session, s, CLONE_KERNEL);
if (err < 0) { if (err < 0) {
/* Session thread start failed, gotta cleanup. */ /* Session thread start failed, gotta cleanup. */
@ -627,7 +627,7 @@ int bnep_del_connection(struct bnep_conndel_req *req)
/* Wakeup user-space which is polling for socket errors. /* Wakeup user-space which is polling for socket errors.
* This is temporary hack untill we have shutdown in L2CAP */ * This is temporary hack untill we have shutdown in L2CAP */
s->sock->sk->sk_err = EUNATCH; s->sock->sk->sk_err = EUNATCH;
/* Kill session thread */ /* Kill session thread */
atomic_inc(&s->killed); atomic_inc(&s->killed);
wake_up_interruptible(s->sock->sk->sk_sleep); wake_up_interruptible(s->sock->sk->sk_sleep);
@ -661,7 +661,7 @@ int bnep_get_connlist(struct bnep_connlist_req *req)
s = list_entry(p, struct bnep_session, list); s = list_entry(p, struct bnep_session, list);
__bnep_copy_ci(&ci, s); __bnep_copy_ci(&ci, s);
if (copy_to_user(req->ci, &ci, sizeof(ci))) { if (copy_to_user(req->ci, &ci, sizeof(ci))) {
err = -EFAULT; err = -EFAULT;
break; break;
@ -696,7 +696,7 @@ int bnep_get_conninfo(struct bnep_conninfo *ci)
} }
static int __init bnep_init(void) static int __init bnep_init(void)
{ {
char flt[50] = ""; char flt[50] = "";
l2cap_load(); l2cap_load();

View File

@ -1,4 +1,4 @@
/* /*
BNEP implementation for Linux Bluetooth stack (BlueZ). BNEP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2001-2002 Inventel Systemes Copyright (C) 2001-2002 Inventel Systemes
Written 2001-2002 by Written 2001-2002 by
@ -15,19 +15,19 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
/* /*
* $Id: netdev.c,v 1.8 2002/08/04 21:23:58 maxk Exp $ * $Id: netdev.c,v 1.8 2002/08/04 21:23:58 maxk Exp $
*/ */
#include <linux/module.h> #include <linux/module.h>
@ -94,7 +94,7 @@ static void bnep_net_set_mc_list(struct net_device *dev)
r->type = BNEP_CONTROL; r->type = BNEP_CONTROL;
r->ctrl = BNEP_FILTER_MULTI_ADDR_SET; r->ctrl = BNEP_FILTER_MULTI_ADDR_SET;
if (dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) { if (dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) {
u8 start[ETH_ALEN] = { 0x01 }; u8 start[ETH_ALEN] = { 0x01 };
/* Request all addresses */ /* Request all addresses */
@ -102,14 +102,14 @@ static void bnep_net_set_mc_list(struct net_device *dev)
memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN);
r->len = htons(ETH_ALEN * 2); r->len = htons(ETH_ALEN * 2);
} else { } else {
struct dev_mc_list *dmi = dev->mc_list; struct dev_mc_list *dmi = dev->mc_list;
int i, len = skb->len; int i, len = skb->len;
if (dev->flags & IFF_BROADCAST) { if (dev->flags & IFF_BROADCAST) {
memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN);
memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN); memcpy(__skb_put(skb, ETH_ALEN), dev->broadcast, ETH_ALEN);
} }
/* FIXME: We should group addresses here. */ /* FIXME: We should group addresses here. */
for (i = 0; i < dev->mc_count && i < BNEP_MAX_MULTICAST_FILTERS; i++) { for (i = 0; i < dev->mc_count && i < BNEP_MAX_MULTICAST_FILTERS; i++) {
@ -159,13 +159,13 @@ static inline u16 bnep_net_eth_proto(struct sk_buff *skb)
{ {
struct ethhdr *eh = (void *) skb->data; struct ethhdr *eh = (void *) skb->data;
u16 proto = ntohs(eh->h_proto); u16 proto = ntohs(eh->h_proto);
if (proto >= 1536) if (proto >= 1536)
return proto; return proto;
if (get_unaligned((__be16 *) skb->data) == htons(0xFFFF)) if (get_unaligned((__be16 *) skb->data) == htons(0xFFFF))
return ETH_P_802_3; return ETH_P_802_3;
return ETH_P_802_2; return ETH_P_802_2;
} }
@ -174,7 +174,7 @@ static inline int bnep_net_proto_filter(struct sk_buff *skb, struct bnep_session
u16 proto = bnep_net_eth_proto(skb); u16 proto = bnep_net_eth_proto(skb);
struct bnep_proto_filter *f = s->proto_filter; struct bnep_proto_filter *f = s->proto_filter;
int i; int i;
for (i = 0; i < BNEP_MAX_PROTO_FILTERS && f[i].end; i++) { for (i = 0; i < BNEP_MAX_PROTO_FILTERS && f[i].end; i++) {
if (proto >= f[i].start && proto <= f[i].end) if (proto >= f[i].start && proto <= f[i].end)
return 0; return 0;
@ -198,14 +198,14 @@ static int bnep_net_xmit(struct sk_buff *skb, struct net_device *dev)
return 0; return 0;
} }
#endif #endif
#ifdef CONFIG_BT_BNEP_PROTO_FILTER #ifdef CONFIG_BT_BNEP_PROTO_FILTER
if (bnep_net_proto_filter(skb, s)) { if (bnep_net_proto_filter(skb, s)) {
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }
#endif #endif
/* /*
* We cannot send L2CAP packets from here as we are potentially in a bh. * We cannot send L2CAP packets from here as we are potentially in a bh.
* So we have to queue them and wake up session thread which is sleeping * So we have to queue them and wake up session thread which is sleeping

View File

@ -1,4 +1,4 @@
/* /*
BNEP implementation for Linux Bluetooth stack (BlueZ). BNEP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2001-2002 Inventel Systemes Copyright (C) 2001-2002 Inventel Systemes
Written 2001-2002 by Written 2001-2002 by
@ -14,19 +14,19 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
/* /*
* $Id: sock.c,v 1.4 2002/08/04 21:23:58 maxk Exp $ * $Id: sock.c,v 1.4 2002/08/04 21:23:58 maxk Exp $
*/ */
#include <linux/module.h> #include <linux/module.h>
@ -89,7 +89,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
if (copy_from_user(&ca, argp, sizeof(ca))) if (copy_from_user(&ca, argp, sizeof(ca)))
return -EFAULT; return -EFAULT;
nsock = sockfd_lookup(ca.sock, &err); nsock = sockfd_lookup(ca.sock, &err);
if (!nsock) if (!nsock)
return err; return err;
@ -101,20 +101,20 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
err = bnep_add_connection(&ca, nsock); err = bnep_add_connection(&ca, nsock);
if (!err) { if (!err) {
if (copy_to_user(argp, &ca, sizeof(ca))) if (copy_to_user(argp, &ca, sizeof(ca)))
err = -EFAULT; err = -EFAULT;
} else } else
fput(nsock->file); fput(nsock->file);
return err; return err;
case BNEPCONNDEL: case BNEPCONNDEL:
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EACCES; return -EACCES;
if (copy_from_user(&cd, argp, sizeof(cd))) if (copy_from_user(&cd, argp, sizeof(cd)))
return -EFAULT; return -EFAULT;
return bnep_del_connection(&cd); return bnep_del_connection(&cd);
case BNEPGETCONNLIST: case BNEPGETCONNLIST:
@ -123,7 +123,7 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
if (cl.cnum <= 0) if (cl.cnum <= 0)
return -EINVAL; return -EINVAL;
err = bnep_get_connlist(&cl); err = bnep_get_connlist(&cl);
if (!err && copy_to_user(argp, &cl, sizeof(cl))) if (!err && copy_to_user(argp, &cl, sizeof(cl)))
return -EFAULT; return -EFAULT;
@ -163,7 +163,7 @@ static int bnep_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigne
if (cl.cnum <= 0) if (cl.cnum <= 0)
return -EINVAL; return -EINVAL;
err = bnep_get_connlist(&cl); err = bnep_get_connlist(&cl);
if (!err && put_user(cl.cnum, (uint32_t __user *) arg)) if (!err && put_user(cl.cnum, (uint32_t __user *) arg))

View File

@ -1,4 +1,4 @@
/* /*
CMTP implementation for Linux Bluetooth stack (BlueZ). CMTP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org> Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org>
@ -10,13 +10,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -563,7 +563,7 @@ int cmtp_attach_device(struct cmtp_session *session)
ret = wait_event_interruptible_timeout(session->wait, ret = wait_event_interruptible_timeout(session->wait,
session->ncontroller, CMTP_INTEROP_TIMEOUT); session->ncontroller, CMTP_INTEROP_TIMEOUT);
BT_INFO("Found %d CAPI controller(s) on device %s", session->ncontroller, session->name); BT_INFO("Found %d CAPI controller(s) on device %s", session->ncontroller, session->name);
if (!ret) if (!ret)

View File

@ -1,4 +1,4 @@
/* /*
CMTP implementation for Linux Bluetooth stack (BlueZ). CMTP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org> Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org>
@ -10,13 +10,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */

View File

@ -1,4 +1,4 @@
/* /*
CMTP implementation for Linux Bluetooth stack (BlueZ). CMTP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org> Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org>
@ -10,13 +10,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -336,7 +336,7 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock)
baswap(&dst, &bt_sk(sock->sk)->dst); baswap(&dst, &bt_sk(sock->sk)->dst);
session = kzalloc(sizeof(struct cmtp_session), GFP_KERNEL); session = kzalloc(sizeof(struct cmtp_session), GFP_KERNEL);
if (!session) if (!session)
return -ENOMEM; return -ENOMEM;
down_write(&cmtp_session_sem); down_write(&cmtp_session_sem);

View File

@ -1,4 +1,4 @@
/* /*
CMTP implementation for Linux Bluetooth stack (BlueZ). CMTP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org> Copyright (C) 2002-2003 Marcel Holtmann <marcel@holtmann.org>
@ -10,13 +10,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -154,7 +154,7 @@ static int cmtp_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigne
if (cl.cnum <= 0) if (cl.cnum <= 0)
return -EINVAL; return -EINVAL;
err = cmtp_get_connlist(&cl); err = cmtp_get_connlist(&cl);
if (!err && put_user(cl.cnum, (uint32_t __user *) arg)) if (!err && put_user(cl.cnum, (uint32_t __user *) arg))

View File

@ -1,4 +1,4 @@
/* /*
BlueZ - Bluetooth protocol stack for Linux BlueZ - Bluetooth protocol stack for Linux
Copyright (C) 2000-2001 Qualcomm Incorporated Copyright (C) 2000-2001 Qualcomm Incorporated
@ -12,13 +12,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -146,7 +146,7 @@ static void hci_conn_timeout(unsigned long arg)
case BT_CONNECT: case BT_CONNECT:
hci_acl_connect_cancel(conn); hci_acl_connect_cancel(conn);
break; break;
case BT_CONNECTED: case BT_CONNECTED:
hci_acl_disconn(conn, 0x13); hci_acl_disconn(conn, 0x13);
break; break;
default: default:
@ -272,7 +272,7 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src)
if (!test_bit(HCI_UP, &d->flags) || test_bit(HCI_RAW, &d->flags)) if (!test_bit(HCI_UP, &d->flags) || test_bit(HCI_RAW, &d->flags))
continue; continue;
/* Simple routing: /* Simple routing:
* No source address - find interface with bdaddr != dst * No source address - find interface with bdaddr != dst
* Source address - find interface with bdaddr == src * Source address - find interface with bdaddr == src
*/ */
@ -328,7 +328,7 @@ struct hci_conn * hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst)
hci_conn_hold(sco); hci_conn_hold(sco);
if (acl->state == BT_CONNECTED && if (acl->state == BT_CONNECTED &&
(sco->state == BT_OPEN || sco->state == BT_CLOSED)) (sco->state == BT_OPEN || sco->state == BT_CLOSED))
hci_add_sco(sco, acl->handle); hci_add_sco(sco, acl->handle);
@ -370,7 +370,7 @@ int hci_conn_encrypt(struct hci_conn *conn)
if (hci_conn_auth(conn)) { if (hci_conn_auth(conn)) {
struct hci_cp_set_conn_encrypt cp; struct hci_cp_set_conn_encrypt cp;
cp.handle = __cpu_to_le16(conn->handle); cp.handle = __cpu_to_le16(conn->handle);
cp.encrypt = 1; cp.encrypt = 1;
hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_SET_CONN_ENCRYPT, sizeof(cp), &cp); hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_SET_CONN_ENCRYPT, sizeof(cp), &cp);
} }
return 0; return 0;

View File

@ -1,4 +1,4 @@
/* /*
BlueZ - Bluetooth protocol stack for Linux BlueZ - Bluetooth protocol stack for Linux
Copyright (C) 2000-2001 Qualcomm Incorporated Copyright (C) 2000-2001 Qualcomm Incorporated
@ -12,13 +12,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -116,7 +116,7 @@ static void hci_req_cancel(struct hci_dev *hdev, int err)
} }
/* Execute request and wait for completion. */ /* Execute request and wait for completion. */
static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev, unsigned long opt), static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev, unsigned long opt),
unsigned long opt, __u32 timeout) unsigned long opt, __u32 timeout)
{ {
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
@ -278,7 +278,7 @@ static void hci_encrypt_req(struct hci_dev *hdev, unsigned long opt)
hci_send_cmd(hdev, OGF_HOST_CTL, OCF_WRITE_ENCRYPT_MODE, 1, &encrypt); hci_send_cmd(hdev, OGF_HOST_CTL, OCF_WRITE_ENCRYPT_MODE, 1, &encrypt);
} }
/* Get HCI device by index. /* Get HCI device by index.
* Device is held on return. */ * Device is held on return. */
struct hci_dev *hci_dev_get(int index) struct hci_dev *hci_dev_get(int index)
{ {
@ -405,7 +405,7 @@ int hci_inquiry(void __user *arg)
return -ENODEV; return -ENODEV;
hci_dev_lock_bh(hdev); hci_dev_lock_bh(hdev);
if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX ||
inquiry_cache_empty(hdev) || inquiry_cache_empty(hdev) ||
ir.flags & IREQ_CACHE_FLUSH) { ir.flags & IREQ_CACHE_FLUSH) {
inquiry_cache_flush(hdev); inquiry_cache_flush(hdev);
@ -439,7 +439,7 @@ int hci_inquiry(void __user *arg)
if (copy_to_user(ptr, buf, sizeof(struct inquiry_info) * if (copy_to_user(ptr, buf, sizeof(struct inquiry_info) *
ir.num_rsp)) ir.num_rsp))
err = -EFAULT; err = -EFAULT;
} else } else
err = -EFAULT; err = -EFAULT;
kfree(buf); kfree(buf);
@ -491,7 +491,7 @@ int hci_dev_open(__u16 dev)
hci_dev_hold(hdev); hci_dev_hold(hdev);
set_bit(HCI_UP, &hdev->flags); set_bit(HCI_UP, &hdev->flags);
hci_notify(hdev, HCI_DEV_UP); hci_notify(hdev, HCI_DEV_UP);
} else { } else {
/* Init failed, cleanup */ /* Init failed, cleanup */
tasklet_kill(&hdev->rx_task); tasklet_kill(&hdev->rx_task);
tasklet_kill(&hdev->tx_task); tasklet_kill(&hdev->tx_task);
@ -619,7 +619,7 @@ int hci_dev_reset(__u16 dev)
if (hdev->flush) if (hdev->flush)
hdev->flush(hdev); hdev->flush(hdev);
atomic_set(&hdev->cmd_cnt, 1); atomic_set(&hdev->cmd_cnt, 1);
hdev->acl_cnt = 0; hdev->sco_cnt = 0; hdev->acl_cnt = 0; hdev->sco_cnt = 0;
if (!test_bit(HCI_RAW, &hdev->flags)) if (!test_bit(HCI_RAW, &hdev->flags))
@ -841,7 +841,7 @@ int hci_register_dev(struct hci_dev *hdev)
break; break;
head = p; id++; head = p; id++;
} }
sprintf(hdev->name, "hci%d", id); sprintf(hdev->name, "hci%d", id);
hdev->id = id; hdev->id = id;
list_add(&hdev->list, head); list_add(&hdev->list, head);
@ -1109,7 +1109,7 @@ int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags)
__skb_queue_tail(&conn->data_q, skb); __skb_queue_tail(&conn->data_q, skb);
do { do {
skb = list; list = list->next; skb = list; list = list->next;
skb->dev = (void *) hdev; skb->dev = (void *) hdev;
bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT; bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT;
hci_add_acl_hdr(skb, conn->handle, flags | ACL_CONT); hci_add_acl_hdr(skb, conn->handle, flags | ACL_CONT);
@ -1164,7 +1164,7 @@ static inline struct hci_conn *hci_low_sent(struct hci_dev *hdev, __u8 type, int
int num = 0, min = ~0; int num = 0, min = ~0;
struct list_head *p; struct list_head *p;
/* We don't have to lock device here. Connections are always /* We don't have to lock device here. Connections are always
* added and removed with TX task disabled. */ * added and removed with TX task disabled. */
list_for_each(p, &h->list) { list_for_each(p, &h->list) {
struct hci_conn *c; struct hci_conn *c;
@ -1306,7 +1306,7 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
hci_dev_lock(hdev); hci_dev_lock(hdev);
conn = hci_conn_hash_lookup_handle(hdev, handle); conn = hci_conn_hash_lookup_handle(hdev, handle);
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
if (conn) { if (conn) {
register struct hci_proto *hp; register struct hci_proto *hp;
@ -1318,7 +1318,7 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
return; return;
} }
} else { } else {
BT_ERR("%s ACL packet for unknown connection handle %d", BT_ERR("%s ACL packet for unknown connection handle %d",
hdev->name, handle); hdev->name, handle);
} }
@ -1353,7 +1353,7 @@ static inline void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
return; return;
} }
} else { } else {
BT_ERR("%s SCO packet for unknown connection handle %d", BT_ERR("%s SCO packet for unknown connection handle %d",
hdev->name, handle); hdev->name, handle);
} }

View File

@ -1,4 +1,4 @@
/* /*
BlueZ - Bluetooth protocol stack for Linux BlueZ - Bluetooth protocol stack for Linux
Copyright (C) 2000-2001 Qualcomm Incorporated Copyright (C) 2000-2001 Qualcomm Incorporated
@ -12,13 +12,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -100,7 +100,7 @@ static void hci_cc_link_policy(struct hci_dev *hdev, __u16 ocf, struct sk_buff *
BT_DBG("%s ocf 0x%x", hdev->name, ocf); BT_DBG("%s ocf 0x%x", hdev->name, ocf);
switch (ocf) { switch (ocf) {
case OCF_ROLE_DISCOVERY: case OCF_ROLE_DISCOVERY:
rd = (void *) skb->data; rd = (void *) skb->data;
if (rd->status) if (rd->status)
@ -141,7 +141,7 @@ static void hci_cc_link_policy(struct hci_dev *hdev, __u16 ocf, struct sk_buff *
break; break;
default: default:
BT_DBG("%s: Command complete: ogf LINK_POLICY ocf %x", BT_DBG("%s: Command complete: ogf LINK_POLICY ocf %x",
hdev->name, ocf); hdev->name, ocf);
break; break;
} }
@ -237,10 +237,10 @@ static void hci_cc_host_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb
if (!status) { if (!status) {
clear_bit(HCI_PSCAN, &hdev->flags); clear_bit(HCI_PSCAN, &hdev->flags);
clear_bit(HCI_ISCAN, &hdev->flags); clear_bit(HCI_ISCAN, &hdev->flags);
if (param & SCAN_INQUIRY) if (param & SCAN_INQUIRY)
set_bit(HCI_ISCAN, &hdev->flags); set_bit(HCI_ISCAN, &hdev->flags);
if (param & SCAN_PAGE) if (param & SCAN_PAGE)
set_bit(HCI_PSCAN, &hdev->flags); set_bit(HCI_PSCAN, &hdev->flags);
} }
hci_req_complete(hdev, status); hci_req_complete(hdev, status);
@ -343,7 +343,7 @@ static void hci_cc_info_param(struct hci_dev *hdev, __u16 ocf, struct sk_buff *s
memcpy(hdev->features, lf->features, sizeof(hdev->features)); memcpy(hdev->features, lf->features, sizeof(hdev->features));
/* Adjust default settings according to features /* Adjust default settings according to features
* supported by device. */ * supported by device. */
if (hdev->features[0] & LMP_3SLOT) if (hdev->features[0] & LMP_3SLOT)
hdev->pkt_type |= (HCI_DM3 | HCI_DH3); hdev->pkt_type |= (HCI_DM3 | HCI_DH3);
@ -491,7 +491,7 @@ static void hci_cs_link_ctl(struct hci_dev *hdev, __u16 ocf, __u8 status)
break; break;
default: default:
BT_DBG("%s Command status: ogf LINK_CTL ocf %x status %d", BT_DBG("%s Command status: ogf LINK_CTL ocf %x status %d",
hdev->name, ocf, status); hdev->name, ocf, status);
break; break;
} }
@ -793,7 +793,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
if (!conn->out) { if (!conn->out) {
struct hci_cp_change_conn_ptype cp; struct hci_cp_change_conn_ptype cp;
cp.handle = ev->handle; cp.handle = ev->handle;
cp.pkt_type = (conn->type == ACL_LINK) ? cp.pkt_type = (conn->type == ACL_LINK) ?
__cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK): __cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK):
__cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK); __cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK);

View File

@ -1,4 +1,4 @@
/* /*
BlueZ - Bluetooth protocol stack for Linux BlueZ - Bluetooth protocol stack for Linux
Copyright (C) 2000-2001 Qualcomm Incorporated Copyright (C) 2000-2001 Qualcomm Incorporated
@ -12,13 +12,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -170,7 +170,7 @@ static int hci_sock_release(struct socket *sock)
return 0; return 0;
} }
/* Ioctls that require bound socket */ /* Ioctls that require bound socket */
static inline int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg) static inline int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg)
{ {
struct hci_dev *hdev = hci_pi(sk)->hdev; struct hci_dev *hdev = hci_pi(sk)->hdev;
@ -348,8 +348,8 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(tv), &tv); put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(tv), &tv);
} }
} }
static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len, int flags) struct msghdr *msg, size_t len, int flags)
{ {
int noblock = flags & MSG_DONTWAIT; int noblock = flags & MSG_DONTWAIT;
@ -386,7 +386,7 @@ static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
return err ? : copied; return err ? : copied;
} }
static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len) struct msghdr *msg, size_t len)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
@ -520,7 +520,7 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char
*((u32 *) f->event_mask + 0) = uf.event_mask[0]; *((u32 *) f->event_mask + 0) = uf.event_mask[0];
*((u32 *) f->event_mask + 1) = uf.event_mask[1]; *((u32 *) f->event_mask + 1) = uf.event_mask[1];
} }
break; break;
default: default:
err = -ENOPROTOOPT; err = -ENOPROTOOPT;
@ -535,7 +535,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname, char
{ {
struct hci_ufilter uf; struct hci_ufilter uf;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int len, opt; int len, opt;
if (get_user(len, optlen)) if (get_user(len, optlen))
return -EFAULT; return -EFAULT;
@ -544,7 +544,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname, char
case HCI_DATA_DIR: case HCI_DATA_DIR:
if (hci_pi(sk)->cmsg_mask & HCI_CMSG_DIR) if (hci_pi(sk)->cmsg_mask & HCI_CMSG_DIR)
opt = 1; opt = 1;
else else
opt = 0; opt = 0;
if (put_user(opt, optval)) if (put_user(opt, optval))
@ -554,7 +554,7 @@ static int hci_sock_getsockopt(struct socket *sock, int level, int optname, char
case HCI_TIME_STAMP: case HCI_TIME_STAMP:
if (hci_pi(sk)->cmsg_mask & HCI_CMSG_TSTAMP) if (hci_pi(sk)->cmsg_mask & HCI_CMSG_TSTAMP)
opt = 1; opt = 1;
else else
opt = 0; opt = 0;
if (put_user(opt, optval)) if (put_user(opt, optval))

View File

@ -1,4 +1,4 @@
/* /*
HIDP implementation for Linux Bluetooth stack (BlueZ). HIDP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org> Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org>
@ -10,13 +10,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -293,7 +293,7 @@ static inline void hidp_process_handshake(struct hidp_session *session, unsigned
case HIDP_HSHK_ERR_FATAL: case HIDP_HSHK_ERR_FATAL:
/* Device requests a reboot, as this is the only way this error /* Device requests a reboot, as this is the only way this error
* can be recovered. */ * can be recovered. */
__hidp_send_ctrl_message(session, __hidp_send_ctrl_message(session,
HIDP_TRANS_HID_CONTROL | HIDP_CTRL_SOFT_RESET, NULL, 0); HIDP_TRANS_HID_CONTROL | HIDP_CTRL_SOFT_RESET, NULL, 0);
break; break;

View File

@ -1,4 +1,4 @@
/* /*
HIDP implementation for Linux Bluetooth stack (BlueZ). HIDP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org> Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org>
@ -10,13 +10,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */

View File

@ -1,4 +1,4 @@
/* /*
HIDP implementation for Linux Bluetooth stack (BlueZ). HIDP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org> Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org>
@ -10,13 +10,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -206,7 +206,7 @@ static int hidp_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigne
put_user(ca.idle_to, &uca->idle_to) || put_user(ca.idle_to, &uca->idle_to) ||
copy_to_user(&uca->name[0], &ca.name[0], 128)) copy_to_user(&uca->name[0], &ca.name[0], 128))
return -EFAULT; return -EFAULT;
arg = (unsigned long) uca; arg = (unsigned long) uca;
/* Fall through. We don't actually write back any _changes_ /* Fall through. We don't actually write back any _changes_

View File

@ -1,4 +1,4 @@
/* /*
BlueZ - Bluetooth protocol stack for Linux BlueZ - Bluetooth protocol stack for Linux
Copyright (C) 2000-2001 Qualcomm Incorporated Copyright (C) 2000-2001 Qualcomm Incorporated
@ -12,13 +12,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -227,7 +227,7 @@ static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct so
bt_accept_enqueue(parent, sk); bt_accept_enqueue(parent, sk);
} }
/* Delete channel. /* Delete channel.
* Must be called on the locked socket. */ * Must be called on the locked socket. */
static void l2cap_chan_del(struct sock *sk, int err) static void l2cap_chan_del(struct sock *sk, int err)
{ {
@ -238,7 +238,7 @@ static void l2cap_chan_del(struct sock *sk, int err)
BT_DBG("sk %p, conn %p, err %d", sk, conn, err); BT_DBG("sk %p, conn %p, err %d", sk, conn, err);
if (conn) { if (conn) {
/* Unlink from channel list */ /* Unlink from channel list */
l2cap_chan_unlink(&conn->chan_list, sk); l2cap_chan_unlink(&conn->chan_list, sk);
l2cap_pi(sk)->conn = NULL; l2cap_pi(sk)->conn = NULL;
@ -590,7 +590,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_
err = -EACCES; err = -EACCES;
goto done; goto done;
} }
write_lock_bh(&l2cap_sk_list.lock); write_lock_bh(&l2cap_sk_list.lock);
if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) { if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) {
@ -890,7 +890,7 @@ static inline int l2cap_do_send(struct sock *sk, struct msghdr *msg, int len)
*frag = bt_skb_send_alloc(sk, count, msg->msg_flags & MSG_DONTWAIT, &err); *frag = bt_skb_send_alloc(sk, count, msg->msg_flags & MSG_DONTWAIT, &err);
if (!*frag) if (!*frag)
goto fail; goto fail;
if (memcpy_fromiovec(skb_put(*frag, count), msg->msg_iov, count)) { if (memcpy_fromiovec(skb_put(*frag, count), msg->msg_iov, count)) {
err = -EFAULT; err = -EFAULT;
goto fail; goto fail;
@ -1267,7 +1267,7 @@ static inline int l2cap_get_conf_opt(void **ptr, int *type, int *olen, unsigned
static inline void l2cap_parse_conf_req(struct sock *sk, void *data, int len) static inline void l2cap_parse_conf_req(struct sock *sk, void *data, int len)
{ {
int type, hint, olen; int type, hint, olen;
unsigned long val; unsigned long val;
void *ptr = data; void *ptr = data;
@ -1414,7 +1414,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
/* Check for backlog size */ /* Check for backlog size */
if (sk_acceptq_is_full(parent)) { if (sk_acceptq_is_full(parent)) {
BT_DBG("backlog full %d", parent->sk_ack_backlog); BT_DBG("backlog full %d", parent->sk_ack_backlog);
goto response; goto response;
} }
@ -1607,7 +1607,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
goto done; goto done;
} }
default: default:
sk->sk_state = BT_DISCONN; sk->sk_state = BT_DISCONN;
sk->sk_err = ECONNRESET; sk->sk_err = ECONNRESET;
l2cap_sock_set_timer(sk, HZ * 5); l2cap_sock_set_timer(sk, HZ * 5);

View File

@ -1,4 +1,4 @@
/* /*
BlueZ - Bluetooth protocol stack for Linux BlueZ - Bluetooth protocol stack for Linux
Copyright (C) 2000-2001 Qualcomm Incorporated Copyright (C) 2000-2001 Qualcomm Incorporated
@ -12,13 +12,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */

View File

@ -1,4 +1,4 @@
/* /*
RFCOMM implementation for Linux Bluetooth stack (BlueZ). RFCOMM implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org>
@ -11,13 +11,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -134,7 +134,7 @@ static inline void rfcomm_session_put(struct rfcomm_session *s)
/* ---- RFCOMM FCS computation ---- */ /* ---- RFCOMM FCS computation ---- */
/* reversed, 8-bit, poly=0x07 */ /* reversed, 8-bit, poly=0x07 */
static unsigned char rfcomm_crc_table[256] = { static unsigned char rfcomm_crc_table[256] = {
0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75, 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75,
0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b, 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b,
0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69, 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69,
@ -179,13 +179,13 @@ static unsigned char rfcomm_crc_table[256] = {
/* CRC on 2 bytes */ /* CRC on 2 bytes */
#define __crc(data) (rfcomm_crc_table[rfcomm_crc_table[0xff ^ data[0]] ^ data[1]]) #define __crc(data) (rfcomm_crc_table[rfcomm_crc_table[0xff ^ data[0]] ^ data[1]])
/* FCS on 2 bytes */ /* FCS on 2 bytes */
static inline u8 __fcs(u8 *data) static inline u8 __fcs(u8 *data)
{ {
return (0xff - __crc(data)); return (0xff - __crc(data));
} }
/* FCS on 3 bytes */ /* FCS on 3 bytes */
static inline u8 __fcs2(u8 *data) static inline u8 __fcs2(u8 *data)
{ {
return (0xff - rfcomm_crc_table[__crc(data) ^ data[2]]); return (0xff - rfcomm_crc_table[__crc(data) ^ data[2]]);
@ -288,7 +288,7 @@ struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio)
atomic_set(&d->refcnt, 1); atomic_set(&d->refcnt, 1);
rfcomm_dlc_clear_state(d); rfcomm_dlc_clear_state(d);
BT_DBG("%p", d); BT_DBG("%p", d);
return d; return d;
@ -345,7 +345,7 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
int err = 0; int err = 0;
u8 dlci; u8 dlci;
BT_DBG("dlc %p state %ld %s %s channel %d", BT_DBG("dlc %p state %ld %s %s channel %d",
d, d->state, batostr(src), batostr(dst), channel); d, d->state, batostr(src), batostr(dst), channel);
if (channel < 1 || channel > 30) if (channel < 1 || channel > 30)
@ -489,21 +489,21 @@ void fastcall __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d)
rfcomm_schedule(RFCOMM_SCHED_TX); rfcomm_schedule(RFCOMM_SCHED_TX);
} }
/* /*
Set/get modem status functions use _local_ status i.e. what we report Set/get modem status functions use _local_ status i.e. what we report
to the other side. to the other side.
Remote status is provided by dlc->modem_status() callback. Remote status is provided by dlc->modem_status() callback.
*/ */
int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig) int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig)
{ {
BT_DBG("dlc %p state %ld v24_sig 0x%x", BT_DBG("dlc %p state %ld v24_sig 0x%x",
d, d->state, v24_sig); d, d->state, v24_sig);
if (test_bit(RFCOMM_RX_THROTTLED, &d->flags)) if (test_bit(RFCOMM_RX_THROTTLED, &d->flags))
v24_sig |= RFCOMM_V24_FC; v24_sig |= RFCOMM_V24_FC;
else else
v24_sig &= ~RFCOMM_V24_FC; v24_sig &= ~RFCOMM_V24_FC;
d->v24_sig = v24_sig; d->v24_sig = v24_sig;
if (!test_and_set_bit(RFCOMM_MSC_PENDING, &d->flags)) if (!test_and_set_bit(RFCOMM_MSC_PENDING, &d->flags))
@ -514,7 +514,7 @@ int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig)
int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig) int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig)
{ {
BT_DBG("dlc %p state %ld v24_sig 0x%x", BT_DBG("dlc %p state %ld v24_sig 0x%x",
d, d->state, d->v24_sig); d, d->state, d->v24_sig);
*v24_sig = d->v24_sig; *v24_sig = d->v24_sig;
@ -576,7 +576,7 @@ static struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst)
struct bt_sock *sk; struct bt_sock *sk;
list_for_each_safe(p, n, &session_list) { list_for_each_safe(p, n, &session_list) {
s = list_entry(p, struct rfcomm_session, list); s = list_entry(p, struct rfcomm_session, list);
sk = bt_sk(s->sock->sk); sk = bt_sk(s->sock->sk);
if ((!bacmp(src, BDADDR_ANY) || !bacmp(&sk->src, src)) && if ((!bacmp(src, BDADDR_ANY) || !bacmp(&sk->src, src)) &&
!bacmp(&sk->dst, dst)) !bacmp(&sk->dst, dst))
@ -825,7 +825,7 @@ static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d
int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci,
u8 bit_rate, u8 data_bits, u8 stop_bits, u8 bit_rate, u8 data_bits, u8 stop_bits,
u8 parity, u8 flow_ctrl_settings, u8 parity, u8 flow_ctrl_settings,
u8 xon_char, u8 xoff_char, u16 param_mask) u8 xon_char, u8 xoff_char, u16 param_mask)
{ {
struct rfcomm_hdr *hdr; struct rfcomm_hdr *hdr;
@ -834,8 +834,8 @@ int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci,
u8 buf[16], *ptr = buf; u8 buf[16], *ptr = buf;
BT_DBG("%p cr %d dlci %d bit_r 0x%x data_b 0x%x stop_b 0x%x parity 0x%x" BT_DBG("%p cr %d dlci %d bit_r 0x%x data_b 0x%x stop_b 0x%x parity 0x%x"
" flwc_s 0x%x xon_c 0x%x xoff_c 0x%x p_mask 0x%x", " flwc_s 0x%x xon_c 0x%x xoff_c 0x%x p_mask 0x%x",
s, cr, dlci, bit_rate, data_bits, stop_bits, parity, s, cr, dlci, bit_rate, data_bits, stop_bits, parity,
flow_ctrl_settings, xon_char, xoff_char, param_mask); flow_ctrl_settings, xon_char, xoff_char, param_mask);
hdr = (void *) ptr; ptr += sizeof(*hdr); hdr = (void *) ptr; ptr += sizeof(*hdr);
@ -1120,9 +1120,9 @@ static int rfcomm_recv_disc(struct rfcomm_session *s, u8 dlci)
d->state = BT_CLOSED; d->state = BT_CLOSED;
__rfcomm_dlc_close(d, err); __rfcomm_dlc_close(d, err);
} else } else
rfcomm_send_dm(s, dlci); rfcomm_send_dm(s, dlci);
} else { } else {
rfcomm_send_ua(s, 0); rfcomm_send_ua(s, 0);
@ -1230,7 +1230,7 @@ static int rfcomm_apply_pn(struct rfcomm_dlc *d, int cr, struct rfcomm_pn *pn)
{ {
struct rfcomm_session *s = d->session; struct rfcomm_session *s = d->session;
BT_DBG("dlc %p state %ld dlci %d mtu %d fc 0x%x credits %d", BT_DBG("dlc %p state %ld dlci %d mtu %d fc 0x%x credits %d",
d, d->state, d->dlci, pn->mtu, pn->flow_ctrl, pn->credits); d, d->state, d->dlci, pn->mtu, pn->flow_ctrl, pn->credits);
if ((pn->flow_ctrl == 0xf0 && s->cfc != RFCOMM_CFC_DISABLED) || if ((pn->flow_ctrl == 0xf0 && s->cfc != RFCOMM_CFC_DISABLED) ||
@ -1454,7 +1454,7 @@ static int rfcomm_recv_msc(struct rfcomm_session *s, int cr, struct sk_buff *skb
if (d->modem_status) if (d->modem_status)
d->modem_status(d, msc->v24_sig); d->modem_status(d, msc->v24_sig);
rfcomm_dlc_unlock(d); rfcomm_dlc_unlock(d);
rfcomm_send_msc(s, 0, dlci, msc->v24_sig); rfcomm_send_msc(s, 0, dlci, msc->v24_sig);
d->mscex |= RFCOMM_MSCEX_RX; d->mscex |= RFCOMM_MSCEX_RX;
@ -1641,18 +1641,18 @@ static inline int rfcomm_process_tx(struct rfcomm_dlc *d)
struct sk_buff *skb; struct sk_buff *skb;
int err; int err;
BT_DBG("dlc %p state %ld cfc %d rx_credits %d tx_credits %d", BT_DBG("dlc %p state %ld cfc %d rx_credits %d tx_credits %d",
d, d->state, d->cfc, d->rx_credits, d->tx_credits); d, d->state, d->cfc, d->rx_credits, d->tx_credits);
/* Send pending MSC */ /* Send pending MSC */
if (test_and_clear_bit(RFCOMM_MSC_PENDING, &d->flags)) if (test_and_clear_bit(RFCOMM_MSC_PENDING, &d->flags))
rfcomm_send_msc(d->session, 1, d->dlci, d->v24_sig); rfcomm_send_msc(d->session, 1, d->dlci, d->v24_sig);
if (d->cfc) { if (d->cfc) {
/* CFC enabled. /* CFC enabled.
* Give them some credits */ * Give them some credits */
if (!test_bit(RFCOMM_RX_THROTTLED, &d->flags) && if (!test_bit(RFCOMM_RX_THROTTLED, &d->flags) &&
d->rx_credits <= (d->cfc >> 2)) { d->rx_credits <= (d->cfc >> 2)) {
rfcomm_send_credits(d->session, d->addr, d->cfc - d->rx_credits); rfcomm_send_credits(d->session, d->addr, d->cfc - d->rx_credits);
d->rx_credits = d->cfc; d->rx_credits = d->cfc;
} }
@ -1876,7 +1876,7 @@ static int rfcomm_add_listener(bdaddr_t *ba)
/* Create socket */ /* Create socket */
err = rfcomm_l2sock_create(&sock); err = rfcomm_l2sock_create(&sock);
if (err < 0) { if (err < 0) {
BT_ERR("Create socket failed %d", err); BT_ERR("Create socket failed %d", err);
return err; return err;
} }

View File

@ -1,4 +1,4 @@
/* /*
RFCOMM implementation for Linux Bluetooth stack (BlueZ). RFCOMM implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org>
@ -11,13 +11,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -130,7 +130,7 @@ static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src)
struct hlist_node *node; struct hlist_node *node;
sk_for_each(sk, node, &rfcomm_sk_list.head) { sk_for_each(sk, node, &rfcomm_sk_list.head) {
if (rfcomm_pi(sk)->channel == channel && if (rfcomm_pi(sk)->channel == channel &&
!bacmp(&bt_sk(sk)->src, src)) !bacmp(&bt_sk(sk)->src, src))
break; break;
} }
@ -572,7 +572,7 @@ static int rfcomm_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
while (len) { while (len) {
size_t size = min_t(size_t, len, d->mtu); size_t size = min_t(size_t, len, d->mtu);
int err; int err;
skb = sock_alloc_send_skb(sk, size + RFCOMM_SKB_RESERVE, skb = sock_alloc_send_skb(sk, size + RFCOMM_SKB_RESERVE,
msg->msg_flags & MSG_DONTWAIT, &err); msg->msg_flags & MSG_DONTWAIT, &err);
if (!skb) if (!skb)
@ -843,7 +843,7 @@ static int rfcomm_sock_release(struct socket *sock)
return err; return err;
} }
/* ---- RFCOMM core layer callbacks ---- /* ---- RFCOMM core layer callbacks ----
* *
* called under rfcomm_lock() * called under rfcomm_lock()
*/ */
@ -864,7 +864,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc *
/* Check for backlog size */ /* Check for backlog size */
if (sk_acceptq_is_full(parent)) { if (sk_acceptq_is_full(parent)) {
BT_DBG("backlog full %d", parent->sk_ack_backlog); BT_DBG("backlog full %d", parent->sk_ack_backlog);
goto done; goto done;
} }

View File

@ -1,4 +1,4 @@
/* /*
RFCOMM implementation for Linux Bluetooth stack (BlueZ). RFCOMM implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org>
@ -11,13 +11,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -110,7 +110,7 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev)
kfree(dev); kfree(dev);
/* It's safe to call module_put() here because socket still /* It's safe to call module_put() here because socket still
holds reference to this module. */ holds reference to this module. */
module_put(THIS_MODULE); module_put(THIS_MODULE);
} }
@ -185,7 +185,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
int err = 0; int err = 0;
BT_DBG("id %d channel %d", req->dev_id, req->channel); BT_DBG("id %d channel %d", req->dev_id, req->channel);
dev = kzalloc(sizeof(struct rfcomm_dev), GFP_KERNEL); dev = kzalloc(sizeof(struct rfcomm_dev), GFP_KERNEL);
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
@ -234,7 +234,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
bacpy(&dev->dst, &req->dst); bacpy(&dev->dst, &req->dst);
dev->channel = req->channel; dev->channel = req->channel;
dev->flags = req->flags & dev->flags = req->flags &
((1 << RFCOMM_RELEASE_ONHUP) | (1 << RFCOMM_REUSE_DLC)); ((1 << RFCOMM_RELEASE_ONHUP) | (1 << RFCOMM_REUSE_DLC));
init_waitqueue_head(&dev->wait); init_waitqueue_head(&dev->wait);
@ -249,7 +249,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
dev->dlc = dlc; dev->dlc = dlc;
rfcomm_dlc_unlock(dlc); rfcomm_dlc_unlock(dlc);
/* It's safe to call __module_get() here because socket already /* It's safe to call __module_get() here because socket already
holds reference to this module. */ holds reference to this module. */
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
@ -487,7 +487,7 @@ static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb)
{ {
struct rfcomm_dev *dev = dlc->owner; struct rfcomm_dev *dev = dlc->owner;
struct tty_struct *tty; struct tty_struct *tty;
if (!dev || !(tty = dev->tty)) { if (!dev || !(tty = dev->tty)) {
kfree_skb(skb); kfree_skb(skb);
return; return;
@ -506,7 +506,7 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err)
struct rfcomm_dev *dev = dlc->owner; struct rfcomm_dev *dev = dlc->owner;
if (!dev) if (!dev)
return; return;
BT_DBG("dlc %p dev %p err %d", dlc, dev, err); BT_DBG("dlc %p dev %p err %d", dlc, dev, err);
dev->err = err; dev->err = err;
@ -525,7 +525,7 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err)
rfcomm_dev_put(dev); rfcomm_dev_put(dev);
rfcomm_dlc_lock(dlc); rfcomm_dlc_lock(dlc);
} }
} else } else
tty_hangup(dev->tty); tty_hangup(dev->tty);
} }
} }
@ -543,7 +543,7 @@ static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig)
tty_hangup(dev->tty); tty_hangup(dev->tty);
} }
dev->modem_status = dev->modem_status =
((v24_sig & RFCOMM_V24_RTC) ? (TIOCM_DSR | TIOCM_DTR) : 0) | ((v24_sig & RFCOMM_V24_RTC) ? (TIOCM_DSR | TIOCM_DTR) : 0) |
((v24_sig & RFCOMM_V24_RTR) ? (TIOCM_RTS | TIOCM_CTS) : 0) | ((v24_sig & RFCOMM_V24_RTR) ? (TIOCM_RTS | TIOCM_CTS) : 0) |
((v24_sig & RFCOMM_V24_IC) ? TIOCM_RI : 0) | ((v24_sig & RFCOMM_V24_IC) ? TIOCM_RI : 0) |
@ -561,7 +561,7 @@ static void rfcomm_tty_wakeup(unsigned long arg)
BT_DBG("dev %p tty %p", dev, tty); BT_DBG("dev %p tty %p", dev, tty);
if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && tty->ldisc.write_wakeup) if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && tty->ldisc.write_wakeup)
(tty->ldisc.write_wakeup)(tty); (tty->ldisc.write_wakeup)(tty);
wake_up_interruptible(&tty->write_wait); wake_up_interruptible(&tty->write_wait);
#ifdef SERIAL_HAVE_POLL_WAIT #ifdef SERIAL_HAVE_POLL_WAIT
@ -576,7 +576,7 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
struct rfcomm_dlc *dlc; struct rfcomm_dlc *dlc;
int err, id; int err, id;
id = tty->index; id = tty->index;
BT_DBG("tty %p id %d", tty, id); BT_DBG("tty %p id %d", tty, id);
@ -670,7 +670,7 @@ static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, in
size = min_t(uint, count, dlc->mtu); size = min_t(uint, count, dlc->mtu);
skb = rfcomm_wmalloc(dev, size + RFCOMM_SKB_RESERVE, GFP_ATOMIC); skb = rfcomm_wmalloc(dev, size + RFCOMM_SKB_RESERVE, GFP_ATOMIC);
if (!skb) if (!skb)
break; break;
@ -773,7 +773,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
return; return;
/* Handle turning off CRTSCTS */ /* Handle turning off CRTSCTS */
if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS)) if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS))
BT_DBG("Turning off CRTSCTS unsupported"); BT_DBG("Turning off CRTSCTS unsupported");
/* Parity on/off and when on, odd/even */ /* Parity on/off and when on, odd/even */
@ -830,7 +830,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
} }
/* Handle number of data bits [5-8] */ /* Handle number of data bits [5-8] */
if ((old->c_cflag & CSIZE) != (new->c_cflag & CSIZE)) if ((old->c_cflag & CSIZE) != (new->c_cflag & CSIZE))
changes |= RFCOMM_RPN_PM_DATA; changes |= RFCOMM_RPN_PM_DATA;
switch (new->c_cflag & CSIZE) { switch (new->c_cflag & CSIZE) {
@ -868,7 +868,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
case 9600: case 9600:
baud = RFCOMM_RPN_BR_9600; baud = RFCOMM_RPN_BR_9600;
break; break;
case 19200: case 19200:
baud = RFCOMM_RPN_BR_19200; baud = RFCOMM_RPN_BR_19200;
break; break;
case 38400: case 38400:
@ -887,7 +887,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
/* 9600 is standard accordinag to the RFCOMM specification */ /* 9600 is standard accordinag to the RFCOMM specification */
baud = RFCOMM_RPN_BR_9600; baud = RFCOMM_RPN_BR_9600;
break; break;
} }
if (changes) if (changes)
@ -978,11 +978,11 @@ static int rfcomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
static int rfcomm_tty_tiocmget(struct tty_struct *tty, struct file *filp) static int rfcomm_tty_tiocmget(struct tty_struct *tty, struct file *filp)
{ {
struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
BT_DBG("tty %p dev %p", tty, dev); BT_DBG("tty %p dev %p", tty, dev);
return dev->modem_status; return dev->modem_status;
} }
static int rfcomm_tty_tiocmset(struct tty_struct *tty, struct file *filp, unsigned int set, unsigned int clear) static int rfcomm_tty_tiocmset(struct tty_struct *tty, struct file *filp, unsigned int set, unsigned int clear)

View File

@ -1,4 +1,4 @@
/* /*
BlueZ - Bluetooth protocol stack for Linux BlueZ - Bluetooth protocol stack for Linux
Copyright (C) 2000-2001 Qualcomm Incorporated Copyright (C) 2000-2001 Qualcomm Incorporated
@ -12,13 +12,13 @@
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
SOFTWARE IS DISCLAIMED. SOFTWARE IS DISCLAIMED.
*/ */
@ -149,7 +149,7 @@ static int sco_conn_del(struct hci_conn *hcon, int err)
struct sco_conn *conn; struct sco_conn *conn;
struct sock *sk; struct sock *sk;
if (!(conn = hcon->sco_data)) if (!(conn = hcon->sco_data))
return 0; return 0;
BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); BT_DBG("hcon %p conn %p, err %d", hcon, conn, err);
@ -404,7 +404,7 @@ static void sco_sock_init(struct sock *sk, struct sock *parent)
{ {
BT_DBG("sk %p", sk); BT_DBG("sk %p", sk);
if (parent) if (parent)
sk->sk_type = parent->sk_type; sk->sk_type = parent->sk_type;
} }
@ -522,7 +522,7 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen
if ((err = sco_connect(sk))) if ((err = sco_connect(sk)))
goto done; goto done;
err = bt_sock_wait_state(sk, BT_CONNECTED, err = bt_sock_wait_state(sk, BT_CONNECTED,
sock_sndtimeo(sk, flags & O_NONBLOCK)); sock_sndtimeo(sk, flags & O_NONBLOCK));
done: done:
@ -627,7 +627,7 @@ static int sco_sock_getname(struct socket *sock, struct sockaddr *addr, int *len
return 0; return 0;
} }
static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock, static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len) struct msghdr *msg, size_t len)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
@ -677,7 +677,7 @@ static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct sco_options opts; struct sco_options opts;
struct sco_conninfo cinfo; struct sco_conninfo cinfo;
int len, err = 0; int len, err = 0;
BT_DBG("sk %p", sk); BT_DBG("sk %p", sk);
@ -761,7 +761,7 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk, struct sock *
bt_accept_enqueue(parent, sk); bt_accept_enqueue(parent, sk);
} }
/* Delete channel. /* Delete channel.
* Must be called on the locked socket. */ * Must be called on the locked socket. */
static void sco_chan_del(struct sock *sk, int err) static void sco_chan_del(struct sock *sk, int err)
{ {
@ -771,7 +771,7 @@ static void sco_chan_del(struct sock *sk, int err)
BT_DBG("sk %p, conn %p, err %d", sk, conn, err); BT_DBG("sk %p, conn %p, err %d", sk, conn, err);
if (conn) { if (conn) {
sco_conn_lock(conn); sco_conn_lock(conn);
conn->sk = NULL; conn->sk = NULL;
sco_pi(sk)->conn = NULL; sco_pi(sk)->conn = NULL;
@ -855,7 +855,7 @@ static int sco_connect_cfm(struct hci_conn *hcon, __u8 status)
conn = sco_conn_add(hcon, status); conn = sco_conn_add(hcon, status);
if (conn) if (conn)
sco_conn_ready(conn); sco_conn_ready(conn);
} else } else
sco_conn_del(hcon, bt_err(status)); sco_conn_del(hcon, bt_err(status));
return 0; return 0;
@ -887,7 +887,7 @@ static int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb)
} }
drop: drop:
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }

View File

@ -40,7 +40,7 @@ int br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
skb->mac.raw = skb->data; skb->mac.raw = skb->data;
skb_pull(skb, ETH_HLEN); skb_pull(skb, ETH_HLEN);
if (dest[0] & 1) if (dest[0] & 1)
br_flood_deliver(br, skb, 0); br_flood_deliver(br, skb, 0);
else if ((dst = __br_fdb_get(br, dest)) != NULL) else if ((dst = __br_fdb_get(br, dest)) != NULL)
br_deliver(dst->dst, skb); br_deliver(dst->dst, skb);
@ -178,12 +178,12 @@ void br_dev_setup(struct net_device *dev)
dev->change_mtu = br_change_mtu; dev->change_mtu = br_change_mtu;
dev->destructor = free_netdev; dev->destructor = free_netdev;
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
SET_ETHTOOL_OPS(dev, &br_ethtool_ops); SET_ETHTOOL_OPS(dev, &br_ethtool_ops);
dev->stop = br_dev_stop; dev->stop = br_dev_stop;
dev->tx_queue_len = 0; dev->tx_queue_len = 0;
dev->set_mac_address = br_set_mac_address; dev->set_mac_address = br_set_mac_address;
dev->priv_flags = IFF_EBRIDGE; dev->priv_flags = IFF_EBRIDGE;
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST; NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST;
} }

View File

@ -52,7 +52,7 @@ static __inline__ unsigned long hold_time(const struct net_bridge *br)
static __inline__ int has_expired(const struct net_bridge *br, static __inline__ int has_expired(const struct net_bridge *br,
const struct net_bridge_fdb_entry *fdb) const struct net_bridge_fdb_entry *fdb)
{ {
return !fdb->is_static return !fdb->is_static
&& time_before_eq(fdb->ageing_timer + hold_time(br), jiffies); && time_before_eq(fdb->ageing_timer + hold_time(br), jiffies);
} }
@ -71,7 +71,7 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
{ {
struct net_bridge *br = p->br; struct net_bridge *br = p->br;
int i; int i;
spin_lock_bh(&br->hash_lock); spin_lock_bh(&br->hash_lock);
/* Search all chains since old address/hash is unknown */ /* Search all chains since old address/hash is unknown */
@ -85,7 +85,7 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
/* maybe another port has same hw addr? */ /* maybe another port has same hw addr? */
struct net_bridge_port *op; struct net_bridge_port *op;
list_for_each_entry(op, &br->port_list, list) { list_for_each_entry(op, &br->port_list, list) {
if (op != p && if (op != p &&
!compare_ether_addr(op->dev->dev_addr, !compare_ether_addr(op->dev->dev_addr,
f->addr.addr)) { f->addr.addr)) {
f->dst = op; f->dst = op;
@ -118,8 +118,8 @@ void br_fdb_cleanup(unsigned long _data)
struct hlist_node *h, *n; struct hlist_node *h, *n;
hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) { hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) {
if (!f->is_static && if (!f->is_static &&
time_before_eq(f->ageing_timer + delay, jiffies)) time_before_eq(f->ageing_timer + delay, jiffies))
fdb_delete(f); fdb_delete(f);
} }
} }
@ -138,11 +138,11 @@ void br_fdb_delete_by_port(struct net_bridge *br,
spin_lock_bh(&br->hash_lock); spin_lock_bh(&br->hash_lock);
for (i = 0; i < BR_HASH_SIZE; i++) { for (i = 0; i < BR_HASH_SIZE; i++) {
struct hlist_node *h, *g; struct hlist_node *h, *g;
hlist_for_each_safe(h, g, &br->hash[i]) { hlist_for_each_safe(h, g, &br->hash[i]) {
struct net_bridge_fdb_entry *f struct net_bridge_fdb_entry *f
= hlist_entry(h, struct net_bridge_fdb_entry, hlist); = hlist_entry(h, struct net_bridge_fdb_entry, hlist);
if (f->dst != p) if (f->dst != p)
continue; continue;
if (f->is_static && !do_all) if (f->is_static && !do_all)
@ -155,7 +155,7 @@ void br_fdb_delete_by_port(struct net_bridge *br,
if (f->is_local) { if (f->is_local) {
struct net_bridge_port *op; struct net_bridge_port *op;
list_for_each_entry(op, &br->port_list, list) { list_for_each_entry(op, &br->port_list, list) {
if (op != p && if (op != p &&
!compare_ether_addr(op->dev->dev_addr, !compare_ether_addr(op->dev->dev_addr,
f->addr.addr)) { f->addr.addr)) {
f->dst = op; f->dst = op;
@ -190,14 +190,14 @@ struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
} }
/* Interface used by ATM hook that keeps a ref count */ /* Interface used by ATM hook that keeps a ref count */
struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
unsigned char *addr) unsigned char *addr)
{ {
struct net_bridge_fdb_entry *fdb; struct net_bridge_fdb_entry *fdb;
rcu_read_lock(); rcu_read_lock();
fdb = __br_fdb_get(br, addr); fdb = __br_fdb_get(br, addr);
if (fdb) if (fdb)
atomic_inc(&fdb->use_count); atomic_inc(&fdb->use_count);
rcu_read_unlock(); rcu_read_unlock();
return fdb; return fdb;
@ -218,7 +218,7 @@ void br_fdb_put(struct net_bridge_fdb_entry *ent)
} }
/* /*
* Fill buffer with forwarding table records in * Fill buffer with forwarding table records in
* the API format. * the API format.
*/ */
int br_fdb_fillbuf(struct net_bridge *br, void *buf, int br_fdb_fillbuf(struct net_bridge *br, void *buf,
@ -237,7 +237,7 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf,
if (num >= maxnum) if (num >= maxnum)
goto out; goto out;
if (has_expired(br, f)) if (has_expired(br, f))
continue; continue;
if (skip) { if (skip) {
@ -277,7 +277,7 @@ static inline struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head,
static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head, static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head,
struct net_bridge_port *source, struct net_bridge_port *source,
const unsigned char *addr, const unsigned char *addr,
int is_local) int is_local)
{ {
struct net_bridge_fdb_entry *fdb; struct net_bridge_fdb_entry *fdb;
@ -307,17 +307,17 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
fdb = fdb_find(head, addr); fdb = fdb_find(head, addr);
if (fdb) { if (fdb) {
/* it is okay to have multiple ports with same /* it is okay to have multiple ports with same
* address, just use the first one. * address, just use the first one.
*/ */
if (fdb->is_local) if (fdb->is_local)
return 0; return 0;
printk(KERN_WARNING "%s adding interface with same address " printk(KERN_WARNING "%s adding interface with same address "
"as a received packet\n", "as a received packet\n",
source->dev->name); source->dev->name);
fdb_delete(fdb); fdb_delete(fdb);
} }
if (!fdb_create(head, source, addr, 1)) if (!fdb_create(head, source, addr, 1))
return -ENOMEM; return -ENOMEM;
@ -350,7 +350,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
if (likely(fdb)) { if (likely(fdb)) {
/* attempt to update an entry for a local interface */ /* attempt to update an entry for a local interface */
if (unlikely(fdb->is_local)) { if (unlikely(fdb->is_local)) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "%s: received packet with " printk(KERN_WARNING "%s: received packet with "
" own address as source address\n", " own address as source address\n",
source->dev->name); source->dev->name);

View File

@ -21,7 +21,7 @@
#include "br_private.h" #include "br_private.h"
/* Don't forward packets to originating port or forwarding diasabled */ /* Don't forward packets to originating port or forwarding diasabled */
static inline int should_deliver(const struct net_bridge_port *p, static inline int should_deliver(const struct net_bridge_port *p,
const struct sk_buff *skb) const struct sk_buff *skb)
{ {
return (skb->dev != p->dev && p->state == BR_STATE_FORWARDING); return (skb->dev != p->dev && p->state == BR_STATE_FORWARDING);
@ -101,7 +101,7 @@ void br_forward(const struct net_bridge_port *to, struct sk_buff *skb)
/* called under bridge lock */ /* called under bridge lock */
static void br_flood(struct net_bridge *br, struct sk_buff *skb, int clone, static void br_flood(struct net_bridge *br, struct sk_buff *skb, int clone,
void (*__packet_hook)(const struct net_bridge_port *p, void (*__packet_hook)(const struct net_bridge_port *p,
struct sk_buff *skb)) struct sk_buff *skb))
{ {
struct net_bridge_port *p; struct net_bridge_port *p;

View File

@ -47,7 +47,7 @@ static int port_cost(struct net_device *dev)
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
err = dev_ethtool(&ifr); err = dev_ethtool(&ifr);
set_fs(old_fs); set_fs(old_fs);
if (!err) { if (!err) {
switch(ecmd.speed) { switch(ecmd.speed) {
case SPEED_100: case SPEED_100:
@ -191,7 +191,7 @@ static void del_br(struct net_bridge *br)
del_timer_sync(&br->gc_timer); del_timer_sync(&br->gc_timer);
br_sysfs_delbr(br->dev); br_sysfs_delbr(br->dev);
unregister_netdevice(br->dev); unregister_netdevice(br->dev);
} }
static struct net_device *new_bridge_dev(const char *name) static struct net_device *new_bridge_dev(const char *name)
@ -201,7 +201,7 @@ static struct net_device *new_bridge_dev(const char *name)
dev = alloc_netdev(sizeof(struct net_bridge), name, dev = alloc_netdev(sizeof(struct net_bridge), name,
br_dev_setup); br_dev_setup);
if (!dev) if (!dev)
return NULL; return NULL;
@ -258,12 +258,12 @@ static int find_portno(struct net_bridge *br)
} }
/* called with RTNL but without bridge lock */ /* called with RTNL but without bridge lock */
static struct net_bridge_port *new_nbp(struct net_bridge *br, static struct net_bridge_port *new_nbp(struct net_bridge *br,
struct net_device *dev) struct net_device *dev)
{ {
int index; int index;
struct net_bridge_port *p; struct net_bridge_port *p;
index = find_portno(br); index = find_portno(br);
if (index < 0) if (index < 0)
return ERR_PTR(index); return ERR_PTR(index);
@ -276,7 +276,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
dev_hold(dev); dev_hold(dev);
p->dev = dev; p->dev = dev;
p->path_cost = port_cost(dev); p->path_cost = port_cost(dev);
p->priority = 0x8000 >> BR_PORT_BITS; p->priority = 0x8000 >> BR_PORT_BITS;
p->port_no = index; p->port_no = index;
br_init_port(p); br_init_port(p);
p->state = BR_STATE_DISABLED; p->state = BR_STATE_DISABLED;
@ -298,7 +298,7 @@ int br_add_bridge(const char *name)
int ret; int ret;
dev = new_bridge_dev(name); dev = new_bridge_dev(name);
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
rtnl_lock(); rtnl_lock();
@ -329,7 +329,7 @@ int br_del_bridge(const char *name)
rtnl_lock(); rtnl_lock();
dev = __dev_get_by_name(name); dev = __dev_get_by_name(name);
if (dev == NULL) if (dev == NULL)
ret = -ENXIO; /* Could not find device */ ret = -ENXIO; /* Could not find device */
else if (!(dev->priv_flags & IFF_EBRIDGE)) { else if (!(dev->priv_flags & IFF_EBRIDGE)) {
@ -340,9 +340,9 @@ int br_del_bridge(const char *name)
else if (dev->flags & IFF_UP) { else if (dev->flags & IFF_UP) {
/* Not shutdown yet. */ /* Not shutdown yet. */
ret = -EBUSY; ret = -EBUSY;
} }
else else
del_br(netdev_priv(dev)); del_br(netdev_priv(dev));
rtnl_unlock(); rtnl_unlock();
@ -428,7 +428,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
if (err) if (err)
goto err0; goto err0;
err = br_fdb_insert(br, p, dev->dev_addr); err = br_fdb_insert(br, p, dev->dev_addr);
if (err) if (err)
goto err1; goto err1;
@ -464,8 +464,8 @@ err0:
int br_del_if(struct net_bridge *br, struct net_device *dev) int br_del_if(struct net_bridge *br, struct net_device *dev)
{ {
struct net_bridge_port *p = dev->br_port; struct net_bridge_port *p = dev->br_port;
if (!p || p->br != br) if (!p || p->br != br)
return -EINVAL; return -EINVAL;
del_nbp(p); del_nbp(p);

View File

@ -119,7 +119,7 @@ static inline int is_link_local(const unsigned char *dest)
* Called via br_handle_frame_hook. * Called via br_handle_frame_hook.
* Return 0 if *pskb should be processed furthur * Return 0 if *pskb should be processed furthur
* 1 if *pskb is handled * 1 if *pskb is handled
* note: already called with rcu_read_lock (preempt_disabled) * note: already called with rcu_read_lock (preempt_disabled)
*/ */
int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb) int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
{ {
@ -137,7 +137,7 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
if (p->state == BR_STATE_FORWARDING || p->state == BR_STATE_LEARNING) { if (p->state == BR_STATE_FORWARDING || p->state == BR_STATE_LEARNING) {
if (br_should_route_hook) { if (br_should_route_hook) {
if (br_should_route_hook(pskb)) if (br_should_route_hook(pskb))
return 0; return 0;
skb = *pskb; skb = *pskb;
dest = eth_hdr(skb)->h_dest; dest = eth_hdr(skb)->h_dest;

View File

@ -28,7 +28,7 @@ static int get_bridge_ifindices(int *indices, int num)
int i = 0; int i = 0;
for (dev = dev_base; dev && i < num; dev = dev->next) { for (dev = dev_base; dev && i < num; dev = dev->next) {
if (dev->priv_flags & IFF_EBRIDGE) if (dev->priv_flags & IFF_EBRIDGE)
indices[i++] = dev->ifindex; indices[i++] = dev->ifindex;
} }
@ -53,7 +53,7 @@ static void get_port_ifindices(struct net_bridge *br, int *ifindices, int num)
* (limited to a page for sanity) * (limited to a page for sanity)
* offset -- number of records to skip * offset -- number of records to skip
*/ */
static int get_fdb_entries(struct net_bridge *br, void __user *userbuf, static int get_fdb_entries(struct net_bridge *br, void __user *userbuf,
unsigned long maxnum, unsigned long offset) unsigned long maxnum, unsigned long offset)
{ {
int num; int num;
@ -69,7 +69,7 @@ static int get_fdb_entries(struct net_bridge *br, void __user *userbuf,
buf = kmalloc(size, GFP_USER); buf = kmalloc(size, GFP_USER);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
num = br_fdb_fillbuf(br, buf, maxnum, offset); num = br_fdb_fillbuf(br, buf, maxnum, offset);
if (num > 0) { if (num > 0) {
if (copy_to_user(userbuf, buf, num*sizeof(struct __fdb_entry))) if (copy_to_user(userbuf, buf, num*sizeof(struct __fdb_entry)))
@ -91,7 +91,7 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
dev = dev_get_by_index(ifindex); dev = dev_get_by_index(ifindex);
if (dev == NULL) if (dev == NULL)
return -EINVAL; return -EINVAL;
if (isadd) if (isadd)
ret = br_add_if(br, dev); ret = br_add_if(br, dev);
else else
@ -110,7 +110,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ {
struct net_bridge *br = netdev_priv(dev); struct net_bridge *br = netdev_priv(dev);
unsigned long args[4]; unsigned long args[4];
if (copy_from_user(args, rq->ifr_data, sizeof(args))) if (copy_from_user(args, rq->ifr_data, sizeof(args)))
return -EFAULT; return -EFAULT;
@ -143,7 +143,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
b.tcn_timer_value = br_timer_value(&br->tcn_timer); b.tcn_timer_value = br_timer_value(&br->tcn_timer);
b.topology_change_timer_value = br_timer_value(&br->topology_change_timer); b.topology_change_timer_value = br_timer_value(&br->topology_change_timer);
b.gc_timer_value = br_timer_value(&br->gc_timer); b.gc_timer_value = br_timer_value(&br->gc_timer);
rcu_read_unlock(); rcu_read_unlock();
if (copy_to_user((void __user *)args[1], &b, sizeof(b))) if (copy_to_user((void __user *)args[1], &b, sizeof(b)))
return -EFAULT; return -EFAULT;
@ -275,7 +275,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
return -ERANGE; return -ERANGE;
spin_lock_bh(&br->lock); spin_lock_bh(&br->lock);
if ((p = br_get_port(br, args[1])) == NULL) if ((p = br_get_port(br, args[1])) == NULL)
ret = -EINVAL; ret = -EINVAL;
else else
br_stp_set_port_priority(p, args[2]); br_stp_set_port_priority(p, args[2]);
@ -301,7 +301,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
} }
case BRCTL_GET_FDB_ENTRIES: case BRCTL_GET_FDB_ENTRIES:
return get_fdb_entries(br, (void __user *)args[1], return get_fdb_entries(br, (void __user *)args[1],
args[2], args[3]); args[2], args[3]);
} }
@ -368,7 +368,7 @@ int br_ioctl_deviceless_stub(unsigned int cmd, void __user *uarg)
case SIOCGIFBR: case SIOCGIFBR:
case SIOCSIFBR: case SIOCSIFBR:
return old_deviceless(uarg); return old_deviceless(uarg);
case SIOCBRADDBR: case SIOCBRADDBR:
case SIOCBRDELBR: case SIOCBRDELBR:
{ {

View File

@ -68,7 +68,7 @@ static __be16 inline vlan_proto(const struct sk_buff *skb)
#define IS_VLAN_IP(skb) \ #define IS_VLAN_IP(skb) \
(skb->protocol == htons(ETH_P_8021Q) && \ (skb->protocol == htons(ETH_P_8021Q) && \
vlan_proto(skb) == htons(ETH_P_IP) && \ vlan_proto(skb) == htons(ETH_P_IP) && \
brnf_filter_vlan_tagged) brnf_filter_vlan_tagged)
#define IS_VLAN_IPV6(skb) \ #define IS_VLAN_IPV6(skb) \
@ -124,7 +124,7 @@ static inline struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb)
static inline void nf_bridge_save_header(struct sk_buff *skb) static inline void nf_bridge_save_header(struct sk_buff *skb)
{ {
int header_size = ETH_HLEN; int header_size = ETH_HLEN;
if (skb->protocol == htons(ETH_P_8021Q)) if (skb->protocol == htons(ETH_P_8021Q))
header_size += VLAN_HLEN; header_size += VLAN_HLEN;
@ -139,7 +139,7 @@ static inline void nf_bridge_save_header(struct sk_buff *skb)
int nf_bridge_copy_header(struct sk_buff *skb) int nf_bridge_copy_header(struct sk_buff *skb)
{ {
int err; int err;
int header_size = ETH_HLEN; int header_size = ETH_HLEN;
if (skb->protocol == htons(ETH_P_8021Q)) if (skb->protocol == htons(ETH_P_8021Q))
header_size += VLAN_HLEN; header_size += VLAN_HLEN;
@ -836,10 +836,10 @@ static unsigned int ip_sabotage_in(unsigned int hook, struct sk_buff **pskb,
* For br_nf_post_routing, we need (prio = NF_BR_PRI_LAST), because * For br_nf_post_routing, we need (prio = NF_BR_PRI_LAST), because
* ip_refrag() can return NF_STOLEN. */ * ip_refrag() can return NF_STOLEN. */
static struct nf_hook_ops br_nf_ops[] = { static struct nf_hook_ops br_nf_ops[] = {
{ .hook = br_nf_pre_routing, { .hook = br_nf_pre_routing,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pf = PF_BRIDGE, .pf = PF_BRIDGE,
.hooknum = NF_BR_PRE_ROUTING, .hooknum = NF_BR_PRE_ROUTING,
.priority = NF_BR_PRI_BRNF, }, .priority = NF_BR_PRI_BRNF, },
{ .hook = br_nf_local_in, { .hook = br_nf_local_in,
.owner = THIS_MODULE, .owner = THIS_MODULE,

View File

@ -26,7 +26,7 @@ struct notifier_block br_device_notifier = {
/* /*
* Handle changes in state of network devices enslaved to a bridge. * Handle changes in state of network devices enslaved to a bridge.
* *
* Note: don't care about up/down if bridge itself is down, because * Note: don't care about up/down if bridge itself is down, because
* port state is checked when bridge is brought up. * port state is checked when bridge is brought up.
*/ */
@ -60,11 +60,11 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
break; break;
case NETDEV_FEAT_CHANGE: case NETDEV_FEAT_CHANGE:
if (br->dev->flags & IFF_UP) if (br->dev->flags & IFF_UP)
br_features_recompute(br); br_features_recompute(br);
/* could do recursive feature change notification /* could do recursive feature change notification
* but who would care?? * but who would care??
*/ */
break; break;
@ -74,7 +74,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
break; break;
case NETDEV_UP: case NETDEV_UP:
if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP))
br_stp_enable_port(p); br_stp_enable_port(p);
break; break;
@ -82,7 +82,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
spin_unlock_bh(&br->lock); spin_unlock_bh(&br->lock);
br_del_if(br, dev); br_del_if(br, dev);
goto done; goto done;
} }
spin_unlock_bh(&br->lock); spin_unlock_bh(&br->lock);
done: done:

View File

@ -149,7 +149,7 @@ extern struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
unsigned char *addr); unsigned char *addr);
extern void br_fdb_put(struct net_bridge_fdb_entry *ent); extern void br_fdb_put(struct net_bridge_fdb_entry *ent);
extern int br_fdb_fillbuf(struct net_bridge *br, void *buf, extern int br_fdb_fillbuf(struct net_bridge *br, void *buf,
unsigned long count, unsigned long off); unsigned long count, unsigned long off);
extern int br_fdb_insert(struct net_bridge *br, extern int br_fdb_insert(struct net_bridge *br,
struct net_bridge_port *source, struct net_bridge_port *source,
@ -203,7 +203,7 @@ extern void br_netfilter_fini(void);
/* br_stp.c */ /* br_stp.c */
extern void br_log_state(const struct net_bridge_port *p); extern void br_log_state(const struct net_bridge_port *p);
extern struct net_bridge_port *br_get_port(struct net_bridge *br, extern struct net_bridge_port *br_get_port(struct net_bridge *br,
u16 port_no); u16 port_no);
extern void br_init_port(struct net_bridge_port *p); extern void br_init_port(struct net_bridge_port *p);
extern void br_become_designated_port(struct net_bridge_port *p); extern void br_become_designated_port(struct net_bridge_port *p);

View File

@ -24,17 +24,17 @@
#define MESSAGE_AGE_INCR ((HZ < 256) ? 1 : (HZ/256)) #define MESSAGE_AGE_INCR ((HZ < 256) ? 1 : (HZ/256))
static const char *br_port_state_names[] = { static const char *br_port_state_names[] = {
[BR_STATE_DISABLED] = "disabled", [BR_STATE_DISABLED] = "disabled",
[BR_STATE_LISTENING] = "listening", [BR_STATE_LISTENING] = "listening",
[BR_STATE_LEARNING] = "learning", [BR_STATE_LEARNING] = "learning",
[BR_STATE_FORWARDING] = "forwarding", [BR_STATE_FORWARDING] = "forwarding",
[BR_STATE_BLOCKING] = "blocking", [BR_STATE_BLOCKING] = "blocking",
}; };
void br_log_state(const struct net_bridge_port *p) void br_log_state(const struct net_bridge_port *p)
{ {
pr_info("%s: port %d(%s) entering %s state\n", pr_info("%s: port %d(%s) entering %s state\n",
p->br->dev->name, p->port_no, p->dev->name, p->br->dev->name, p->port_no, p->dev->name,
br_port_state_names[p->state]); br_port_state_names[p->state]);
} }
@ -53,7 +53,7 @@ struct net_bridge_port *br_get_port(struct net_bridge *br, u16 port_no)
} }
/* called under bridge lock */ /* called under bridge lock */
static int br_should_become_root_port(const struct net_bridge_port *p, static int br_should_become_root_port(const struct net_bridge_port *p,
u16 root_port) u16 root_port)
{ {
struct net_bridge *br; struct net_bridge *br;
@ -184,7 +184,7 @@ void br_transmit_config(struct net_bridge_port *p)
} }
/* called under bridge lock */ /* called under bridge lock */
static inline void br_record_config_information(struct net_bridge_port *p, static inline void br_record_config_information(struct net_bridge_port *p,
const struct br_config_bpdu *bpdu) const struct br_config_bpdu *bpdu)
{ {
p->designated_root = bpdu->root; p->designated_root = bpdu->root;
@ -192,12 +192,12 @@ static inline void br_record_config_information(struct net_bridge_port *p,
p->designated_bridge = bpdu->bridge_id; p->designated_bridge = bpdu->bridge_id;
p->designated_port = bpdu->port_id; p->designated_port = bpdu->port_id;
mod_timer(&p->message_age_timer, jiffies mod_timer(&p->message_age_timer, jiffies
+ (p->br->max_age - bpdu->message_age)); + (p->br->max_age - bpdu->message_age));
} }
/* called under bridge lock */ /* called under bridge lock */
static inline void br_record_config_timeout_values(struct net_bridge *br, static inline void br_record_config_timeout_values(struct net_bridge *br,
const struct br_config_bpdu *bpdu) const struct br_config_bpdu *bpdu)
{ {
br->max_age = bpdu->max_age; br->max_age = bpdu->max_age;
@ -415,7 +415,7 @@ void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *b
{ {
struct net_bridge *br; struct net_bridge *br;
int was_root; int was_root;
br = p->br; br = p->br;
was_root = br_is_root_bridge(br); was_root = br_is_root_bridge(br);
@ -430,7 +430,7 @@ void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *b
del_timer(&br->topology_change_timer); del_timer(&br->topology_change_timer);
br_transmit_tcn(br); br_transmit_tcn(br);
mod_timer(&br->tcn_timer, mod_timer(&br->tcn_timer,
jiffies + br->bridge_hello_time); jiffies + br->bridge_hello_time);
} }
} }
@ -441,8 +441,8 @@ void br_received_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *b
if (bpdu->topology_change_ack) if (bpdu->topology_change_ack)
br_topology_change_acknowledged(br); br_topology_change_acknowledged(br);
} }
} else if (br_is_designated_port(p)) { } else if (br_is_designated_port(p)) {
br_reply(p); br_reply(p);
} }
} }

View File

@ -29,7 +29,7 @@
#define LLC_RESERVE sizeof(struct llc_pdu_un) #define LLC_RESERVE sizeof(struct llc_pdu_un)
static void br_send_bpdu(struct net_bridge_port *p, static void br_send_bpdu(struct net_bridge_port *p,
const unsigned char *data, int length) const unsigned char *data, int length)
{ {
struct sk_buff *skb; struct sk_buff *skb;

View File

@ -28,7 +28,7 @@
*/ */
static inline port_id br_make_port_id(__u8 priority, __u16 port_no) static inline port_id br_make_port_id(__u8 priority, __u16 port_no)
{ {
return ((u16)priority << BR_PORT_BITS) return ((u16)priority << BR_PORT_BITS)
| (port_no & ((1<<BR_PORT_BITS)-1)); | (port_no & ((1<<BR_PORT_BITS)-1));
} }
@ -50,7 +50,7 @@ void br_stp_enable_bridge(struct net_bridge *br)
spin_lock_bh(&br->lock); spin_lock_bh(&br->lock);
mod_timer(&br->hello_timer, jiffies + br->hello_time); mod_timer(&br->hello_timer, jiffies + br->hello_time);
mod_timer(&br->gc_timer, jiffies + HZ/10); mod_timer(&br->gc_timer, jiffies + HZ/10);
br_config_bpdu_generation(br); br_config_bpdu_generation(br);
list_for_each_entry(p, &br->port_list, list) { list_for_each_entry(p, &br->port_list, list) {

View File

@ -27,7 +27,7 @@ static int br_is_designated_for_some_port(const struct net_bridge *br)
list_for_each_entry(p, &br->port_list, list) { list_for_each_entry(p, &br->port_list, list) {
if (p->state != BR_STATE_DISABLED && if (p->state != BR_STATE_DISABLED &&
!memcmp(&p->designated_bridge, &br->bridge_id, 8)) !memcmp(&p->designated_bridge, &br->bridge_id, 8))
return 1; return 1;
} }
@ -37,7 +37,7 @@ static int br_is_designated_for_some_port(const struct net_bridge *br)
static void br_hello_timer_expired(unsigned long arg) static void br_hello_timer_expired(unsigned long arg)
{ {
struct net_bridge *br = (struct net_bridge *)arg; struct net_bridge *br = (struct net_bridge *)arg;
pr_debug("%s: hello timer expired\n", br->dev->name); pr_debug("%s: hello timer expired\n", br->dev->name);
spin_lock(&br->lock); spin_lock(&br->lock);
if (br->dev->flags & IFF_UP) { if (br->dev->flags & IFF_UP) {
@ -58,11 +58,11 @@ static void br_message_age_timer_expired(unsigned long arg)
if (p->state == BR_STATE_DISABLED) if (p->state == BR_STATE_DISABLED)
return; return;
pr_info("%s: neighbor %.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x lost on port %d(%s)\n", pr_info("%s: neighbor %.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x lost on port %d(%s)\n",
br->dev->name, br->dev->name,
id->prio[0], id->prio[1], id->prio[0], id->prio[1],
id->addr[0], id->addr[1], id->addr[2], id->addr[0], id->addr[1], id->addr[2],
id->addr[3], id->addr[4], id->addr[5], id->addr[3], id->addr[4], id->addr[5],
p->port_no, p->dev->name); p->port_no, p->dev->name);
@ -114,7 +114,7 @@ static void br_tcn_timer_expired(unsigned long arg)
spin_lock(&br->lock); spin_lock(&br->lock);
if (br->dev->flags & IFF_UP) { if (br->dev->flags & IFF_UP) {
br_transmit_tcn(br); br_transmit_tcn(br);
mod_timer(&br->tcn_timer,jiffies + br->bridge_hello_time); mod_timer(&br->tcn_timer,jiffies + br->bridge_hello_time);
} }
spin_unlock(&br->lock); spin_unlock(&br->lock);
@ -135,7 +135,7 @@ static void br_hold_timer_expired(unsigned long arg)
{ {
struct net_bridge_port *p = (struct net_bridge_port *) arg; struct net_bridge_port *p = (struct net_bridge_port *) arg;
pr_debug("%s: %d(%s) hold timer expired\n", pr_debug("%s: %d(%s) hold timer expired\n",
p->br->dev->name, p->port_no, p->dev->name); p->br->dev->name, p->port_no, p->dev->name);
spin_lock(&p->br->lock); spin_lock(&p->br->lock);
@ -166,10 +166,10 @@ void br_stp_port_timer_init(struct net_bridge_port *p)
setup_timer(&p->forward_delay_timer, br_forward_delay_timer_expired, setup_timer(&p->forward_delay_timer, br_forward_delay_timer_expired,
(unsigned long) p); (unsigned long) p);
setup_timer(&p->hold_timer, br_hold_timer_expired, setup_timer(&p->hold_timer, br_hold_timer_expired,
(unsigned long) p); (unsigned long) p);
} }
/* Report ticks left (in USER_HZ) used for API */ /* Report ticks left (in USER_HZ) used for API */
unsigned long br_timer_value(const struct timer_list *timer) unsigned long br_timer_value(const struct timer_list *timer)

View File

@ -353,19 +353,19 @@ static ssize_t brforward_read(struct kobject *kobj, char *buf,
if (off % sizeof(struct __fdb_entry) != 0) if (off % sizeof(struct __fdb_entry) != 0)
return -EINVAL; return -EINVAL;
n = br_fdb_fillbuf(br, buf, n = br_fdb_fillbuf(br, buf,
count / sizeof(struct __fdb_entry), count / sizeof(struct __fdb_entry),
off / sizeof(struct __fdb_entry)); off / sizeof(struct __fdb_entry));
if (n > 0) if (n > 0)
n *= sizeof(struct __fdb_entry); n *= sizeof(struct __fdb_entry);
return n; return n;
} }
static struct bin_attribute bridge_forward = { static struct bin_attribute bridge_forward = {
.attr = { .name = SYSFS_BRIDGE_FDB, .attr = { .name = SYSFS_BRIDGE_FDB,
.mode = S_IRUGO, .mode = S_IRUGO,
.owner = THIS_MODULE, }, .owner = THIS_MODULE, },
.read = brforward_read, .read = brforward_read,
}; };
@ -401,7 +401,7 @@ int br_sysfs_addbr(struct net_device *dev)
goto out2; goto out2;
} }
kobject_set_name(&br->ifobj, SYSFS_BRIDGE_PORT_SUBDIR); kobject_set_name(&br->ifobj, SYSFS_BRIDGE_PORT_SUBDIR);
br->ifobj.ktype = NULL; br->ifobj.ktype = NULL;
br->ifobj.kset = NULL; br->ifobj.kset = NULL;

View File

@ -5,7 +5,7 @@
* Chris Vitale csv@bluetail.com * Chris Vitale csv@bluetail.com
* *
* May 2003 * May 2003
* *
*/ */
#include <linux/netfilter_bridge/ebtables.h> #include <linux/netfilter_bridge/ebtables.h>
@ -20,7 +20,7 @@ static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *
__be16 type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type; __be16 type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type;
if (info->bitmask & EBT_802_3_SAP) { if (info->bitmask & EBT_802_3_SAP) {
if (FWINV(info->sap != hdr->llc.ui.ssap, EBT_802_3_SAP)) if (FWINV(info->sap != hdr->llc.ui.ssap, EBT_802_3_SAP))
return EBT_NOMATCH; return EBT_NOMATCH;
if (FWINV(info->sap != hdr->llc.ui.dsap, EBT_802_3_SAP)) if (FWINV(info->sap != hdr->llc.ui.dsap, EBT_802_3_SAP))
return EBT_NOMATCH; return EBT_NOMATCH;
@ -29,7 +29,7 @@ static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *
if (info->bitmask & EBT_802_3_TYPE) { if (info->bitmask & EBT_802_3_TYPE) {
if (!(hdr->llc.ui.dsap == CHECK_TYPE && hdr->llc.ui.ssap == CHECK_TYPE)) if (!(hdr->llc.ui.dsap == CHECK_TYPE && hdr->llc.ui.ssap == CHECK_TYPE))
return EBT_NOMATCH; return EBT_NOMATCH;
if (FWINV(info->type != type, EBT_802_3_TYPE)) if (FWINV(info->type != type, EBT_802_3_TYPE))
return EBT_NOMATCH; return EBT_NOMATCH;
} }

View File

@ -18,7 +18,7 @@ static int ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh,
const char *mac, __be32 ip) const char *mac, __be32 ip)
{ {
/* You may be puzzled as to how this code works. /* You may be puzzled as to how this code works.
* Some tricks were used, refer to * Some tricks were used, refer to
* include/linux/netfilter_bridge/ebt_among.h * include/linux/netfilter_bridge/ebt_among.h
* as there you can find a solution of this mystery. * as there you can find a solution of this mystery.
*/ */
@ -207,8 +207,8 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask,
} }
static struct ebt_match filter_among = { static struct ebt_match filter_among = {
.name = EBT_AMONG_MATCH, .name = EBT_AMONG_MATCH,
.match = ebt_filter_among, .match = ebt_filter_among,
.check = ebt_among_check, .check = ebt_among_check,
.me = THIS_MODULE, .me = THIS_MODULE,
}; };

View File

@ -51,7 +51,7 @@ static int ebt_target_reply(struct sk_buff **pskb, unsigned int hooknr,
return EBT_DROP; return EBT_DROP;
arp_send(ARPOP_REPLY, ETH_P_ARP, *siptr, (struct net_device *)in, arp_send(ARPOP_REPLY, ETH_P_ARP, *siptr, (struct net_device *)in,
*diptr, shp, info->mac, shp); *diptr, shp, info->mac, shp);
return info->target; return info->target;
} }

View File

@ -61,15 +61,15 @@ static int ebt_filter_ip(const struct sk_buff *skb, const struct net_device *in,
if (info->bitmask & EBT_IP_DPORT) { if (info->bitmask & EBT_IP_DPORT) {
u32 dst = ntohs(pptr->dst); u32 dst = ntohs(pptr->dst);
if (FWINV(dst < info->dport[0] || if (FWINV(dst < info->dport[0] ||
dst > info->dport[1], dst > info->dport[1],
EBT_IP_DPORT)) EBT_IP_DPORT))
return EBT_NOMATCH; return EBT_NOMATCH;
} }
if (info->bitmask & EBT_IP_SPORT) { if (info->bitmask & EBT_IP_SPORT) {
u32 src = ntohs(pptr->src); u32 src = ntohs(pptr->src);
if (FWINV(src < info->sport[0] || if (FWINV(src < info->sport[0] ||
src > info->sport[1], src > info->sport[1],
EBT_IP_SPORT)) EBT_IP_SPORT))
return EBT_NOMATCH; return EBT_NOMATCH;
} }
} }

View File

@ -169,10 +169,10 @@ static void ebt_log(const struct sk_buff *skb, unsigned int hooknr,
if (info->bitmask & EBT_LOG_NFLOG) if (info->bitmask & EBT_LOG_NFLOG)
nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, nf_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li,
"%s", info->prefix); "%s", info->prefix);
else else
ebt_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li, ebt_log_packet(PF_BRIDGE, hooknr, skb, in, out, &li,
info->prefix); info->prefix);
} }
static struct ebt_watcher log = static struct ebt_watcher log =
@ -199,7 +199,7 @@ static int __init ebt_log_init(void)
if (nf_log_register(PF_BRIDGE, &ebt_log_logger) < 0) { if (nf_log_register(PF_BRIDGE, &ebt_log_logger) < 0) {
printk(KERN_WARNING "ebt_log: not logging via system console " printk(KERN_WARNING "ebt_log: not logging via system console "
"since somebody else already registered for PF_INET\n"); "since somebody else already registered for PF_INET\n");
/* we cannot make module load fail here, since otherwise /* we cannot make module load fail here, since otherwise
* ebtables userspace would abort */ * ebtables userspace would abort */
} }

View File

@ -26,7 +26,7 @@ static int ebt_filter_mark(const struct sk_buff *skb,
static int ebt_mark_check(const char *tablename, unsigned int hookmask, static int ebt_mark_check(const char *tablename, unsigned int hookmask,
const struct ebt_entry *e, void *data, unsigned int datalen) const struct ebt_entry *e, void *data, unsigned int datalen)
{ {
struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data; struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data;
if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_m_info))) if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_m_info)))
return -EINVAL; return -EINVAL;

View File

@ -62,7 +62,7 @@ static int ebt_filter_config(struct ebt_stp_info *info,
verdict = 0; verdict = 0;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
verdict |= (stpc->root[2+i] ^ c->root_addr[i]) & verdict |= (stpc->root[2+i] ^ c->root_addr[i]) &
c->root_addrmsk[i]; c->root_addrmsk[i];
if (FWINV(verdict != 0, EBT_STP_ROOTADDR)) if (FWINV(verdict != 0, EBT_STP_ROOTADDR))
return EBT_NOMATCH; return EBT_NOMATCH;
} }
@ -82,7 +82,7 @@ static int ebt_filter_config(struct ebt_stp_info *info,
verdict = 0; verdict = 0;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
verdict |= (stpc->sender[2+i] ^ c->sender_addr[i]) & verdict |= (stpc->sender[2+i] ^ c->sender_addr[i]) &
c->sender_addrmsk[i]; c->sender_addrmsk[i];
if (FWINV(verdict != 0, EBT_STP_SENDERADDR)) if (FWINV(verdict != 0, EBT_STP_SENDERADDR))
return EBT_NOMATCH; return EBT_NOMATCH;
} }

View File

@ -10,8 +10,8 @@
* Based on ipt_ULOG.c, which is * Based on ipt_ULOG.c, which is
* (C) 2000-2002 by Harald Welte <laforge@netfilter.org> * (C) 2000-2002 by Harald Welte <laforge@netfilter.org>
* *
* This module accepts two parameters: * This module accepts two parameters:
* *
* nlbufsiz: * nlbufsiz:
* The parameter specifies how big the buffer for each netlink multicast * The parameter specifies how big the buffer for each netlink multicast
* group is. e.g. If you say nlbufsiz=8192, up to eight kb of packets will * group is. e.g. If you say nlbufsiz=8192, up to eight kb of packets will
@ -43,17 +43,17 @@
#include "../br_private.h" #include "../br_private.h"
#define PRINTR(format, args...) do { if (net_ratelimit()) \ #define PRINTR(format, args...) do { if (net_ratelimit()) \
printk(format , ## args); } while (0) printk(format , ## args); } while (0)
static unsigned int nlbufsiz = NLMSG_GOODSIZE; static unsigned int nlbufsiz = NLMSG_GOODSIZE;
module_param(nlbufsiz, uint, 0600); module_param(nlbufsiz, uint, 0600);
MODULE_PARM_DESC(nlbufsiz, "netlink buffer size (number of bytes) " MODULE_PARM_DESC(nlbufsiz, "netlink buffer size (number of bytes) "
"(defaults to 4096)"); "(defaults to 4096)");
static unsigned int flushtimeout = 10; static unsigned int flushtimeout = 10;
module_param(flushtimeout, uint, 0600); module_param(flushtimeout, uint, 0600);
MODULE_PARM_DESC(flushtimeout, "buffer flush timeout (hundredths ofa second) " MODULE_PARM_DESC(flushtimeout, "buffer flush timeout (hundredths ofa second) "
"(defaults to 10)"); "(defaults to 10)");
typedef struct { typedef struct {
unsigned int qlen; /* number of nlmsgs' in the skb */ unsigned int qlen; /* number of nlmsgs' in the skb */
@ -157,7 +157,7 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb,
} }
nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, 0, nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, 0,
size - NLMSG_ALIGN(sizeof(*nlh))); size - NLMSG_ALIGN(sizeof(*nlh)));
ub->qlen++; ub->qlen++;
pm = NLMSG_DATA(nlh); pm = NLMSG_DATA(nlh);
@ -302,7 +302,7 @@ static int __init ebt_ulog_init(void)
} }
ebtulognl = netlink_kernel_create(NETLINK_NFLOG, EBT_ULOG_MAXNLGROUPS, ebtulognl = netlink_kernel_create(NETLINK_NFLOG, EBT_ULOG_MAXNLGROUPS,
NULL, THIS_MODULE); NULL, THIS_MODULE);
if (!ebtulognl) if (!ebtulognl)
ret = -ENOMEM; ret = -ENOMEM;
else if ((ret = ebt_register_watcher(&ulog))) else if ((ret = ebt_register_watcher(&ulog)))
@ -344,4 +344,4 @@ module_exit(ebt_ulog_fini);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>"); MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>");
MODULE_DESCRIPTION("ebtables userspace logging module for bridged Ethernet" MODULE_DESCRIPTION("ebtables userspace logging module for bridged Ethernet"
" frames"); " frames");

View File

@ -128,9 +128,9 @@ ebt_check_vlan(const char *tablename,
/* Reserved VLAN ID (VID) values /* Reserved VLAN ID (VID) values
* ----------------------------- * -----------------------------
* 0 - The null VLAN ID. * 0 - The null VLAN ID.
* 1 - The default Port VID (PVID) * 1 - The default Port VID (PVID)
* 0x0FFF - Reserved for implementation use. * 0x0FFF - Reserved for implementation use.
* if_vlan.h: VLAN_GROUP_ARRAY_LEN 4096. */ * if_vlan.h: VLAN_GROUP_ARRAY_LEN 4096. */
if (GET_BITMASK(EBT_VLAN_ID)) { if (GET_BITMASK(EBT_VLAN_ID)) {
if (!!info->id) { /* if id!=0 => check vid range */ if (!!info->id) { /* if id!=0 => check vid range */
@ -141,7 +141,7 @@ ebt_check_vlan(const char *tablename,
return -EINVAL; return -EINVAL;
} }
/* Note: This is valid VLAN-tagged frame point. /* Note: This is valid VLAN-tagged frame point.
* Any value of user_priority are acceptable, * Any value of user_priority are acceptable,
* but should be ignored according to 802.1Q Std. * but should be ignored according to 802.1Q Std.
* So we just drop the prio flag. */ * So we just drop the prio flag. */
info->bitmask &= ~EBT_VLAN_PRIO; info->bitmask &= ~EBT_VLAN_PRIO;

View File

@ -51,10 +51,10 @@ static int check(const struct ebt_table_info *info, unsigned int valid_hooks)
} }
static struct ebt_table frame_filter = static struct ebt_table frame_filter =
{ {
.name = "filter", .name = "filter",
.table = &initial_table, .table = &initial_table,
.valid_hooks = FILTER_VALID_HOOKS, .valid_hooks = FILTER_VALID_HOOKS,
.lock = RW_LOCK_UNLOCKED, .lock = RW_LOCK_UNLOCKED,
.check = check, .check = check,
.me = THIS_MODULE, .me = THIS_MODULE,

View File

@ -33,10 +33,10 @@
#include "../br_private.h" #include "../br_private.h"
#define BUGPRINT(format, args...) printk("kernel msg: ebtables bug: please "\ #define BUGPRINT(format, args...) printk("kernel msg: ebtables bug: please "\
"report to author: "format, ## args) "report to author: "format, ## args)
/* #define BUGPRINT(format, args...) */ /* #define BUGPRINT(format, args...) */
#define MEMPRINT(format, args...) printk("kernel msg: ebtables "\ #define MEMPRINT(format, args...) printk("kernel msg: ebtables "\
": out of memory: "format, ## args) ": out of memory: "format, ## args)
/* #define MEMPRINT(format, args...) */ /* #define MEMPRINT(format, args...) */
@ -482,7 +482,7 @@ ebt_check_entry_size_and_hooks(struct ebt_entry *e,
as it said it has */ as it said it has */
if (*n != *cnt) { if (*n != *cnt) {
BUGPRINT("nentries does not equal the nr of entries " BUGPRINT("nentries does not equal the nr of entries "
"in the chain\n"); "in the chain\n");
return -EINVAL; return -EINVAL;
} }
if (((struct ebt_entries *)e)->policy != EBT_DROP && if (((struct ebt_entries *)e)->policy != EBT_DROP &&
@ -809,7 +809,7 @@ static int translate_table(char *name, struct ebt_table_info *newinfo)
i = 0; /* holds the expected nr. of entries for the chain */ i = 0; /* holds the expected nr. of entries for the chain */
j = 0; /* holds the up to now counted entries for the chain */ j = 0; /* holds the up to now counted entries for the chain */
k = 0; /* holds the total nr. of entries, should equal k = 0; /* holds the total nr. of entries, should equal
newinfo->nentries afterwards */ newinfo->nentries afterwards */
udc_cnt = 0; /* will hold the nr. of user defined chains (udc) */ udc_cnt = 0; /* will hold the nr. of user defined chains (udc) */
ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, ret = EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
ebt_check_entry_size_and_hooks, newinfo, ebt_check_entry_size_and_hooks, newinfo,
@ -820,7 +820,7 @@ static int translate_table(char *name, struct ebt_table_info *newinfo)
if (i != j) { if (i != j) {
BUGPRINT("nentries does not equal the nr of entries in the " BUGPRINT("nentries does not equal the nr of entries in the "
"(last) chain\n"); "(last) chain\n");
return -EINVAL; return -EINVAL;
} }
if (k != newinfo->nentries) { if (k != newinfo->nentries) {
@ -835,7 +835,7 @@ static int translate_table(char *name, struct ebt_table_info *newinfo)
if an error occurs */ if an error occurs */
newinfo->chainstack = newinfo->chainstack =
vmalloc((highest_possible_processor_id()+1) vmalloc((highest_possible_processor_id()+1)
* sizeof(*(newinfo->chainstack))); * sizeof(*(newinfo->chainstack)));
if (!newinfo->chainstack) if (!newinfo->chainstack)
return -ENOMEM; return -ENOMEM;
for_each_possible_cpu(i) { for_each_possible_cpu(i) {
@ -948,7 +948,7 @@ static int do_replace(void __user *user, unsigned int len)
if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter))
return -ENOMEM; return -ENOMEM;
countersize = COUNTER_OFFSET(tmp.nentries) * countersize = COUNTER_OFFSET(tmp.nentries) *
(highest_possible_processor_id()+1); (highest_possible_processor_id()+1);
newinfo = vmalloc(sizeof(*newinfo) + countersize); newinfo = vmalloc(sizeof(*newinfo) + countersize);
if (!newinfo) if (!newinfo)
@ -1350,7 +1350,7 @@ static inline int ebt_make_names(struct ebt_entry *e, char *base, char __user *u
hlp = ubase + (((char *)e + e->target_offset) - base); hlp = ubase + (((char *)e + e->target_offset) - base);
t = (struct ebt_entry_target *)(((char *)e) + e->target_offset); t = (struct ebt_entry_target *)(((char *)e) + e->target_offset);
ret = EBT_MATCH_ITERATE(e, ebt_make_matchname, base, ubase); ret = EBT_MATCH_ITERATE(e, ebt_make_matchname, base, ubase);
if (ret != 0) if (ret != 0)
return ret; return ret;

View File

@ -1,4 +1,4 @@
/* /*
* 32bit Socket syscall emulation. Based on arch/sparc64/kernel/sys_sparc32.c. * 32bit Socket syscall emulation. Based on arch/sparc64/kernel/sys_sparc32.c.
* *
* Copyright (C) 2000 VA Linux Co * Copyright (C) 2000 VA Linux Co
@ -8,7 +8,7 @@
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
* Copyright (C) 2000 Hewlett-Packard Co. * Copyright (C) 2000 Hewlett-Packard Co.
* Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com> * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com>
* Copyright (C) 2000,2001 Andi Kleen, SuSE Labs * Copyright (C) 2000,2001 Andi Kleen, SuSE Labs
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
@ -225,14 +225,14 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
return 0; /* XXX: return error? check spec. */ return 0; /* XXX: return error? check spec. */
} }
if (level == SOL_SOCKET && type == SO_TIMESTAMP) { if (level == SOL_SOCKET && type == SO_TIMESTAMP) {
struct timeval *tv = (struct timeval *)data; struct timeval *tv = (struct timeval *)data;
ctv.tv_sec = tv->tv_sec; ctv.tv_sec = tv->tv_sec;
ctv.tv_usec = tv->tv_usec; ctv.tv_usec = tv->tv_usec;
data = &ctv; data = &ctv;
len = sizeof(struct compat_timeval); len = sizeof(struct compat_timeval);
} }
cmlen = CMSG_COMPAT_LEN(len); cmlen = CMSG_COMPAT_LEN(len);
if(kmsg->msg_controllen < cmlen) { if(kmsg->msg_controllen < cmlen) {
kmsg->msg_flags |= MSG_CTRUNC; kmsg->msg_flags |= MSG_CTRUNC;
@ -419,7 +419,7 @@ static int do_set_attach_filter(struct socket *sock, int level, int optname,
char __user *optval, int optlen) char __user *optval, int optlen)
{ {
struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval; struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval;
struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog));
compat_uptr_t ptr; compat_uptr_t ptr;
u16 len; u16 len;
@ -610,14 +610,14 @@ asmlinkage long compat_sys_socketcall(int call, u32 __user *args)
int ret; int ret;
u32 a[6]; u32 a[6];
u32 a0, a1; u32 a0, a1;
if (call < SYS_SOCKET || call > SYS_RECVMSG) if (call < SYS_SOCKET || call > SYS_RECVMSG)
return -EINVAL; return -EINVAL;
if (copy_from_user(a, args, nas[call])) if (copy_from_user(a, args, nas[call]))
return -EFAULT; return -EFAULT;
a0 = a[0]; a0 = a[0];
a1 = a[1]; a1 = a[1];
switch(call) { switch(call) {
case SYS_SOCKET: case SYS_SOCKET:
ret = sys_socket(a0, a1, a[2]); ret = sys_socket(a0, a1, a[2]);

View File

@ -430,7 +430,7 @@ EXPORT_SYMBOL(__skb_checksum_complete);
* @skb: skbuff * @skb: skbuff
* @hlen: hardware length * @hlen: hardware length
* @iov: io vector * @iov: io vector
* *
* Caller _must_ check that skb will fit to this iovec. * Caller _must_ check that skb will fit to this iovec.
* *
* Returns: 0 - success. * Returns: 0 - success.

View File

@ -255,7 +255,7 @@ static int netdev_nit;
* is linked into kernel lists and may not be freed until it has been * is linked into kernel lists and may not be freed until it has been
* removed from the kernel lists. * removed from the kernel lists.
* *
* This call does not sleep therefore it can not * This call does not sleep therefore it can not
* guarantee all CPU's that are in middle of receiving packets * guarantee all CPU's that are in middle of receiving packets
* will see the new packet type (until the next received packet). * will see the new packet type (until the next received packet).
*/ */
@ -282,7 +282,7 @@ void dev_add_pack(struct packet_type *pt)
* Remove a protocol handler that was previously added to the kernel * Remove a protocol handler that was previously added to the kernel
* protocol handlers by dev_add_pack(). The passed &packet_type is removed * protocol handlers by dev_add_pack(). The passed &packet_type is removed
* from the kernel lists and can be freed or reused once this function * from the kernel lists and can be freed or reused once this function
* returns. * returns.
* *
* The packet type might still be in use by receivers * The packet type might still be in use by receivers
* and must not be freed until after all the CPU's have gone * and must not be freed until after all the CPU's have gone
@ -327,7 +327,7 @@ out:
void dev_remove_pack(struct packet_type *pt) void dev_remove_pack(struct packet_type *pt)
{ {
__dev_remove_pack(pt); __dev_remove_pack(pt);
synchronize_net(); synchronize_net();
} }
@ -607,7 +607,7 @@ EXPORT_SYMBOL(dev_getfirstbyhwtype);
* @mask: bitmask of bits in if_flags to check * @mask: bitmask of bits in if_flags to check
* *
* Search for any interface with the given flags. Returns NULL if a device * Search for any interface with the given flags. Returns NULL if a device
* is not found or a pointer to the device. The device returned has * is not found or a pointer to the device. The device returned has
* had a reference added and the pointer is safe until the user calls * had a reference added and the pointer is safe until the user calls
* dev_put to indicate they have finished with it. * dev_put to indicate they have finished with it.
*/ */
@ -802,7 +802,7 @@ void netdev_state_change(struct net_device *dev)
void dev_load(const char *name) void dev_load(const char *name)
{ {
struct net_device *dev; struct net_device *dev;
read_lock(&dev_base_lock); read_lock(&dev_base_lock);
dev = __dev_get_by_name(name); dev = __dev_get_by_name(name);
@ -860,7 +860,7 @@ int dev_open(struct net_device *dev)
clear_bit(__LINK_STATE_START, &dev->state); clear_bit(__LINK_STATE_START, &dev->state);
} }
/* /*
* If it went open OK then: * If it went open OK then:
*/ */
@ -964,7 +964,7 @@ int dev_close(struct net_device *dev)
* is returned on a failure. * is returned on a failure.
* *
* When registered all registration and up events are replayed * When registered all registration and up events are replayed
* to the new notifier to allow device to have a race free * to the new notifier to allow device to have a race free
* view of the network device list. * view of the network device list.
*/ */
@ -979,7 +979,7 @@ int register_netdevice_notifier(struct notifier_block *nb)
for (dev = dev_base; dev; dev = dev->next) { for (dev = dev_base; dev; dev = dev->next) {
nb->notifier_call(nb, NETDEV_REGISTER, dev); nb->notifier_call(nb, NETDEV_REGISTER, dev);
if (dev->flags & IFF_UP) if (dev->flags & IFF_UP)
nb->notifier_call(nb, NETDEV_UP, dev); nb->notifier_call(nb, NETDEV_UP, dev);
} }
} }
@ -1157,7 +1157,7 @@ void netif_device_attach(struct net_device *dev)
if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) && if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) &&
netif_running(dev)) { netif_running(dev)) {
netif_wake_queue(dev); netif_wake_queue(dev);
__netdev_watchdog_up(dev); __netdev_watchdog_up(dev);
} }
} }
EXPORT_SYMBOL(netif_device_attach); EXPORT_SYMBOL(netif_device_attach);
@ -1197,7 +1197,7 @@ int skb_checksum_help(struct sk_buff *skb)
out_set_summed: out_set_summed:
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
out: out:
return ret; return ret;
} }
@ -1258,7 +1258,7 @@ EXPORT_SYMBOL(skb_gso_segment);
void netdev_rx_csum_fault(struct net_device *dev) void netdev_rx_csum_fault(struct net_device *dev)
{ {
if (net_ratelimit()) { if (net_ratelimit()) {
printk(KERN_ERR "%s: hw csum failure.\n", printk(KERN_ERR "%s: hw csum failure.\n",
dev ? dev->name : "<unknown>"); dev ? dev->name : "<unknown>");
dump_stack(); dump_stack();
} }
@ -1372,7 +1372,7 @@ gso:
if (unlikely(netif_queue_stopped(dev) && skb->next)) if (unlikely(netif_queue_stopped(dev) && skb->next))
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} while (skb->next); } while (skb->next);
skb->destructor = DEV_GSO_CB(skb)->destructor; skb->destructor = DEV_GSO_CB(skb)->destructor;
out_kfree_skb: out_kfree_skb:
@ -1449,25 +1449,25 @@ int dev_queue_xmit(struct sk_buff *skb)
(!(dev->features & NETIF_F_GEN_CSUM) && (!(dev->features & NETIF_F_GEN_CSUM) &&
(!(dev->features & NETIF_F_IP_CSUM) || (!(dev->features & NETIF_F_IP_CSUM) ||
skb->protocol != htons(ETH_P_IP)))) skb->protocol != htons(ETH_P_IP))))
if (skb_checksum_help(skb)) if (skb_checksum_help(skb))
goto out_kfree_skb; goto out_kfree_skb;
gso: gso:
spin_lock_prefetch(&dev->queue_lock); spin_lock_prefetch(&dev->queue_lock);
/* Disable soft irqs for various locks below. Also /* Disable soft irqs for various locks below. Also
* stops preemption for RCU. * stops preemption for RCU.
*/ */
rcu_read_lock_bh(); rcu_read_lock_bh();
/* Updates of qdisc are serialized by queue_lock. /* Updates of qdisc are serialized by queue_lock.
* The struct Qdisc which is pointed to by qdisc is now a * The struct Qdisc which is pointed to by qdisc is now a
* rcu structure - it may be accessed without acquiring * rcu structure - it may be accessed without acquiring
* a lock (but the structure may be stale.) The freeing of the * a lock (but the structure may be stale.) The freeing of the
* qdisc will be deferred until it's known that there are no * qdisc will be deferred until it's known that there are no
* more references to it. * more references to it.
* *
* If the qdisc has an enqueue function, we still need to * If the qdisc has an enqueue function, we still need to
* hold the queue_lock before calling it, since queue_lock * hold the queue_lock before calling it, since queue_lock
* also serializes access to the device queue. * also serializes access to the device queue.
*/ */
@ -1715,8 +1715,8 @@ static __inline__ int handle_bridge(struct sk_buff **pskb,
if (*pt_prev) { if (*pt_prev) {
*ret = deliver_skb(*pskb, *pt_prev, orig_dev); *ret = deliver_skb(*pskb, *pt_prev, orig_dev);
*pt_prev = NULL; *pt_prev = NULL;
} }
return br_handle_frame_hook(port, pskb); return br_handle_frame_hook(port, pskb);
} }
#else #else
@ -1728,16 +1728,16 @@ static __inline__ int handle_bridge(struct sk_buff **pskb,
* when CONFIG_NET_CLS_ACT is? otherwise some useless instructions * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions
* a compare and 2 stores extra right now if we dont have it on * a compare and 2 stores extra right now if we dont have it on
* but have CONFIG_NET_CLS_ACT * but have CONFIG_NET_CLS_ACT
* NOTE: This doesnt stop any functionality; if you dont have * NOTE: This doesnt stop any functionality; if you dont have
* the ingress scheduler, you just cant add policies on ingress. * the ingress scheduler, you just cant add policies on ingress.
* *
*/ */
static int ing_filter(struct sk_buff *skb) static int ing_filter(struct sk_buff *skb)
{ {
struct Qdisc *q; struct Qdisc *q;
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
int result = TC_ACT_OK; int result = TC_ACT_OK;
if (dev->qdisc_ingress) { if (dev->qdisc_ingress) {
__u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd); __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd);
if (MAX_RED_LOOP < ttl++) { if (MAX_RED_LOOP < ttl++) {
@ -1801,7 +1801,7 @@ int netif_receive_skb(struct sk_buff *skb)
list_for_each_entry_rcu(ptype, &ptype_all, list) { list_for_each_entry_rcu(ptype, &ptype_all, list) {
if (!ptype->dev || ptype->dev == skb->dev) { if (!ptype->dev || ptype->dev == skb->dev) {
if (pt_prev) if (pt_prev)
ret = deliver_skb(skb, pt_prev, orig_dev); ret = deliver_skb(skb, pt_prev, orig_dev);
pt_prev = ptype; pt_prev = ptype;
} }
@ -1833,7 +1833,7 @@ ncls:
list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) { list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) {
if (ptype->type == type && if (ptype->type == type &&
(!ptype->dev || ptype->dev == skb->dev)) { (!ptype->dev || ptype->dev == skb->dev)) {
if (pt_prev) if (pt_prev)
ret = deliver_skb(skb, pt_prev, orig_dev); ret = deliver_skb(skb, pt_prev, orig_dev);
pt_prev = ptype; pt_prev = ptype;
} }
@ -2061,7 +2061,7 @@ static int dev_ifconf(char __user *arg)
total += done; total += done;
} }
} }
} }
/* /*
* All done. Write the updated control block back to the caller. * All done. Write the updated control block back to the caller.
@ -2154,7 +2154,7 @@ static struct netif_rx_stats *softnet_get_online(loff_t *pos)
struct netif_rx_stats *rc = NULL; struct netif_rx_stats *rc = NULL;
while (*pos < NR_CPUS) while (*pos < NR_CPUS)
if (cpu_online(*pos)) { if (cpu_online(*pos)) {
rc = &per_cpu(netdev_rx_stat, *pos); rc = &per_cpu(netdev_rx_stat, *pos);
break; break;
} else } else
@ -2282,7 +2282,7 @@ int netdev_set_master(struct net_device *slave, struct net_device *master)
} }
slave->master = master; slave->master = master;
synchronize_net(); synchronize_net();
if (old) if (old)
@ -2319,13 +2319,13 @@ void dev_set_promiscuity(struct net_device *dev, int inc)
dev_mc_upload(dev); dev_mc_upload(dev);
printk(KERN_INFO "device %s %s promiscuous mode\n", printk(KERN_INFO "device %s %s promiscuous mode\n",
dev->name, (dev->flags & IFF_PROMISC) ? "entered" : dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
"left"); "left");
audit_log(current->audit_context, GFP_ATOMIC, audit_log(current->audit_context, GFP_ATOMIC,
AUDIT_ANOM_PROMISCUOUS, AUDIT_ANOM_PROMISCUOUS,
"dev=%s prom=%d old_prom=%d auid=%u", "dev=%s prom=%d old_prom=%d auid=%u",
dev->name, (dev->flags & IFF_PROMISC), dev->name, (dev->flags & IFF_PROMISC),
(old_flags & IFF_PROMISC), (old_flags & IFF_PROMISC),
audit_get_loginuid(current->audit_context)); audit_get_loginuid(current->audit_context));
} }
} }
@ -2816,7 +2816,7 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
rtnl_unlock(); rtnl_unlock();
if (IW_IS_GET(cmd) && if (IW_IS_GET(cmd) &&
copy_to_user(arg, &ifr, copy_to_user(arg, &ifr,
sizeof(struct ifreq))) sizeof(struct ifreq)))
ret = -EFAULT; ret = -EFAULT;
return ret; return ret;
} }
@ -2906,7 +2906,7 @@ int register_netdevice(struct net_device *dev)
goto out; goto out;
} }
} }
if (!dev_valid_name(dev->name)) { if (!dev_valid_name(dev->name)) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
@ -2923,9 +2923,9 @@ int register_netdevice(struct net_device *dev)
= hlist_entry(p, struct net_device, name_hlist); = hlist_entry(p, struct net_device, name_hlist);
if (!strncmp(d->name, dev->name, IFNAMSIZ)) { if (!strncmp(d->name, dev->name, IFNAMSIZ)) {
ret = -EEXIST; ret = -EEXIST;
goto out; goto out;
} }
} }
/* Fix illegal SG+CSUM combinations. */ /* Fix illegal SG+CSUM combinations. */
if ((dev->features & NETIF_F_SG) && if ((dev->features & NETIF_F_SG) &&
@ -3024,7 +3024,7 @@ int register_netdev(struct net_device *dev)
if (err < 0) if (err < 0)
goto out; goto out;
} }
err = register_netdevice(dev); err = register_netdevice(dev);
out: out:
rtnl_unlock(); rtnl_unlock();
@ -3041,7 +3041,7 @@ EXPORT_SYMBOL(register_netdev);
* for netdevice notification, and cleanup and put back the * for netdevice notification, and cleanup and put back the
* reference if they receive an UNREGISTER event. * reference if they receive an UNREGISTER event.
* We can get stuck here if buggy protocols don't correctly * We can get stuck here if buggy protocols don't correctly
* call dev_put. * call dev_put.
*/ */
static void netdev_wait_allrefs(struct net_device *dev) static void netdev_wait_allrefs(struct net_device *dev)
{ {
@ -3205,8 +3205,8 @@ EXPORT_SYMBOL(alloc_netdev);
* free_netdev - free network device * free_netdev - free network device
* @dev: device * @dev: device
* *
* This function does the last stage of destroying an allocated device * This function does the last stage of destroying an allocated device
* interface. The reference to the device object is released. * interface. The reference to the device object is released.
* If this is the last reference then it will be freed. * If this is the last reference then it will be freed.
*/ */
void free_netdev(struct net_device *dev) void free_netdev(struct net_device *dev)
@ -3227,9 +3227,9 @@ void free_netdev(struct net_device *dev)
kfree((char *)dev - dev->padded); kfree((char *)dev - dev->padded);
#endif #endif
} }
/* Synchronize with packet receive processing. */ /* Synchronize with packet receive processing. */
void synchronize_net(void) void synchronize_net(void)
{ {
might_sleep(); might_sleep();
synchronize_rcu(); synchronize_rcu();
@ -3291,12 +3291,12 @@ void unregister_netdevice(struct net_device *dev)
/* Shutdown queueing discipline. */ /* Shutdown queueing discipline. */
dev_shutdown(dev); dev_shutdown(dev);
/* Notify protocols, that we are about to destroy /* Notify protocols, that we are about to destroy
this device. They should clean all the things. this device. They should clean all the things.
*/ */
raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev); raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev);
/* /*
* Flush the multicast chain * Flush the multicast chain
*/ */
@ -3483,7 +3483,7 @@ static int __init net_dev_init(void)
goto out; goto out;
INIT_LIST_HEAD(&ptype_all); INIT_LIST_HEAD(&ptype_all);
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
INIT_LIST_HEAD(&ptype_base[i]); INIT_LIST_HEAD(&ptype_base[i]);
for (i = 0; i < ARRAY_SIZE(dev_name_head); i++) for (i = 0; i < ARRAY_SIZE(dev_name_head); i++)

View File

@ -1,12 +1,12 @@
/* /*
* Linux NET3: Multicast List maintenance. * Linux NET3: Multicast List maintenance.
* *
* Authors: * Authors:
* Tim Kordas <tjk@nostromo.eeap.cwru.edu> * Tim Kordas <tjk@nostromo.eeap.cwru.edu>
* Richard Underwood <richard@wuzz.demon.co.uk> * Richard Underwood <richard@wuzz.demon.co.uk>
* *
* Stir fried together from the IP multicast and CAP patches above * Stir fried together from the IP multicast and CAP patches above
* Alan Cox <Alan.Cox@linux.org> * Alan Cox <Alan.Cox@linux.org>
* *
* Fixes: * Fixes:
* Alan Cox : Update the device on a real delete * Alan Cox : Update the device on a real delete
@ -50,11 +50,11 @@
/* /*
* Device multicast list maintenance. * Device multicast list maintenance.
* *
* This is used both by IP and by the user level maintenance functions. * This is used both by IP and by the user level maintenance functions.
* Unlike BSD we maintain a usage count on a given multicast address so * Unlike BSD we maintain a usage count on a given multicast address so
* that a casual user application can add/delete multicasts used by * that a casual user application can add/delete multicasts used by
* protocols without doing damage to the protocols when it deletes the * protocols without doing damage to the protocols when it deletes the
* entries. It also helps IP as it tracks overlapping maps. * entries. It also helps IP as it tracks overlapping maps.
* *
@ -67,7 +67,7 @@
/* /*
* Update the multicast list into the physical NIC controller. * Update the multicast list into the physical NIC controller.
*/ */
static void __dev_mc_upload(struct net_device *dev) static void __dev_mc_upload(struct net_device *dev)
{ {
/* Don't do anything till we up the interface /* Don't do anything till we up the interface
@ -100,7 +100,7 @@ void dev_mc_upload(struct net_device *dev)
/* /*
* Delete a device level multicast * Delete a device level multicast
*/ */
int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl) int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
{ {
int err = 0; int err = 0;
@ -137,7 +137,7 @@ int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
* loaded filter is now wrong. Fix it * loaded filter is now wrong. Fix it
*/ */
__dev_mc_upload(dev); __dev_mc_upload(dev);
netif_tx_unlock_bh(dev); netif_tx_unlock_bh(dev);
return 0; return 0;
} }
@ -151,7 +151,7 @@ done:
/* /*
* Add a device level multicast * Add a device level multicast
*/ */
int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
{ {
int err = 0; int err = 0;
@ -187,7 +187,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
dev->mc_count++; dev->mc_count++;
__dev_mc_upload(dev); __dev_mc_upload(dev);
netif_tx_unlock_bh(dev); netif_tx_unlock_bh(dev);
return 0; return 0;
@ -204,7 +204,7 @@ done:
void dev_mc_discard(struct net_device *dev) void dev_mc_discard(struct net_device *dev)
{ {
netif_tx_lock_bh(dev); netif_tx_lock_bh(dev);
while (dev->mc_list != NULL) { while (dev->mc_list != NULL) {
struct dev_mc_list *tmp = dev->mc_list; struct dev_mc_list *tmp = dev->mc_list;
dev->mc_list = tmp->next; dev->mc_list = tmp->next;
@ -225,7 +225,7 @@ static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos)
read_lock(&dev_base_lock); read_lock(&dev_base_lock);
for (dev = dev_base; dev; dev = dev->next) { for (dev = dev_base; dev; dev = dev->next) {
if (off++ == *pos) if (off++ == *pos)
return dev; return dev;
} }
return NULL; return NULL;

View File

@ -29,7 +29,7 @@
* 4) All operations modify state, so a spinlock is used. * 4) All operations modify state, so a spinlock is used.
*/ */
static struct dst_entry *dst_garbage_list; static struct dst_entry *dst_garbage_list;
#if RT_CACHE_DEBUG >= 2 #if RT_CACHE_DEBUG >= 2
static atomic_t dst_total = ATOMIC_INIT(0); static atomic_t dst_total = ATOMIC_INIT(0);
#endif #endif
static DEFINE_SPINLOCK(dst_lock); static DEFINE_SPINLOCK(dst_lock);
@ -141,7 +141,7 @@ void * dst_alloc(struct dst_ops * ops)
dst->path = dst; dst->path = dst;
dst->input = dst_discard_in; dst->input = dst_discard_in;
dst->output = dst_discard_out; dst->output = dst_discard_out;
#if RT_CACHE_DEBUG >= 2 #if RT_CACHE_DEBUG >= 2
atomic_inc(&dst_total); atomic_inc(&dst_total);
#endif #endif
atomic_inc(&ops->entries); atomic_inc(&ops->entries);
@ -202,7 +202,7 @@ again:
dst->ops->destroy(dst); dst->ops->destroy(dst);
if (dst->dev) if (dst->dev)
dev_put(dst->dev); dev_put(dst->dev);
#if RT_CACHE_DEBUG >= 2 #if RT_CACHE_DEBUG >= 2
atomic_dec(&dst_total); atomic_dec(&dst_total);
#endif #endif
kmem_cache_free(dst->ops->kmem_cachep, dst); kmem_cache_free(dst->ops->kmem_cachep, dst);

View File

@ -17,7 +17,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
/* /*
* Some useful ethtool_ops methods that're device independent. * Some useful ethtool_ops methods that're device independent.
* If we find that all drivers want to do the same thing here, * If we find that all drivers want to do the same thing here,
* we can turn these into dev_() function calls. * we can turn these into dev_() function calls.
@ -87,12 +87,12 @@ int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *a
unsigned char len = dev->addr_len; unsigned char len = dev->addr_len;
if ( addr->size < len ) if ( addr->size < len )
return -ETOOSMALL; return -ETOOSMALL;
addr->size = len; addr->size = len;
memcpy(data, dev->perm_addr, len); memcpy(data, dev->perm_addr, len);
return 0; return 0;
} }
u32 ethtool_op_get_ufo(struct net_device *dev) u32 ethtool_op_get_ufo(struct net_device *dev)
{ {
@ -550,7 +550,7 @@ static int ethtool_set_sg(struct net_device *dev, char __user *useraddr)
if (copy_from_user(&edata, useraddr, sizeof(edata))) if (copy_from_user(&edata, useraddr, sizeof(edata)))
return -EFAULT; return -EFAULT;
if (edata.data && if (edata.data &&
!(dev->features & NETIF_F_ALL_CSUM)) !(dev->features & NETIF_F_ALL_CSUM))
return -EINVAL; return -EINVAL;
@ -951,7 +951,7 @@ int dev_ethtool(struct ifreq *ifr)
default: default:
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;
} }
if(dev->ethtool_ops->complete) if(dev->ethtool_ops->complete)
dev->ethtool_ops->complete(dev); dev->ethtool_ops->complete(dev);

View File

@ -53,7 +53,7 @@ static void *__load_pointer(struct sk_buff *skb, int k)
} }
static inline void *load_pointer(struct sk_buff *skb, int k, static inline void *load_pointer(struct sk_buff *skb, int k,
unsigned int size, void *buffer) unsigned int size, void *buffer)
{ {
if (k >= 0) if (k >= 0)
return skb_header_pointer(skb, k, size, buffer); return skb_header_pointer(skb, k, size, buffer);
@ -91,7 +91,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int
*/ */
for (pc = 0; pc < flen; pc++) { for (pc = 0; pc < flen; pc++) {
fentry = &filter[pc]; fentry = &filter[pc];
switch (fentry->code) { switch (fentry->code) {
case BPF_ALU|BPF_ADD|BPF_X: case BPF_ALU|BPF_ADD|BPF_X:
A += X; A += X;
@ -399,7 +399,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
*/ */
int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
{ {
struct sk_filter *fp; struct sk_filter *fp;
unsigned int fsize = sizeof(struct sock_filter) * fprog->len; unsigned int fsize = sizeof(struct sock_filter) * fprog->len;
int err; int err;
@ -411,7 +411,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
if (!fp) if (!fp)
return -ENOMEM; return -ENOMEM;
if (copy_from_user(fp->insns, fprog->filter, fsize)) { if (copy_from_user(fp->insns, fprog->filter, fsize)) {
sock_kfree_s(sk, fp, fsize+sizeof(*fp)); sock_kfree_s(sk, fp, fsize+sizeof(*fp));
return -EFAULT; return -EFAULT;
} }

View File

@ -144,7 +144,7 @@ static void est_timer(unsigned long arg)
* configuration TLV is created. Upon each interval, the latest statistics * configuration TLV is created. Upon each interval, the latest statistics
* will be read from &bstats and the estimated rate will be stored in * will be read from &bstats and the estimated rate will be stored in
* &rate_est with the statistics lock grabed during this period. * &rate_est with the statistics lock grabed during this period.
* *
* Returns 0 on success or a negative error code. * Returns 0 on success or a negative error code.
*/ */
int gen_new_estimator(struct gnet_stats_basic *bstats, int gen_new_estimator(struct gnet_stats_basic *bstats,
@ -231,7 +231,7 @@ void gen_kill_estimator(struct gnet_stats_basic *bstats,
* *
* Replaces the configuration of a rate estimator by calling * Replaces the configuration of a rate estimator by calling
* gen_kill_estimator() and gen_new_estimator(). * gen_kill_estimator() and gen_new_estimator().
* *
* Returns 0 on success or a negative error code. * Returns 0 on success or a negative error code.
*/ */
int int
@ -242,7 +242,7 @@ gen_replace_estimator(struct gnet_stats_basic *bstats,
gen_kill_estimator(bstats, rate_est); gen_kill_estimator(bstats, rate_est);
return gen_new_estimator(bstats, rate_est, stats_lock, opt); return gen_new_estimator(bstats, rate_est, stats_lock, opt);
} }
EXPORT_SYMBOL(gen_kill_estimator); EXPORT_SYMBOL(gen_kill_estimator);
EXPORT_SYMBOL(gen_new_estimator); EXPORT_SYMBOL(gen_new_estimator);

View File

@ -57,7 +57,7 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type,
int xstats_type, spinlock_t *lock, struct gnet_dump *d) int xstats_type, spinlock_t *lock, struct gnet_dump *d)
{ {
memset(d, 0, sizeof(*d)); memset(d, 0, sizeof(*d));
spin_lock_bh(lock); spin_lock_bh(lock);
d->lock = lock; d->lock = lock;
if (type) if (type)

View File

@ -40,7 +40,7 @@
int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode) int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode)
{ {
int size, err, ct; int size, err, ct;
if (m->msg_namelen) { if (m->msg_namelen) {
if (mode == VERIFY_READ) { if (mode == VERIFY_READ) {
err = move_addr_to_kernel(m->msg_name, m->msg_namelen, err = move_addr_to_kernel(m->msg_name, m->msg_namelen,
@ -79,7 +79,7 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode)
* *
* Note: this modifies the original iovec. * Note: this modifies the original iovec.
*/ */
int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
{ {
while (len > 0) { while (len > 0) {
@ -103,7 +103,7 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
* *
* Note: this modifies the original iovec. * Note: this modifies the original iovec.
*/ */
int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len) int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len)
{ {
while (len > 0) { while (len > 0) {
@ -209,7 +209,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
if (partial_cnt) { if (partial_cnt) {
copy -= partial_cnt; copy -= partial_cnt;
if (copy_from_user(kdata + copy, base + copy, if (copy_from_user(kdata + copy, base + copy,
partial_cnt)) partial_cnt))
goto out_fault; goto out_fault;
} }
} }
@ -224,7 +224,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
kdata += copy + partial_cnt; kdata += copy + partial_cnt;
iov++; iov++;
} }
*csump = csum; *csump = csum;
out: out:
return err; return err;

View File

@ -124,7 +124,7 @@ void linkwatch_run_queue(void)
dev_put(dev); dev_put(dev);
} }
} }
static void linkwatch_event(struct work_struct *dummy) static void linkwatch_event(struct work_struct *dummy)
@ -133,7 +133,7 @@ static void linkwatch_event(struct work_struct *dummy)
* per second so that a runaway driver does not * per second so that a runaway driver does not
* cause a storm of messages on the netlink * cause a storm of messages on the netlink
* socket * socket
*/ */
linkwatch_nextevent = jiffies + HZ; linkwatch_nextevent = jiffies + HZ;
clear_bit(LW_RUNNING, &linkwatch_flags); clear_bit(LW_RUNNING, &linkwatch_flags);

Some files were not shown because too many files have changed in this diff Show More