You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(2) |
Oct
(43) |
Nov
(4) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(78) |
Feb
(97) |
Mar
(29) |
Apr
(2) |
May
(22) |
Jun
(38) |
Jul
(11) |
Aug
(27) |
Sep
(40) |
Oct
(2) |
Nov
(17) |
Dec
(8) |
2002 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
(480) |
May
(456) |
Jun
(12) |
Jul
|
Aug
(1) |
Sep
|
Oct
(18) |
Nov
(3) |
Dec
(6) |
2003 |
Jan
|
Feb
(18) |
Mar
(1) |
Apr
|
May
(6) |
Jun
(147) |
Jul
(7) |
Aug
(3) |
Sep
(235) |
Oct
(10) |
Nov
(2) |
Dec
(1) |
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Andy P. <at...@us...> - 2002-04-09 16:27:06
|
Update of /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter In directory usw-pr-cvs1:/tmp/cvs-serv31773/ipv6/netfilter Modified Files: Config.in Makefile ip6_tables.c ip6t_MARK.c ip6t_limit.c ip6t_mac.c ip6t_mark.c ip6t_multiport.c ip6table_filter.c ip6table_mangle.c Added Files: ip6t_LOG.c ip6t_owner.c Log Message: synch 2.4.15 commit 20 --- NEW FILE --- /* * This is a module which is used for logging packets. */ #include <linux/module.h> #include <linux/skbuff.h> #include <linux/ip.h> #include <linux/spinlock.h> #include <linux/icmpv6.h> #include <net/udp.h> #include <net/tcp.h> #include <net/ipv6.h> #include <linux/netfilter_ipv6/ip6_tables.h> MODULE_AUTHOR("Jan Rekorajski <ba...@pl...>"); MODULE_DESCRIPTION("IP6 tables LOG target module"); MODULE_LICENSE("GPL"); struct in_device; #include <net/route.h> #include <linux/netfilter_ipv6/ip6t_LOG.h> #if 0 #define DEBUGP printk #else #define DEBUGP(format, args...) #endif #define NIP6(addr) \ ntohs((addr).s6_addr16[0]), \ ntohs((addr).s6_addr16[1]), \ ntohs((addr).s6_addr16[2]), \ ntohs((addr).s6_addr16[3]), \ ntohs((addr).s6_addr16[4]), \ ntohs((addr).s6_addr16[5]), \ ntohs((addr).s6_addr16[6]), \ ntohs((addr).s6_addr16[7]) struct esphdr { __u32 spi; }; /* FIXME evil kludge */ /* Use lock to serialize, so printks don't overlap */ static spinlock_t log_lock = SPIN_LOCK_UNLOCKED; /* takes in current header and pointer to the header */ /* if another header exists, sets hdrptr to the next header and returns the new header value, else returns 0 */ static u_int8_t ip6_nexthdr(u_int8_t currenthdr, u_int8_t **hdrptr) { u_int8_t hdrlen, nexthdr = 0; switch(currenthdr){ case IPPROTO_AH: /* whoever decided to do the length of AUTH for ipv6 in 32bit units unlike other headers should be beaten... repeatedly...with a large stick...no, an even LARGER stick...no, you're still not thinking big enough */ nexthdr = **hdrptr; hdrlen = *hdrptr[1] * 4 + 8; *hdrptr = *hdrptr + hdrlen; break; /*stupid rfc2402 */ case IPPROTO_DSTOPTS: case IPPROTO_ROUTING: case IPPROTO_HOPOPTS: nexthdr = **hdrptr; hdrlen = *hdrptr[1] * 8 + 8; *hdrptr = *hdrptr + hdrlen; break; case IPPROTO_FRAGMENT: nexthdr = **hdrptr; *hdrptr = *hdrptr + 8; break; } return nexthdr; } /* One level of recursion won't kill us */ static void dump_packet(const struct ip6t_log_info *info, struct ipv6hdr *ipv6h, int recurse) { u_int8_t currenthdr = ipv6h->nexthdr; u_int8_t *hdrptr; int fragment; /* Max length: 88 "SRC=0000.0000.0000.0000.0000.0000.0000.0000 DST=0000.0000.0000.0000.0000.0000.0000.0000" */ printk("SRC=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(ipv6h->saddr)); printk("DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", NIP6(ipv6h->daddr)); /* Max length: 44 "LEN=65535 TC=255 HOPLIMIT=255 FLOWLBL=FFFFF " */ printk("LEN=%u TC=%u HOPLIMIT=%u FLOWLBL=%u ", ntohs(ipv6h->payload_len) + sizeof(struct ipv6hdr), (ntohl(*(u_int32_t *)ipv6h) & 0x0ff00000) >> 20, ipv6h->hop_limit, (ntohl(*(u_int32_t *)ipv6h) & 0x000fffff)); fragment = 0; hdrptr = (u_int8_t *)(ipv6h + 1); while (currenthdr) { if ((currenthdr == IPPROTO_TCP) || (currenthdr == IPPROTO_UDP) || (currenthdr == IPPROTO_ICMPV6)) break; /* Max length: 48 "OPT (...) " */ printk("OPT ( "); switch (currenthdr) { case IPPROTO_FRAGMENT: { struct frag_hdr *fhdr = (struct frag_hdr *)hdrptr; /* Max length: 11 "FRAG:65535 " */ printk("FRAG:%u ", ntohs(fhdr->frag_off) & 0xFFF8); /* Max length: 11 "INCOMPLETE " */ if (fhdr->frag_off & __constant_htons(0x0001)) printk("INCOMPLETE "); printk("ID:%08x ", fhdr->identification); if (ntohs(fhdr->frag_off) & 0xFFF8) fragment = 1; break; } case IPPROTO_DSTOPTS: case IPPROTO_ROUTING: case IPPROTO_HOPOPTS: break; /* Max Length */ case IPPROTO_AH: case IPPROTO_ESP: if (info->logflags & IP6T_LOG_IPOPT) { struct esphdr *esph = (struct esphdr *)hdrptr; int esp = (currenthdr == IPPROTO_ESP); /* Max length: 4 "ESP " */ printk("%s ",esp ? "ESP" : "AH"); /* Length: 15 "SPI=0xF1234567 " */ printk("SPI=0x%x ", ntohl(esph->spi) ); break; } default: break; } printk(") "); currenthdr = ip6_nexthdr(currenthdr, &hdrptr); } switch (currenthdr) { case IPPROTO_TCP: { struct tcphdr *tcph = (struct tcphdr *)hdrptr; /* Max length: 10 "PROTO=TCP " */ printk("PROTO=TCP "); if (fragment) break; /* Max length: 20 "SPT=65535 DPT=65535 " */ printk("SPT=%u DPT=%u ", ntohs(tcph->source), ntohs(tcph->dest)); /* Max length: 30 "SEQ=4294967295 ACK=4294967295 " */ if (info->logflags & IP6T_LOG_TCPSEQ) printk("SEQ=%u ACK=%u ", ntohl(tcph->seq), ntohl(tcph->ack_seq)); /* Max length: 13 "WINDOW=65535 " */ printk("WINDOW=%u ", ntohs(tcph->window)); /* Max length: 9 "RES=0x3F " */ printk("RES=0x%02x ", (u_int8_t)(ntohl(tcp_flag_word(tcph) & TCP_RESERVED_BITS) >> 22)); /* Max length: 32 "CWR ECE URG ACK PSH RST SYN FIN " */ if (tcph->cwr) printk("CWR "); if (tcph->ece) printk("ECE "); if (tcph->urg) printk("URG "); if (tcph->ack) printk("ACK "); if (tcph->psh) printk("PSH "); if (tcph->rst) printk("RST "); if (tcph->syn) printk("SYN "); if (tcph->fin) printk("FIN "); /* Max length: 11 "URGP=65535 " */ printk("URGP=%u ", ntohs(tcph->urg_ptr)); if ((info->logflags & IP6T_LOG_TCPOPT) && tcph->doff * 4 != sizeof(struct tcphdr)) { unsigned int i; /* Max length: 127 "OPT (" 15*4*2chars ") " */ printk("OPT ("); for (i =sizeof(struct tcphdr); i < tcph->doff * 4; i++) printk("%02X", ((u_int8_t *)tcph)[i]); printk(") "); } break; } case IPPROTO_UDP: { struct udphdr *udph = (struct udphdr *)hdrptr; /* Max length: 10 "PROTO=UDP " */ printk("PROTO=UDP "); if (fragment) break; /* Max length: 20 "SPT=65535 DPT=65535 " */ printk("SPT=%u DPT=%u LEN=%u ", ntohs(udph->source), ntohs(udph->dest), ntohs(udph->len)); break; } case IPPROTO_ICMPV6: { struct icmp6hdr *icmp6h = (struct icmp6hdr *)hdrptr; /* Max length: 13 "PROTO=ICMPv6 " */ printk("PROTO=ICMPv6 "); if (fragment) break; /* Max length: 18 "TYPE=255 CODE=255 " */ printk("TYPE=%u CODE=%u ", icmp6h->icmp6_type, icmp6h->icmp6_code); switch (icmp6h->icmp6_type) { case ICMPV6_ECHO_REQUEST: case ICMPV6_ECHO_REPLY: /* Max length: 19 "ID=65535 SEQ=65535 " */ printk("ID=%u SEQ=%u ", ntohs(icmp6h->icmp6_identifier), ntohs(icmp6h->icmp6_sequence)); break; case ICMPV6_MGM_QUERY: case ICMPV6_MGM_REPORT: case ICMPV6_MGM_REDUCTION: break; case ICMPV6_PARAMPROB: /* Max length: 17 "POINTER=ffffffff " */ printk("POINTER=%08x ", ntohl(icmp6h->icmp6_pointer)); /* Fall through */ case ICMPV6_DEST_UNREACH: case ICMPV6_PKT_TOOBIG: case ICMPV6_TIME_EXCEED: /* Max length: 3+maxlen */ if (recurse) { printk("["); dump_packet(info, (struct ipv6hdr *)(icmp6h + 1), 0); printk("] "); } /* Max length: 10 "MTU=65535 " */ if (icmp6h->icmp6_type == ICMPV6_PKT_TOOBIG) printk("MTU=%u ", ntohl(icmp6h->icmp6_mtu)); } break; } /* Max length: 10 "PROTO 255 " */ default: printk("PROTO=%u ", currenthdr); } } static unsigned int ip6t_log_target(struct sk_buff **pskb, unsigned int hooknum, const struct net_device *in, const struct net_device *out, const void *targinfo, void *userinfo) { struct ipv6hdr *ipv6h = (*pskb)->nh.ipv6h; const struct ip6t_log_info *loginfo = targinfo; char level_string[4] = "< >"; level_string[1] = '0' + (loginfo->level % 8); spin_lock_bh(&log_lock); printk(level_string); printk("%sIN=%s OUT=%s ", loginfo->prefix, in ? in->name : "", out ? out->name : ""); if (in && !out) { /* MAC logging for input chain only. */ printk("MAC="); if ((*pskb)->dev && (*pskb)->dev->hard_header_len && (*pskb)->mac.raw != (void*)ipv6h) { int i; unsigned char *p = (*pskb)->mac.raw; for (i = 0; i < (*pskb)->dev->hard_header_len; i++,p++) printk("%02x%c", *p, i==(*pskb)->dev->hard_header_len - 1 ? ' ':':'); } else printk(" "); } dump_packet(loginfo, ipv6h, 1); printk("\n"); spin_unlock_bh(&log_lock); return IP6T_CONTINUE; } static int ip6t_log_checkentry(const char *tablename, const struct ip6t_entry *e, void *targinfo, unsigned int targinfosize, unsigned int hook_mask) { const struct ip6t_log_info *loginfo = targinfo; if (targinfosize != IP6T_ALIGN(sizeof(struct ip6t_log_info))) { DEBUGP("LOG: targinfosize %u != %u\n", targinfosize, IP6T_ALIGN(sizeof(struct ip6t_log_info))); return 0; } if (loginfo->level >= 8) { DEBUGP("LOG: level %u >= 8\n", loginfo->level); return 0; } if (loginfo->prefix[sizeof(loginfo->prefix)-1] != '\0') { DEBUGP("LOG: prefix term %i\n", loginfo->prefix[sizeof(loginfo->prefix)-1]); return 0; } return 1; } static struct ip6t_target ip6t_log_reg = { { NULL, NULL }, "LOG", ip6t_log_target, ip6t_log_checkentry, NULL, THIS_MODULE }; static int __init init(void) { if (ip6t_register_target(&ip6t_log_reg)) return -EINVAL; return 0; } static void __exit fini(void) { ip6t_unregister_target(&ip6t_log_reg); } module_init(init); module_exit(fini); --- NEW FILE --- /* Kernel module to match various things tied to sockets associated with locally generated outgoing packets. Copyright (C) 2000,2001 Marc Boucher */ #include <linux/module.h> #include <linux/skbuff.h> #include <linux/file.h> #include <net/sock.h> #include <linux/netfilter_ipv6/ip6t_owner.h> #include <linux/netfilter_ipv6/ip6_tables.h> MODULE_AUTHOR("Marc Boucher <ma...@mb...>"); MODULE_DESCRIPTION("IP6 tables owner matching module"); MODULE_LICENSE("GPL"); static int match_pid(const struct sk_buff *skb, pid_t pid) { struct task_struct *p; struct files_struct *files; int i; read_lock(&tasklist_lock); p = find_task_by_pid(pid); if (!p) goto out; task_lock(p); files = p->files; if(files) { read_lock(&files->file_lock); for (i=0; i < files->max_fds; i++) { if (fcheck_files(files, i) == skb->sk->socket->file) { read_unlock(&files->file_lock); task_unlock(p); read_unlock(&tasklist_lock); return 1; } } read_unlock(&files->file_lock); } task_unlock(p); out: read_unlock(&tasklist_lock); return 0; } static int match_sid(const struct sk_buff *skb, pid_t sid) { struct task_struct *p; struct file *file = skb->sk->socket->file; int i, found=0; read_lock(&tasklist_lock); for_each_task(p) { struct files_struct *files; if (p->session != sid) continue; task_lock(p); files = p->files; if (files) { read_lock(&files->file_lock); for (i=0; i < files->max_fds; i++) { if (fcheck_files(files, i) == file) { found = 1; break; } } read_unlock(&files->file_lock); } task_unlock(p); if(found) break; } read_unlock(&tasklist_lock); return found; } static int match(const struct sk_buff *skb, const struct net_device *in, const struct net_device *out, const void *matchinfo, int offset, const void *hdr, u_int16_t datalen, int *hotdrop) { const struct ip6t_owner_info *info = matchinfo; if (!skb->sk || !skb->sk->socket || !skb->sk->socket->file) return 0; if(info->match & IP6T_OWNER_UID) { if((skb->sk->socket->file->f_uid != info->uid) ^ !!(info->invert & IP6T_OWNER_UID)) return 0; } if(info->match & IP6T_OWNER_GID) { if((skb->sk->socket->file->f_gid != info->gid) ^ !!(info->invert & IP6T_OWNER_GID)) return 0; } if(info->match & IP6T_OWNER_PID) { if (!match_pid(skb, info->pid) ^ !!(info->invert & IP6T_OWNER_PID)) return 0; } if(info->match & IP6T_OWNER_SID) { if (!match_sid(skb, info->sid) ^ !!(info->invert & IP6T_OWNER_SID)) return 0; } return 1; } static int checkentry(const char *tablename, const struct ip6t_ip6 *ip, void *matchinfo, unsigned int matchsize, unsigned int hook_mask) { if (hook_mask & ~((1 << NF_IP6_LOCAL_OUT) | (1 << NF_IP6_POST_ROUTING))) { printk("ip6t_owner: only valid for LOCAL_OUT or POST_ROUTING.\n"); return 0; } if (matchsize != IP6T_ALIGN(sizeof(struct ip6t_owner_info))) return 0; return 1; } static struct ip6t_match owner_match = { { NULL, NULL }, "owner", &match, &checkentry, NULL, THIS_MODULE }; static int __init init(void) { return ip6t_register_match(&owner_match); } static void __exit fini(void) { ip6t_unregister_match(&owner_match); } module_init(init); module_exit(fini); Index: Config.in =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter/Config.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Config.in 14 Jan 2001 17:12:55 -0000 1.1.1.1 +++ Config.in 9 Apr 2002 16:26:57 -0000 1.2 @@ -16,6 +16,11 @@ if [ "$CONFIG_IP6_NF_IPTABLES" != "n" ]; then # The simple matches. dep_tristate ' limit match support' CONFIG_IP6_NF_MATCH_LIMIT $CONFIG_IP6_NF_IPTABLES + dep_tristate ' MAC address match support' CONFIG_IP6_NF_MATCH_MAC $CONFIG_IP6_NF_IPTABLES + dep_tristate ' Multiple port match support' CONFIG_IP6_NF_MATCH_MULTIPORT $CONFIG_IP6_NF_IPTABLES + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + dep_tristate ' Owner match support (EXPERIMENTAL)' CONFIG_IP6_NF_MATCH_OWNER $CONFIG_IP6_NF_IPTABLES + fi # dep_tristate ' MAC address match support' CONFIG_IP6_NF_MATCH_MAC $CONFIG_IP6_NF_IPTABLES dep_tristate ' netfilter MARK match support' CONFIG_IP6_NF_MATCH_MARK $CONFIG_IP6_NF_IPTABLES # dep_tristate ' Multiple port match support' CONFIG_IP6_NF_MATCH_MULTIPORT $CONFIG_IP6_NF_IPTABLES @@ -30,6 +35,9 @@ # The targets dep_tristate ' Packet filtering' CONFIG_IP6_NF_FILTER $CONFIG_IP6_NF_IPTABLES + if [ "$CONFIG_IP6_NF_FILTER" != "n" ]; then + dep_tristate ' LOG target support' CONFIG_IP6_NF_TARGET_LOG $CONFIG_IP6_NF_FILTER + fi # if [ "$CONFIG_IP6_NF_FILTER" != "n" ]; then # dep_tristate ' REJECT target support' CONFIG_IP6_NF_TARGET_REJECT $CONFIG_IP6_NF_FILTER Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter/Makefile,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- Makefile 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ Makefile 9 Apr 2002 16:26:57 -0000 1.2 @@ -9,8 +9,7 @@ O_TARGET := netfilter.o -multi-objs := -export-objs := +export-objs := ip6_tables.o # Link order matters here. obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o @@ -18,8 +17,10 @@ obj-$(CONFIG_IP6_NF_MATCH_MARK) += ip6t_mark.o obj-$(CONFIG_IP6_NF_MATCH_MAC) += ip6t_mac.o obj-$(CONFIG_IP6_NF_MATCH_MULTIPORT) += ip6t_multiport.o +obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o +obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o include $(TOPDIR)/Rules.make Index: ip6_tables.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter/ip6_tables.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- ip6_tables.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ ip6_tables.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -1102,6 +1102,10 @@ if (copy_from_user(&tmp, user, sizeof(tmp)) != 0) return -EFAULT; + /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */ + if ((SMP_ALIGN(tmp.size) >> PAGE_SHIFT) + 2 > num_physpages) + return -ENOMEM; + newinfo = vmalloc(sizeof(struct ip6t_table_info) + SMP_ALIGN(tmp.size) * smp_num_cpus); if (!newinfo) @@ -1286,6 +1290,7 @@ ret = -EFAULT; break; } + name[IP6T_TABLE_MAXNAMELEN-1] = '\0'; t = find_table_lock(name, &ret, &ip6t_mutex); if (t) { struct ip6t_getinfo info; @@ -1790,5 +1795,14 @@ #endif } +EXPORT_SYMBOL(ip6t_register_table); +EXPORT_SYMBOL(ip6t_unregister_table); +EXPORT_SYMBOL(ip6t_do_table); +EXPORT_SYMBOL(ip6t_register_match); +EXPORT_SYMBOL(ip6t_unregister_match); +EXPORT_SYMBOL(ip6t_register_target); +EXPORT_SYMBOL(ip6t_unregister_target); + module_init(init); module_exit(fini); +MODULE_LICENSE("GPL"); Index: ip6t_MARK.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter/ip6t_MARK.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- ip6t_MARK.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ ip6t_MARK.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -65,3 +65,4 @@ module_init(init); module_exit(fini); +MODULE_LICENSE("GPL"); Index: ip6t_limit.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter/ip6t_limit.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ip6t_limit.c 14 Jan 2001 17:13:02 -0000 1.1.1.1 +++ ip6t_limit.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -13,7 +13,7 @@ #include <linux/interrupt.h> #include <linux/netfilter_ipv6/ip6_tables.h> -#include <linux/netfilter_ipv4/ipt_limit.h> +#include <linux/netfilter_ipv6/ip6t_limit.h> /* The algorithm used is the Simple Token Bucket Filter (TBF) * see net/sched/sch_tbf.c in the linux source tree @@ -42,7 +42,7 @@ #define CREDITS_PER_JIFFY 128 static int -ipt_limit_match(const struct sk_buff *skb, +ip6t_limit_match(const struct sk_buff *skb, const struct net_device *in, const struct net_device *out, const void *matchinfo, @@ -51,7 +51,7 @@ u_int16_t datalen, int *hotdrop) { - struct ipt_rateinfo *r = ((struct ipt_rateinfo *)matchinfo)->master; + struct ip6t_rateinfo *r = ((struct ip6t_rateinfo *)matchinfo)->master; unsigned long now = jiffies; spin_lock_bh(&limit_lock); @@ -77,32 +77,32 @@ /* If multiplying would overflow... */ if (user > 0xFFFFFFFF / (HZ*CREDITS_PER_JIFFY)) /* Divide first. */ - return (user / IPT_LIMIT_SCALE) * HZ * CREDITS_PER_JIFFY; + return (user / IP6T_LIMIT_SCALE) * HZ * CREDITS_PER_JIFFY; - return (user * HZ * CREDITS_PER_JIFFY) / IPT_LIMIT_SCALE; + return (user * HZ * CREDITS_PER_JIFFY) / IP6T_LIMIT_SCALE; } static int -ipt_limit_checkentry(const char *tablename, +ip6t_limit_checkentry(const char *tablename, const struct ip6t_ip6 *ip, void *matchinfo, unsigned int matchsize, unsigned int hook_mask) { - struct ipt_rateinfo *r = matchinfo; + struct ip6t_rateinfo *r = matchinfo; - if (matchsize != IP6T_ALIGN(sizeof(struct ipt_rateinfo))) + if (matchsize != IP6T_ALIGN(sizeof(struct ip6t_rateinfo))) return 0; /* Check for overflow. */ if (r->burst == 0 || user2credits(r->avg * r->burst) < user2credits(r->avg)) { - printk("Call rusty: overflow in ipt_limit: %u/%u\n", + printk("Call rusty: overflow in ip6t_limit: %u/%u\n", r->avg, r->burst); return 0; } - /* User avg in seconds * IPT_LIMIT_SCALE: convert to jiffies * + /* User avg in seconds * IP6T_LIMIT_SCALE: convert to jiffies * 128. */ r->prev = jiffies; r->credit = user2credits(r->avg * r->burst); /* Credits full. */ @@ -115,21 +115,22 @@ return 1; } -static struct ip6t_match ipt_limit_reg -= { { NULL, NULL }, "limit", ipt_limit_match, ipt_limit_checkentry, NULL, +static struct ip6t_match ip6t_limit_reg += { { NULL, NULL }, "limit", ip6t_limit_match, ip6t_limit_checkentry, NULL, THIS_MODULE }; static int __init init(void) { - if (ip6t_register_match(&ipt_limit_reg)) + if (ip6t_register_match(&ip6t_limit_reg)) return -EINVAL; return 0; } static void __exit fini(void) { - ip6t_unregister_match(&ipt_limit_reg); + ip6t_unregister_match(&ip6t_limit_reg); } module_init(init); module_exit(fini); +MODULE_LICENSE("GPL"); Index: ip6t_mac.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter/ip6t_mac.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ip6t_mac.c 14 Jan 2001 17:13:03 -0000 1.1.1.1 +++ ip6t_mac.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -20,14 +20,14 @@ /* Is mac pointer valid? */ return (skb->mac.raw >= skb->head - && skb->mac.raw < skb->head + skb->len - ETH_HLEN + && (skb->mac.raw + ETH_HLEN) <= skb->data /* If so, compare... */ && ((memcmp(skb->mac.ethernet->h_source, info->srcaddr, ETH_ALEN) == 0) ^ info->invert)); } static int -ipt_mac_checkentry(const char *tablename, +ip6t_mac_checkentry(const char *tablename, const struct ip6t_ip6 *ip, void *matchinfo, unsigned int matchsize, @@ -35,7 +35,7 @@ { if (hook_mask & ~((1 << NF_IP6_PRE_ROUTING) | (1 << NF_IP6_LOCAL_IN))) { - printk("ipt_mac: only valid for PRE_ROUTING or LOCAL_IN.\n"); + printk("ip6t_mac: only valid for PRE_ROUTING or LOCAL_IN.\n"); return 0; } @@ -46,7 +46,7 @@ } static struct ip6t_match mac_match -= { { NULL, NULL }, "mac", &match, &ipt_mac_checkentry, NULL, THIS_MODULE }; += { { NULL, NULL }, "mac", &match, &ip6t_mac_checkentry, NULL, THIS_MODULE }; static int __init init(void) { Index: ip6t_mark.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter/ip6t_mark.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- ip6t_mark.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ ip6t_mark.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -48,3 +48,4 @@ module_init(init); module_exit(fini); +MODULE_LICENSE("GPL"); Index: ip6t_multiport.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter/ip6t_multiport.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ip6t_multiport.c 14 Jan 2001 17:13:04 -0000 1.1.1.1 +++ ip6t_multiport.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -51,7 +51,7 @@ if (offset == 0 && datalen < sizeof(struct udphdr)) { /* We've been asked to examine this packet, and we can't. Hence, no choice but to drop. */ - duprintf("ipt_multiport:" + duprintf("ip6t_multiport:" " Dropping evil offset=0 tinygram.\n"); *hotdrop = 1; return 0; Index: ip6table_filter.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter/ip6table_filter.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ip6table_filter.c 14 Jan 2001 17:13:03 -0000 1.1.1.1 +++ ip6table_filter.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -181,3 +181,4 @@ module_init(init); module_exit(fini); +MODULE_LICENSE("GPL"); Index: ip6table_mangle.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter/ip6table_mangle.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ip6table_mangle.c 25 Feb 2001 23:14:56 -0000 1.1.1.1 +++ ip6table_mangle.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -187,3 +187,4 @@ module_init(init); module_exit(fini); +MODULE_LICENSE("GPL"); |
From: Andy P. <at...@us...> - 2002-04-09 16:27:05
|
Update of /cvsroot/linux-vax/kernel-2.4/net/irda/ircomm In directory usw-pr-cvs1:/tmp/cvs-serv31773/irda/ircomm Modified Files: Makefile ircomm_core.c ircomm_event.c ircomm_lmp.c ircomm_param.c ircomm_ttp.c ircomm_tty.c ircomm_tty_attach.c ircomm_tty_ioctl.c Log Message: synch 2.4.15 commit 20 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/ircomm/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 17:16:14 -0000 1.1.1.1 +++ Makefile 9 Apr 2002 16:26:57 -0000 1.2 @@ -9,7 +9,7 @@ O_TARGET := ircomm_and_tty.o -multi-objs := ircomm.o ircomm-tty.o +list-multi := ircomm.o ircomm-tty.o ircomm-objs := ircomm_core.o ircomm_event.o ircomm_lmp.o ircomm_ttp.o ircomm-tty-objs := ircomm_tty.o ircomm_tty_attach.o ircomm_tty_ioctl.o ircomm_param.o Index: ircomm_core.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/ircomm/ircomm_core.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ircomm_core.c 14 Jan 2001 17:16:16 -0000 1.1.1.1 +++ ircomm_core.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -220,7 +220,7 @@ /* * Function ircomm_connect_indication (self, qos, skb) * - * Notify user layer about the incomming connection + * Notify user layer about the incoming connection * */ void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb, @@ -514,6 +514,7 @@ #ifdef MODULE MODULE_AUTHOR("Dag Brattli <da...@br...>"); MODULE_DESCRIPTION("IrCOMM protocol"); +MODULE_LICENSE("GPL"); int init_module(void) { Index: ircomm_event.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/ircomm/ircomm_event.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ircomm_event.c 14 Jan 2001 17:16:17 -0000 1.1.1.1 +++ ircomm_event.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -151,7 +151,7 @@ /* * Function ircomm_state_waitr (self, event, skb) * - * IrCOMM has received an incomming connection request and is awaiting + * IrCOMM has received an incoming connection request and is awaiting * response from the user */ static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, Index: ircomm_lmp.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/ircomm/ircomm_lmp.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ircomm_lmp.c 14 Jan 2001 17:16:18 -0000 1.1.1.1 +++ ircomm_lmp.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -219,7 +219,7 @@ /* * Function ircomm_lmp_data_indication (instance, sap, skb) * - * Incomming data which we must deliver to the state machine, to check + * Incoming data which we must deliver to the state machine, to check * we are still connected. */ int ircomm_lmp_data_indication(void *instance, void *sap, Index: ircomm_param.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/ircomm/ircomm_param.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ircomm_param.c 14 Jan 2001 17:16:21 -0000 1.1.1.1 +++ ircomm_param.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -182,13 +182,13 @@ int get) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; - __u8 service_type = param->pv.b; /* We know it's a one byte integer */ + __u8 service_type = (__u8) param->pv.i; ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); if (get) { - param->pv.b = self->settings.service_type; + param->pv.i = self->settings.service_type; return 0; } @@ -246,9 +246,9 @@ ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); if (get) - param->pv.b = IRCOMM_SERIAL; + param->pv.i = IRCOMM_SERIAL; else { - self->settings.port_type = param->pv.b; + self->settings.port_type = (__u8) param->pv.i; IRDA_DEBUG(0, __FUNCTION__ "(), port type=%d\n", self->settings.port_type); @@ -317,9 +317,9 @@ ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); if (get) - param->pv.b = self->settings.data_format; + param->pv.i = self->settings.data_format; else - self->settings.data_format = param->pv.b; + self->settings.data_format = (__u8) param->pv.i; return 0; } @@ -339,11 +339,11 @@ ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); if (get) - param->pv.b = self->settings.flow_control; + param->pv.i = self->settings.flow_control; else - self->settings.flow_control = param->pv.b; + self->settings.flow_control = (__u8) param->pv.i; - IRDA_DEBUG(1, __FUNCTION__ "(), flow control = 0x%02x\n", param->pv.b); + IRDA_DEBUG(1, __FUNCTION__ "(), flow control = 0x%02x\n", (__u8) param->pv.i); return 0; } @@ -362,15 +362,15 @@ ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); if (get) { - param->pv.s = self->settings.xonxoff[0]; - param->pv.s |= self->settings.xonxoff[1] << 8; + param->pv.i = self->settings.xonxoff[0]; + param->pv.i |= self->settings.xonxoff[1] << 8; } else { - self->settings.xonxoff[0] = param->pv.s & 0xff; - self->settings.xonxoff[1] = param->pv.s >> 8; + self->settings.xonxoff[0] = (__u16) param->pv.i & 0xff; + self->settings.xonxoff[1] = (__u16) param->pv.i >> 8; } IRDA_DEBUG(0, __FUNCTION__ "(), XON/XOFF = 0x%02x,0x%02x\n", - param->pv.s & 0xff, param->pv.s >> 8); + param->pv.i & 0xff, param->pv.i >> 8); return 0; } @@ -389,15 +389,15 @@ ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); if (get) { - param->pv.s = self->settings.enqack[0]; - param->pv.s |= self->settings.enqack[1] << 8; + param->pv.i = self->settings.enqack[0]; + param->pv.i |= self->settings.enqack[1] << 8; } else { - self->settings.enqack[0] = param->pv.s & 0xff; - self->settings.enqack[1] = param->pv.s >> 8; + self->settings.enqack[0] = (__u16) param->pv.i & 0xff; + self->settings.enqack[1] = (__u16) param->pv.i >> 8; } IRDA_DEBUG(0, __FUNCTION__ "(), ENQ/ACK = 0x%02x,0x%02x\n", - param->pv.s & 0xff, param->pv.s >> 8); + param->pv.i & 0xff, param->pv.i >> 8); return 0; } @@ -431,9 +431,9 @@ ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); if (get) - param->pv.b = self->settings.dte; + param->pv.i = self->settings.dte; else { - dte = param->pv.b; + dte = (__u8) param->pv.i; if (dte & IRCOMM_DELTA_DTR) self->settings.dce |= (IRCOMM_DELTA_DSR| @@ -470,9 +470,9 @@ struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; __u8 dce; - IRDA_DEBUG(1, __FUNCTION__ "(), dce = 0x%02x\n", param->pv.b); + IRDA_DEBUG(1, __FUNCTION__ "(), dce = 0x%02x\n", (__u8) param->pv.i); - dce = param->pv.b; + dce = (__u8) param->pv.i; ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); Index: ircomm_ttp.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/ircomm/ircomm_ttp.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ircomm_ttp.c 14 Jan 2001 17:16:19 -0000 1.1.1.1 +++ ircomm_ttp.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -156,7 +156,7 @@ /* * Function ircomm_ttp_data_indication (instance, sap, skb) * - * Incomming data + * Incoming data * */ int ircomm_ttp_data_indication(void *instance, void *sap, Index: ircomm_tty.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/ircomm/ircomm_tty.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ircomm_tty.c 14 Jan 2001 17:16:26 -0000 1.1.1.1 +++ ircomm_tty.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -468,7 +468,8 @@ /* Check if this is a "normal" ircomm device, or an irlpt device */ if (line < 0x10) { self->service_type = IRCOMM_3_WIRE | IRCOMM_9_WIRE; - self->settings.service_type = IRCOMM_9_WIRE; /* Default */ + self->settings.service_type = IRCOMM_9_WIRE; /* 9 wire as default */ + self->settings.dce = IRCOMM_CTS | IRCOMM_CD; /* Default line settings */ IRDA_DEBUG(2, __FUNCTION__ "(), IrCOMM device\n"); } else { IRDA_DEBUG(2, __FUNCTION__ "(), IrLPT device\n"); @@ -1106,7 +1107,7 @@ /* * Function ircomm_tty_data_indication (instance, sap, skb) * - * Handle incomming data, and deliver it to the line discipline + * Handle incoming data, and deliver it to the line discipline * */ static int ircomm_tty_data_indication(void *instance, void *sap, @@ -1155,7 +1156,7 @@ /* * Function ircomm_tty_control_indication (instance, sap, skb) * - * Parse all incomming parameters (easy!) + * Parse all incoming parameters (easy!) * */ static int ircomm_tty_control_indication(void *instance, void *sap, @@ -1362,6 +1363,7 @@ #ifdef MODULE MODULE_AUTHOR("Dag Brattli <da...@cs...>"); MODULE_DESCRIPTION("IrCOMM serial TTY driver"); +MODULE_LICENSE("GPL"); int init_module(void) { Index: ircomm_tty_attach.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/ircomm/ircomm_tty_attach.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ircomm_tty_attach.c 14 Jan 2001 17:16:29 -0000 1.1.1.1 +++ ircomm_tty_attach.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -505,7 +505,7 @@ * will have to wait for the peer device (DCE) to raise the CTS * line. */ - if (self->flags & ASYNC_CTS_FLOW) { + if ((self->flags & ASYNC_CTS_FLOW) && ((self->settings.dce & IRCOMM_CTS) == 0)) { IRDA_DEBUG(0, __FUNCTION__ "(), waiting for CTS ...\n"); return; } else { Index: ircomm_tty_ioctl.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/ircomm/ircomm_tty_ioctl.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ircomm_tty_ioctl.c 14 Jan 2001 17:16:31 -0000 1.1.1.1 +++ ircomm_tty_ioctl.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -221,16 +221,14 @@ { unsigned int arg; __u8 old_rts, old_dtr; - int error; IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); - error = get_user(arg, value); - if (error) - return error; + if (get_user(arg, value)) + return -EFAULT; old_rts = self->settings.dte & IRCOMM_RTS; old_dtr = self->settings.dte & IRCOMM_DTR; @@ -431,28 +429,18 @@ cnow = driver->icount; restore_flags(flags); p_cuser = (struct serial_icounter_struct *) arg; - error = put_user(cnow.cts, &p_cuser->cts); - if (error) return error; - error = put_user(cnow.dsr, &p_cuser->dsr); - if (error) return error; - error = put_user(cnow.rng, &p_cuser->rng); - if (error) return error; - error = put_user(cnow.dcd, &p_cuser->dcd); - if (error) return error; - error = put_user(cnow.rx, &p_cuser->rx); - if (error) return error; - error = put_user(cnow.tx, &p_cuser->tx); - if (error) return error; - error = put_user(cnow.frame, &p_cuser->frame); - if (error) return error; - error = put_user(cnow.overrun, &p_cuser->overrun); - if (error) return error; - error = put_user(cnow.parity, &p_cuser->parity); - if (error) return error; - error = put_user(cnow.brk, &p_cuser->brk); - if (error) return error; - error = put_user(cnow.buf_overrun, &p_cuser->buf_overrun); - if (error) return error; + if (put_user(cnow.cts, &p_cuser->cts) || + put_user(cnow.dsr, &p_cuser->dsr) || + put_user(cnow.rng, &p_cuser->rng) || + put_user(cnow.dcd, &p_cuser->dcd) || + put_user(cnow.rx, &p_cuser->rx) || + put_user(cnow.tx, &p_cuser->tx) || + put_user(cnow.frame, &p_cuser->frame) || + put_user(cnow.overrun, &p_cuser->overrun) || + put_user(cnow.parity, &p_cuser->parity) || + put_user(cnow.brk, &p_cuser->brk) || + put_user(cnow.buf_overrun, &p_cuser->buf_overrun)) + return -EFAULT; #endif return 0; default: |
From: Andy P. <at...@us...> - 2002-04-09 16:27:05
|
Update of /cvsroot/linux-vax/kernel-2.4/net/ipx In directory usw-pr-cvs1:/tmp/cvs-serv31773/ipx Modified Files: Makefile af_ipx.c af_spx.c sysctl_net_ipx.c Log Message: synch 2.4.15 commit 20 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipx/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 17:11:03 -0000 1.1.1.1 +++ Makefile 9 Apr 2002 16:26:57 -0000 1.2 @@ -23,6 +23,3 @@ obj-$(CONFIG_SPX) += af_spx.o include $(TOPDIR)/Rules.make - -tar: - tar -cvf /dev/f1 . Index: af_ipx.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipx/af_ipx.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- af_ipx.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ af_ipx.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -65,6 +65,14 @@ * Arnaldo Carvalho de Melo <ac...@co...>, * December, 2000 * Revision 044: Call ipxitf_hold on NETDEV_UP (acme) + * Revision 045: fix PPROP routing bug (acme) + * Revision 046: Further fixes to PPROP, ipxitf_create_internal was + * doing an unneeded MOD_INC_USE_COUNT, implement + * sysctl for ipx_pprop_broacasting, fix the ipx sysctl + * handling, making it dynamic, some cleanups, thanks to + * Petr Vandrovec for review and good suggestions. (acme) + * Revision 047: Cleanups, CodingStyle changes, move the ncp connection + * hack out of line (acme) [...2305 lines suppressed...] -static void ipx_proto_finito(void) +static void __exit ipx_proto_finito(void) { /* no need to worry about having anything on the ipx_interfaces * list, when a interface is created we increment the module @@ -2541,6 +2615,7 @@ proc_net_remove("ipx_route"); proc_net_remove("ipx_interface"); proc_net_remove("ipx"); + ipx_unregister_sysctl(); unregister_netdevice_notifier(&ipx_dev_notifier); @@ -2562,5 +2637,4 @@ } module_exit(ipx_proto_finito); -#endif /* MODULE */ -#endif /* CONFIG_IPX || CONFIG_IPX_MODULE */ +MODULE_LICENSE("GPL"); Index: af_spx.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipx/af_spx.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- af_spx.c 14 Jan 2001 17:11:14 -0000 1.1.1.1 +++ af_spx.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -6,7 +6,7 @@ * Revision Date: February 9, 1993 * * Developers: - * Jay Schulist <js...@tu...> + * Jay Schulist <js...@sa...> * Jim Freeman <jf...@ca...> * * Changes: @@ -31,8 +31,6 @@ * This material is provided "as is" and at no charge. */ -#include <linux/config.h> -#if defined(CONFIG_SPX) || defined(CONFIG_SPX_MODULE) #include <linux/module.h> #include <net/ipx.h> #include <net/spx.h> @@ -400,7 +398,7 @@ pdata->retransmit.expires = jiffies + spx_calc_rtt(0); add_timer(&pdata->retransmit); - skb2 = skb_clone(skb, GFP_BUFFER); + skb2 = skb_clone(skb, GFP_NOIO); if(skb2 == NULL) return -ENOBUFS; skb_queue_tail(&pdata->retransmit_queue, skb2); @@ -440,7 +438,7 @@ save_flags(flags); cli(); - skb = sock_alloc_send_skb(sk, size, 1, 0, &err); + skb = sock_alloc_send_skb(sk, size, 0, &err); if(skb == NULL) { restore_flags(flags); return (-ENOMEM); @@ -742,7 +740,7 @@ size = offset + sizeof(struct ipxspxhdr) + len; cli(); - skb = sock_alloc_send_skb(sk, size, 0, flags&MSG_DONTWAIT, &err); + skb = sock_alloc_send_skb(sk, size, flags&MSG_DONTWAIT, &err); sti(); if(skb == NULL) return (err); @@ -901,20 +899,20 @@ sendmsg: spx_sendmsg, recvmsg: spx_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; #include <linux/smp_lock.h> SOCKOPS_WRAP(spx, PF_IPX); - -static struct net_proto_family spx_family_ops= -{ - PF_IPX, - spx_create +static struct net_proto_family spx_family_ops = { + family: PF_IPX, + create: spx_create, }; +static char banner[] __initdata = KERN_INFO "NET4: Sequenced Packet eXchange (SPX) 0.02 for Linux NET4.0\n"; -void spx_proto_init(void) +static int __init spx_proto_init(void) { int error; @@ -926,29 +924,14 @@ /* route socket(PF_IPX, SOCK_SEQPACKET) calls through spx_create() */ - printk(KERN_INFO "NET4: Sequenced Packet eXchange (SPX) 0.02 for Linux NET4.0\n"); - return; + printk(banner); + return 0; } +module_init(spx_proto_init); -void spx_proto_finito(void) +static void __exit spx_proto_finito(void) { ipx_unregister_spx(); return; } - -#ifdef MODULE - -int init_module(void) -{ - spx_proto_init(); - return 0; -} - -void cleanup_module(void) -{ - spx_proto_finito(); - return; -} - -#endif /* MODULE */ -#endif /* CONFIG_SPX || CONFIG_SPX_MODULE */ +module_exit(spx_proto_finito); Index: sysctl_net_ipx.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ipx/sysctl_net_ipx.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sysctl_net_ipx.c 14 Jan 2001 17:11:11 -0000 1.1.1.1 +++ sysctl_net_ipx.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -3,11 +3,45 @@ * * Begun April 1, 1996, Mike Shaver. * Added /proc/sys/net/ipx directory entry (empty =) ). [MS] + * Added /proc/sys/net/ipx/ipx_pprop_broadcasting - acme March 4, 2001 */ +#include <linux/config.h> #include <linux/mm.h> #include <linux/sysctl.h> +#ifndef CONFIG_SYSCTL +#error This file should not be compiled without CONFIG_SYSCTL defined +#endif + +/* From af_ipx.c */ +extern int sysctl_ipx_pprop_broadcasting; + ctl_table ipx_table[] = { - {0} + { NET_IPX_PPROP_BROADCASTING, "ipx_pprop_broadcasting", + &sysctl_ipx_pprop_broadcasting, sizeof(int), 0644, NULL, + &proc_dointvec }, + { 0 } }; + +static ctl_table ipx_dir_table[] = { + { NET_IPX, "ipx", NULL, 0, 0555, ipx_table }, + { 0 } +}; + +static ctl_table ipx_root_table[] = { + { CTL_NET, "net", NULL, 0, 0555, ipx_dir_table }, + { 0 } +}; + +static struct ctl_table_header *ipx_table_header; + +void ipx_register_sysctl(void) +{ + ipx_table_header = register_sysctl_table(ipx_root_table, 1); +} + +void ipx_unregister_sysctl(void) +{ + unregister_sysctl_table(ipx_table_header); +} |
From: Andy P. <at...@us...> - 2002-04-09 16:27:05
|
Update of /cvsroot/linux-vax/kernel-2.4/net/irda/compressors In directory usw-pr-cvs1:/tmp/cvs-serv31773/irda/compressors Removed Files: Config.in Makefile irda_deflate.c Log Message: synch 2.4.15 commit 20 --- Config.in DELETED --- --- Makefile DELETED --- --- irda_deflate.c DELETED --- |
From: Andy P. <at...@us...> - 2002-04-09 16:27:05
|
Update of /cvsroot/linux-vax/kernel-2.4/net/irda/irlan In directory usw-pr-cvs1:/tmp/cvs-serv31773/irda/irlan Modified Files: irlan_common.c irlan_provider.c Log Message: synch 2.4.15 commit 20 Index: irlan_common.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/irlan/irlan_common.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- irlan_common.c 14 Jan 2001 17:16:37 -0000 1.1.1.1 +++ irlan_common.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -209,6 +209,7 @@ struct irlan_cb *self; IRDA_DEBUG(2, __FUNCTION__ "()\n"); + ASSERT(irlan != NULL, return NULL;); /* * Initialize the irlan structure. @@ -224,8 +225,6 @@ */ self->magic = IRLAN_MAGIC; - ASSERT(irlan != NULL, return NULL;); - sprintf(self->dev.name, "%s", "unknown"); self->dev.priv = (void *) self; @@ -1074,19 +1073,18 @@ { struct irlan_cb *self; unsigned long flags; + ASSERT(irlan != NULL, return 0;); save_flags(flags); cli(); - ASSERT(irlan != NULL, return 0;); - len = 0; len += sprintf(buf+len, "IrLAN instances:\n"); self = (struct irlan_cb *) hashbin_get_first(irlan); while (self != NULL) { - ASSERT(self->magic == IRLAN_MAGIC, return len;); + ASSERT(self->magic == IRLAN_MAGIC, break;); len += sprintf(buf+len, "ifname: %s,\n", self->dev.name); @@ -1186,6 +1184,7 @@ MODULE_AUTHOR("Dag Brattli <da...@cs...>"); MODULE_DESCRIPTION("The Linux IrDA LAN protocol"); +MODULE_LICENSE("GPL"); MODULE_PARM(eth, "i"); MODULE_PARM_DESC(eth, "Name devices ethX (0) or irlanX (1)"); Index: irlan_provider.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/irlan/irlan_provider.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- irlan_provider.c 14 Jan 2001 17:16:41 -0000 1.1.1.1 +++ irlan_provider.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -162,7 +162,7 @@ /* * Function irlan_provider_connect_response (handle) * - * Accept incomming connection + * Accept incoming connection * */ void irlan_provider_connect_response(struct irlan_cb *self, @@ -371,7 +371,7 @@ /* * Function irlan_provider_register(void) * - * Register provider support so we can accept incomming connections. + * Register provider support so we can accept incoming connections. * */ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) |
From: Andy P. <at...@us...> - 2002-04-09 16:27:04
|
Update of /cvsroot/linux-vax/kernel-2.4/net/irda/irnet In directory usw-pr-cvs1:/tmp/cvs-serv31773/irda/irnet Modified Files: Config.in irnet.h irnet_irda.c irnet_irda.h irnet_ppp.c irnet_ppp.h Log Message: synch 2.4.15 commit 20 Index: Config.in =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/irnet/Config.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Config.in 14 Jan 2001 17:16:43 -0000 1.1.1.1 +++ Config.in 9 Apr 2002 16:26:57 -0000 1.2 @@ -1 +1,4 @@ -dep_tristate ' IrNET protocol' CONFIG_IRNET $CONFIG_IRDA +if [ "$CONFIG_NETDEVICES" != "n" ]; then + dep_tristate ' IrNET protocol' CONFIG_IRNET $CONFIG_IRDA $CONFIG_PPP +fi + Index: irnet.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/irnet/irnet.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- irnet.h 14 Jan 2001 17:16:46 -0000 1.1.1.1 +++ irnet.h 9 Apr 2002 16:26:57 -0000 1.2 @@ -5,11 +5,11 @@ * * This file contains definitions and declarations global to the IrNET module, * all grouped in one place... - * This file is a private header, so other modules don't want to know + * This file is a *private* header, so other modules don't want to know * what's in there... * * Note : as most part of the Linux kernel, this module is available - * under the GNU Public License (GPL). + * under the GNU General Public License (GPL). */ #ifndef IRNET_H @@ -52,15 +52,13 @@ * o multipoint operation (limited by IrLAP specification) * o information in /proc/net/irda/irnet * o IrNET events on /dev/irnet (for user space daemon) - * o IrNET deamon (irnetd) to automatically handle incomming requests + * o IrNET daemon (irnetd) to automatically handle incoming requests * o Windows 2000 compatibility (tested, but need more work) * Currently missing : * o Lot's of testing (that's your job) * o Connection retries (may be too hard to do) * o Check pppd persist mode - * o User space deamon (to automatically handle incomming requests) - * o A registered device number (comming, waiting from an answer) - * o Final integration in Linux-IrDA (up to Dag) + * o User space daemon (to automatically handle incoming requests) * * The setup is not currently the most easy, but this should get much * better when everything will get integrated... @@ -109,16 +107,16 @@ * and allow to offer the event channel, useful for other stuff like debug. * * On the other hand, this require a loose coordination between the - * present module and irnetd. One critical area is how incomming request + * present module and irnetd. One critical area is how incoming request * are handled. - * When irnet receive an incomming request, it send an event to irnetd and - * drop the incomming IrNET socket. + * When irnet receive an incoming request, it send an event to irnetd and + * drop the incoming IrNET socket. * irnetd start a pppd instance, which create a new IrNET socket. This new * socket is then connected in the originating node to the pppd instance. * At this point, in the originating node, the first socket is closed. * * I admit, this is a bit messy and waste some ressources. The alternative - * is caching incomming socket, and that's also quite messy and waste + * is caching incoming socket, and that's also quite messy and waste * ressources. * We also make connection time slower. For example, on a 115 kb/s link it * adds 60ms to the connection time (770 ms). However, this is slower than @@ -128,17 +126,17 @@ * History : * ------- * - * v1 - 15/5/00 - Jean II + * v1 - 15.5.00 - Jean II * o Basic IrNET (hook to ppp_generic & IrTTP - incl. multipoint) * o control channel on /dev/irnet (set name/address) * o event channel on /dev/irnet (for user space daemon) * - * v2 - 5/6/00 - Jean II + * v2 - 5.6.00 - Jean II * o Enable DROP_NOT_READY to avoid PPP timeouts & other weirdness... * o Add DISCONNECT_TO event and rename DISCONNECT_FROM. * o Set official device number alloaction on /dev/irnet * - * v3 - 30/8/00 - Jean II + * v3 - 30.8.00 - Jean II * o Update to latest Linux-IrDA changes : * - queue_t => irda_queue_t * o Update to ppp-2.4.0 : @@ -150,15 +148,57 @@ * another multilink bug (darn !) * o Remove LINKNAME_IOCTL cruft * - * v3b - 31/8/00 - Jean II + * v3b - 31.8.00 - Jean II * o Dump discovery log at event channel startup * - * v4 - 28/9/00 - Jean II + * v4 - 28.9.00 - Jean II * o Fix interaction between poll/select and dump discovery log * o Add IRNET_BLOCKED_LINK event (depend on new IrDA-Linux patch) * o Add IRNET_NOANSWER_FROM event (mostly to help support) * o Release flow control in disconnect_indication * o Block packets while connecting (speed up connections) + * + * v5 - 11.01.01 - Jean II + * o Init self->max_header_size, just in case... + * o Set up ap->chan.hdrlen, to get zero copy on tx side working. + * o avoid tx->ttp->flow->ppp->tx->... loop, by checking flow state + * Thanks to Christian Gennerat for finding this bug ! + * --- + * o Declare the proper MTU/MRU that we can support + * (but PPP doesn't read the MTU value :-() + * o Declare hashbin HB_NOLOCK instead of HB_LOCAL to avoid + * disabling and enabling irq twice + * + * v6 - 31.05.01 - Jean II + * o Print source address in Found, Discovery, Expiry & Request events + * o Print requested source address in /proc/net/irnet + * o Change control channel input. Allow multiple commands in one line. + * o Add saddr command to change ap->rsaddr (and use that in IrDA) + * --- + * o Make the IrDA connection procedure totally asynchronous. + * Heavy rewrite of the IAS query code and the whole connection + * procedure. Now, irnet_connect() no longer need to be called from + * a process context... + * o Enable IrDA connect retries in ppp_irnet_send(). The good thing + * is that IrDA connect retries are directly driven by PPP LCP + * retries (we retry for each LCP packet), so that everything + * is transparently controlled from pppd lcp-max-configure. + * o Add ttp_connect flag to prevent rentry on the connect procedure + * o Test and fixups to eliminate side effects of retries + * + * v7 - 22.08.01 - Jean II + * o Cleanup : Change "saddr = 0x0" to "saddr = DEV_ADDR_ANY" + * o Fix bug in BLOCK_WHEN_CONNECT introduced in v6 : due to the + * asynchronous IAS query, self->tsap is NULL when PPP send the + * first packet. This was preventing "connect-delay 0" to work. + * Change the test in ppp_irnet_send() to self->ttp_connect. + * + * v8 - 1.11.01 - Jean II + * o Tighten the use of self->ttp_connect and self->ttp_open to + * prevent various race conditions. + * o Avoid leaking discovery log and skb + * o Replace "self" with "server" in irnet_connect_indication() to + * better detect cut'n'paste error ;-) */ /***************************** INCLUDES *****************************/ @@ -171,7 +211,10 @@ #include <linux/proc_fs.h> #include <linux/devfs_fs_kernel.h> #include <linux/netdevice.h> +#include <linux/miscdevice.h> #include <linux/poll.h> +#include <linux/config.h> +#include <linux/ctype.h> /* isspace() */ #include <asm/uaccess.h> #include <linux/ppp_defs.h> @@ -205,7 +248,7 @@ /* PPP side of the business */ #define BLOCK_WHEN_CONNECT /* Block packets when connecting */ -#undef CONNECT_IN_SEND /* Will crash hard your box... */ +#define CONNECT_IN_SEND /* Retry IrDA connection procedure */ #undef FLUSH_TO_PPP /* Not sure about this one, let's play safe */ #undef SECURE_DEVIRNET /* Bah... */ @@ -240,9 +283,11 @@ #define DEBUG_IRDA_SERV_INFO 0 /* various info */ #define DEBUG_IRDA_SERV_ERROR 1 /* problems */ #define DEBUG_IRDA_TCB_TRACE 0 /* IRDA IrTTP callbacks */ -#define DEBUG_IRDA_OCB_TRACE 0 /* IRDA other callbacks */ #define DEBUG_IRDA_CB_INFO 0 /* various info */ #define DEBUG_IRDA_CB_ERROR 1 /* problems */ +#define DEBUG_IRDA_OCB_TRACE 0 /* IRDA other callbacks */ +#define DEBUG_IRDA_OCB_INFO 0 /* various info */ +#define DEBUG_IRDA_OCB_ERROR 1 /* problems */ #define DEBUG_ASSERT 0 /* Verify all assertions */ @@ -342,13 +387,15 @@ /* ------------------------ IrTTP part ------------------------ */ /* We create a pseudo "socket" over the IrDA tranport */ int ttp_open; /* Set when IrTTP is ready */ + int ttp_connect; /* Set when IrTTP is connecting */ struct tsap_cb * tsap; /* IrTTP instance (the connection) */ char rname[NICKNAME_MAX_LEN + 1]; /* IrDA nickname of destination */ - __u32 raddr; /* Requested peer IrDA address */ - __u32 saddr; /* my local IrDA address */ + __u32 rdaddr; /* Requested peer IrDA address */ + __u32 rsaddr; /* Requested local IrDA address */ __u32 daddr; /* actual peer IrDA address */ + __u32 saddr; /* my local IrDA address */ __u8 dtsap_sel; /* Remote TSAP selector */ __u8 stsap_sel; /* Local TSAP selector */ @@ -365,17 +412,14 @@ int nslots; /* Number of slots for discovery */ struct iriap_cb * iriap; /* Used to query remote IAS */ - wait_queue_head_t query_wait; /* Wait for the answer to a query */ - struct ias_value * ias_result; /* Result of remote IAS query */ int errno; /* status of the IAS query */ - /* ---------------------- Optional parts ---------------------- */ -#ifdef INITIAL_DISCOVERY - /* Stuff used to dump discovery log */ + /* -------------------- Discovery log part -------------------- */ + /* Used by initial discovery on the control channel + * and by irnet_discover_daddr_and_lsap_sel() */ struct irda_device_info *discoveries; /* Copy of the discovery log */ int disco_index; /* Last read in the discovery log */ int disco_number; /* Size of the discovery log */ -#endif INITIAL_DISCOVERY } irnet_socket; @@ -402,8 +446,9 @@ { irnet_event event; int unit; - __u32 addr; - char name[NICKNAME_MAX_LEN + 1]; + __u32 saddr; + __u32 daddr; + char name[NICKNAME_MAX_LEN + 1]; /* 21 + 1 */ } irnet_log; /* @@ -450,4 +495,4 @@ /* Control channel stuff - allocated in irnet_irda.h */ extern struct irnet_ctrl_channel irnet_events; -#endif IRNET_H +#endif /* IRNET_H */ Index: irnet_irda.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/irnet/irnet_irda.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- irnet_irda.c 14 Jan 2001 17:16:52 -0000 1.1.1.1 +++ irnet_irda.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -8,7 +8,6 @@ * and exchange frames with IrTTP. */ -#include <linux/config.h> #include "irnet_irda.h" /* Private header */ /************************* CONTROL CHANNEL *************************/ @@ -27,14 +26,15 @@ static void irnet_post_event(irnet_socket * ap, irnet_event event, [...1272 lines suppressed...] len += sprintf(buf+len, "daddr: %08x, ", self->daddr); len += sprintf(buf+len, "stsap_sel: %02x, ", self->stsap_sel); @@ -1426,7 +1765,7 @@ memset(&irnet_server, 0, sizeof(struct irnet_root)); /* Setup start of irnet instance list */ - irnet_server.list = hashbin_new(HB_LOCAL); + irnet_server.list = hashbin_new(HB_NOLOCK); DABORT(irnet_server.list == NULL, -ENOMEM, MODULE_ERROR, "Can't allocate hashbin!\n"); /* Init spinlock for instance list */ @@ -1469,7 +1808,7 @@ #ifdef CONFIG_PROC_FS /* Remove our /proc file */ remove_proc_entry("irnet", proc_irda); -#endif CONFIG_PROC_FS +#endif /* CONFIG_PROC_FS */ /* Remove our IrNET server from existence */ irnet_destroy_server(); Index: irnet_irda.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/irnet/irnet_irda.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- irnet_irda.h 14 Jan 2001 17:16:53 -0000 1.1.1.1 +++ irnet_irda.h 9 Apr 2002 16:26:57 -0000 1.2 @@ -13,8 +13,8 @@ #define IRNET_IRDA_H /***************************** INCLUDES *****************************/ +/* Please add other headers in irnet.h */ -#include <linux/config.h> #include "irnet.h" /* Module global include */ /************************ CONSTANTS & MACROS ************************/ @@ -68,13 +68,22 @@ irnet_post_event(irnet_socket *, irnet_event, __u32, + __u32, char *); /* ----------------------- IRDA SUBROUTINES ----------------------- */ static inline int irnet_open_tsap(irnet_socket *); -static int +static inline __u8 + irnet_ias_to_tsap(irnet_socket *, + int, + struct ias_value *); +static inline int irnet_find_lsap_sel(irnet_socket *); static inline int + irnet_connect_tsap(irnet_socket *); +static inline int + irnet_discover_next_daddr(irnet_socket *); +static inline int irnet_discover_daddr_and_lsap_sel(irnet_socket *); static inline int irnet_dname_to_daddr(irnet_socket *); @@ -134,6 +143,11 @@ __u16, struct ias_value *, void *); +static void + irnet_discovervalue_confirm(int, + __u16, + struct ias_value *, + void *); #ifdef DISCOVERY_EVENTS static void irnet_discovery_indication(discovery_t *, @@ -149,7 +163,7 @@ char **, off_t, int); -#endif CONFIG_PROC_FS +#endif /* CONFIG_PROC_FS */ /**************************** VARIABLES ****************************/ @@ -164,6 +178,6 @@ /* The /proc/net/irda directory, defined elsewhere... */ #ifdef CONFIG_PROC_FS extern struct proc_dir_entry *proc_irda; -#endif CONFIG_PROC_FS +#endif /* CONFIG_PROC_FS */ -#endif IRNET_IRDA_H +#endif /* IRNET_IRDA_H */ Index: irnet_ppp.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/irnet/irnet_ppp.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- irnet_ppp.c 14 Jan 2001 17:16:56 -0000 1.1.1.1 +++ irnet_ppp.c 9 Apr 2002 16:26:57 -0000 1.2 @@ -14,6 +14,7 @@ */ #include "irnet_ppp.h" /* Private header */ +/* Please put other headers in irnet.h - Thanks */ /************************* CONTROL CHANNEL *************************/ /* @@ -37,13 +38,15 @@ const char * buf, size_t count) { - char command[5 + NICKNAME_MAX_LEN + 2]; - int length = count; + char command[IRNET_MAX_COMMAND]; + char * start; /* Current command beeing processed */ + char * next; /* Next command to process */ + int length; /* Length of current command */ DENTER(CTRL_TRACE, "(ap=0x%X, count=%d)\n", (unsigned int) ap, count); /* Check for overflow... */ - DABORT(count > (5 + NICKNAME_MAX_LEN + 1), -ENOMEM, + DABORT(count >= IRNET_MAX_COMMAND, -ENOMEM, CTRL_ERROR, "Too much data !!!\n"); /* Get the data in the driver */ @@ -53,58 +56,110 @@ return -EFAULT; } - /* Strip out '\n' if needed, and safe terminate the string */ - if(command[length - 1] == '\0') - length--; - if(command[length - 1] == '\n') - length--; - command[length] = '\0'; - DEBUG(CTRL_INFO, "Command received is ``%s'' (%d-%d).\n", - command, length, count); - - /* Check if we recognised the command */ - /* First command : name */ - if(!strncmp(command, "name", 4)) + /* Safe terminate the string */ + command[count] = '\0'; + DEBUG(CTRL_INFO, "Command line received is ``%s'' (%d).\n", + command, count); + + /* Check every commands in the command line */ + next = command; + while(next != NULL) { - /* Copy the name only if is included and not "any" */ - if((length > 5) && (strcmp(command + 5, "any"))) + /* Look at the next command */ + start = next; + + /* Scrap whitespaces before the command */ + while(isspace(*start)) + start++; + + /* ',' is our command separator */ + next = strchr(start, ','); + if(next) { - /* Copy the name for later reuse (including the '/0') */ - memcpy(ap->rname, command + 5, length - 5 + 1); + *next = '\0'; /* Terminate command */ + length = next - start; /* Length */ + next++; /* Skip the '\0' */ } else - ap->rname[0] = '\0'; - DEXIT(CTRL_TRACE, " - rname = ``%s''\n", ap->rname); - return(count); - } + length = strlen(start); - /* Second command : addr */ - if(!strncmp(command, "addr", 4)) - { - /* Copy the address only if is included and not "any" */ - if((length > 5) && (strcmp(command + 5, "any"))) + DEBUG(CTRL_INFO, "Found command ``%s'' (%d).\n", start, length); + + /* Check if we recognised one of the known command + * We can't use "switch" with strings, so hack with "continue" */ + + /* First command : name -> Requested IrDA nickname */ + if(!strncmp(start, "name", 4)) { - char * endp; - __u32 daddr; + /* Copy the name only if is included and not "any" */ + if((length > 5) && (strcmp(start + 5, "any"))) + { + /* Strip out trailing whitespaces */ + while(isspace(start[length - 1])) + length--; + + /* Copy the name for later reuse */ + memcpy(ap->rname, start + 5, length - 5); + ap->rname[length - 5] = '\0'; + } + else + ap->rname[0] = '\0'; + DEBUG(CTRL_INFO, "Got rname = ``%s''\n", ap->rname); - /* Convert argument to a number (last arg is the base) */ - daddr = simple_strtoul(command + 5, &endp, 16); - /* Has it worked ? (endp should be command + count) */ - DABORT(endp <= (command + 5), -EINVAL, - CTRL_ERROR, "Invalid address.\n"); - /* Save it */ - ap->raddr = daddr; + /* Restart the loop */ + continue; } - else - ap->raddr = DEV_ADDR_ANY; - DEXIT(CTRL_TRACE, " - raddr = %08x\n", ap->raddr); - return(count); - } - /* Other possible command : connect N (number of retries) */ + /* Second command : addr, daddr -> Requested IrDA destination address + * Also process : saddr -> Requested IrDA source address */ + if((!strncmp(start, "addr", 4)) || + (!strncmp(start, "daddr", 5)) || + (!strncmp(start, "saddr", 5))) + { + __u32 addr = DEV_ADDR_ANY; + + /* Copy the address only if is included and not "any" */ + if((length > 5) && (strcmp(start + 5, "any"))) + { + char * begp = start + 5; + char * endp; - /* Failed... */ - DABORT(1, -EINVAL, CTRL_ERROR, "Not a recognised IrNET command.\n"); + /* Scrap whitespaces before the command */ + while(isspace(*begp)) + begp++; + + /* Convert argument to a number (last arg is the base) */ + addr = simple_strtoul(begp, &endp, 16); + /* Has it worked ? (endp should be start + length) */ + DABORT(endp <= (start + 5), -EINVAL, + CTRL_ERROR, "Invalid address.\n"); + } + /* Which type of address ? */ + if(start[0] == 's') + { + /* Save it */ + ap->rsaddr = addr; + DEBUG(CTRL_INFO, "Got rsaddr = %08x\n", ap->rsaddr); + } + else + { + /* Save it */ + ap->rdaddr = addr; + DEBUG(CTRL_INFO, "Got rdaddr = %08x\n", ap->rdaddr); + } + + /* Restart the loop */ + continue; + } + + /* Other possible command : connect N (number of retries) */ + + /* No command matched -> Failed... */ + DABORT(1, -EINVAL, CTRL_ERROR, "Not a recognised IrNET command.\n"); + } + + /* Success : we have parsed all commands successfully */ + return(count); } #ifdef INITIAL_DISCOVERY @@ -145,7 +200,8 @@ __u16 mask = irlmp_service_to_hint(S_LAN); /* Ask IrLMP for the current discovery log */ - ap->discoveries = irlmp_get_discoveries(&ap->disco_number, mask); + ap->discoveries = irlmp_get_discoveries(&ap->disco_number, mask, + DISCOVERY_DEFAULT_SLOTS); /* Check if the we got some results */ if(ap->discoveries == NULL) ap->disco_number = -1; @@ -157,9 +213,10 @@ if(ap->disco_index < ap->disco_number) { /* Write an event */ - sprintf(event, "Found %08x (%s)\n", + sprintf(event, "Found %08x (%s) behind %08x\n", ap->discoveries[ap->disco_index].daddr, - ap->discoveries[ap->disco_index].info); + ap->discoveries[ap->disco_index].info, + ap->discoveries[ap->disco_index].saddr); DEBUG(CTRL_INFO, "Writing discovery %d : %s\n", ap->disco_index, ap->discoveries[ap->disco_index].info); @@ -186,7 +243,7 @@ return done_event; } -#endif INITIAL_DISCOVERY +#endif /* INITIAL_DISCOVERY */ /*------------------------------------------------------------------*/ /* @@ -221,7 +278,7 @@ DEXIT(CTRL_TRACE, "\n"); return(strlen(event)); } -#endif INITIAL_DISCOVERY +#endif /* INITIAL_DISCOVERY */ /* Put ourselves on the wait queue to be woken up */ add_wait_queue(&irnet_events.rwait, &wait); @@ -256,53 +313,56 @@ switch(irnet_events.log[ap->event_index].event) { case IRNET_DISCOVER: - sprintf(event, "Discovered %08x (%s)\n", - irnet_events.log[ap->event_index].addr, - irnet_events.log[ap->event_index].name); + sprintf(event, "Discovered %08x (%s) behind %08x\n", + irnet_events.log[ap->event_index].daddr, + irnet_events.log[ap->event_index].name, + irnet_events.log[ap->event_index].saddr); break; case IRNET_EXPIRE: - sprintf(event, "Expired %08x (%s)\n", - irnet_events.log[ap->event_index].addr, - irnet_events.log[ap->event_index].name); + sprintf(event, "Expired %08x (%s) behind %08x\n", + irnet_events.log[ap->event_index].daddr, + irnet_events.log[ap->event_index].name, + irnet_events.log[ap->event_index].saddr); break; case IRNET_CONNECT_TO: sprintf(event, "Connected to %08x (%s) on ppp%d\n", - irnet_events.log[ap->event_index].addr, + irnet_events.log[ap->event_index].daddr, irnet_events.log[ap->event_index].name, irnet_events.log[ap->event_index].unit); break; case IRNET_CONNECT_FROM: sprintf(event, "Connection from %08x (%s) on ppp%d\n", - irnet_events.log[ap->event_index].addr, + irnet_events.log[ap->event_index].daddr, irnet_events.log[ap->event_index].name, irnet_events.log[ap->event_index].unit); break; case IRNET_REQUEST_FROM: - sprintf(event, "Request from %08x (%s)\n", - irnet_events.log[ap->event_index].addr, - irnet_events.log[ap->event_index].name); + sprintf(event, "Request from %08x (%s) behind %08x\n", + irnet_events.log[ap->event_index].daddr, + irnet_events.log[ap->event_index].name, + irnet_events.log[ap->event_index].saddr); break; case IRNET_NOANSWER_FROM: sprintf(event, "No-answer from %08x (%s) on ppp%d\n", - irnet_events.log[ap->event_index].addr, + irnet_events.log[ap->event_index].daddr, irnet_events.log[ap->event_index].name, irnet_events.log[ap->event_index].unit); break; case IRNET_BLOCKED_LINK: sprintf(event, "Blocked link with %08x (%s) on ppp%d\n", - irnet_events.log[ap->event_index].addr, + irnet_events.log[ap->event_index].daddr, irnet_events.log[ap->event_index].name, irnet_events.log[ap->event_index].unit); break; case IRNET_DISCONNECT_FROM: sprintf(event, "Disconnection from %08x (%s) on ppp%d\n", - irnet_events.log[ap->event_index].addr, + irnet_events.log[ap->event_index].daddr, irnet_events.log[ap->event_index].name, irnet_events.log[ap->event_index].unit); break; case IRNET_DISCONNECT_TO: sprintf(event, "Disconnected to %08x (%s)\n", - irnet_events.log[ap->event_index].addr, + irnet_events.log[ap->event_index].daddr, irnet_events.log[ap->event_index].name); break; default: @@ -346,7 +406,7 @@ #ifdef INITIAL_DISCOVERY if(ap->disco_number != -1) mask |= POLLIN | POLLRDNORM; -#endif INITIAL_DISCOVERY +#endif /* INITIAL_DISCOVERY */ DEXIT(CTRL_TRACE, " - mask=0x%X\n", mask); return mask; @@ -379,7 +439,7 @@ /* This could (should?) be enforced by the permissions on /dev/irnet. */ if(!capable(CAP_NET_ADMIN)) return -EPERM; -#endif SECURE_DEVIRNET +#endif /* SECURE_DEVIRNET */ /* Allocate a private structure for this IrNET instance */ ap = kmalloc(sizeof(*ap), GFP_KERNEL); @@ -394,8 +454,11 @@ /* PPP channel setup */ ap->ppp_open = 0; ap->chan.private = ap; + ap->chan.ops = &irnet_ppp_ops; + ap->chan.mtu = (2048 - TTP_MAX_HEADER - 2 - PPP_HDRLEN); + ap->chan.hdrlen = 2 + TTP_MAX_HEADER; /* for A/C + Max IrDA hdr */ /* PPP parameters */ - ap->mru = PPP_MRU; + ap->mru = (2048 - TTP_MAX_HEADER - 2 - PPP_HDRLEN); ap->xaccm[0] = ~0U; ap->xaccm[3] = 0x60000000U; ap->raccm = ~0U; @@ -476,7 +539,7 @@ /* If we are connected to ppp_generic, let it handle the job */ if(ap->ppp_open) - return ppp_channel_write(&ap->chan, buf, count); + return -EAGAIN; else return irnet_ctrl_write(ap, buf, count); } @@ -500,7 +563,7 @@ /* If we are connected to ppp_generic, let it handle the job */ if(ap->ppp_open) - return ppp_channel_read(&ap->chan, file, buf, count); + return -EAGAIN; else return irnet_ctrl_read(ap, file, buf, count); } @@ -523,9 +586,7 @@ DABORT(ap == NULL, mask, FS_ERROR, "ap is NULL !!!\n"); /* If we are connected to ppp_generic, let it handle the job */ - if(ap->ppp_open) - mask |= ppp_channel_poll(&ap->chan, file, wait); - else + if(!ap->ppp_open) mask |= irnet_ctrl_poll(ap, file, wait); DEXIT(FS_TRACE, " - mask=0x%X\n", mask); @@ -556,7 +617,7 @@ #ifdef SECURE_DEVIRNET if(!capable(CAP_NET_ADMIN)) return -EPERM; -#endif SECURE_DEVIRNET +#endif /* SECURE_DEVIRNET */ err = -EFAULT; switch(cmd) @@ -568,10 +629,7 @@ if((val == N_SYNC_PPP) || (val == N_PPP)) { DEBUG(FS_INFO, "Entering PPP discipline.\n"); - /* PPP channel setup */ - ap->chan.private = ap; - ap->chan.ops = &irnet_ppp_ops; - ap->chan.mtu = PPP_MRU; + /* PPP channel setup (ap->chan in configued in dev_irnet_open())*/ err = ppp_register_channel(&ap->chan); if(err == 0) { @@ -599,15 +657,6 @@ } break; - /* Attach this PPP instance to the PPP driver (set it active) */ - case PPPIOCATTACH: - case PPPIOCDETACH: - if(ap->ppp_open) - err = ppp_channel_ioctl(&ap->chan, cmd, arg); - else - DERROR(FS_ERROR, "Channel not registered !\n"); - break; - /* Query PPP channel and unit number */ case PPPIOCGCHAN: if(!ap->ppp_open) @@ -683,7 +732,7 @@ * we get rid of our own buffers */ #ifdef FLUSH_TO_PPP ppp_output_wakeup(&ap->chan); -#endif FLUSH_TO_PPP +#endif /* FLUSH_TO_PPP */ err = 0; break; @@ -769,7 +818,7 @@ /* prepend address/control fields if necessary */ if(needaddr) { - skb_push(skb,2); + skb_push(skb, 2); skb->data[0] = PPP_ALLSTATIONS; skb->data[1] = PPP_UI; } @@ -801,20 +850,18 @@ DASSERT(self != NULL, 0, PPP_ERROR, "Self is NULL !!!\n"); /* Check if we are connected */ - if(self->ttp_open == 0) + if(!(test_bit(0, &self->ttp_open))) { #ifdef CONNECT_IN_SEND /* Let's try to connect one more time... */ - /* Note : we won't connect fully yet, but we should be ready for - * next packet... */ - /* Note : we can't do that, we need to have a process context to - * go through interruptible_sleep_on() in irnet_find_lsap_sel() - * We need to find another way... */ + /* Note : we won't be connected after this call, but we should be + * ready for next packet... */ + /* If we are already connecting, this will fail */ irda_irnet_connect(self); -#endif CONNECT_IN_SEND +#endif /* CONNECT_IN_SEND */ - DEBUG(PPP_INFO, "IrTTP not ready ! (%d-0x%X)\n", - self->ttp_open, (unsigned int) self->tsap); + DEBUG(PPP_INFO, "IrTTP not ready ! (%d-%d)\n", + self->ttp_open, self->ttp_connect); /* Note : we can either drop the packet or block the packet. * @@ -837,12 +884,12 @@ */ #ifdef BLOCK_WHEN_CONNECT /* If we are attempting to connect */ - if(self->tsap) + if(test_bit(0, &self->ttp_connect)) { /* Blocking packet, ppp_generic will retry later */ return 0; } -#endif BLOCK_WHEN_CONNECT +#endif /* BLOCK_WHEN_CONNECT */ /* Dropping packet, pppd will retry later */ dev_kfree_skb(skb); @@ -1050,3 +1097,4 @@ return ppp_irnet_cleanup(); } #endif /* MODULE */ +MODULE_LICENSE("GPL"); Index: irnet_ppp.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/irda/irnet/irnet_ppp.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- irnet_ppp.h 14 Jan 2001 17:16:57 -0000 1.1.1.1 +++ irnet_ppp.h 9 Apr 2002 16:26:57 -0000 1.2 @@ -22,13 +22,8 @@ #define IRNET_MAJOR 10 /* Misc range */ #define IRNET_MINOR 187 /* Official allocation */ -#ifdef LINKNAME_IOCTL -/* Compatibility with old ppp drivers - * Should be defined in <linux/if_ppp.h> */ -#ifndef PPPIOCSLINKNAME -#define PPPIOCSLINKNAME _IOW('t', 74, struct ppp_option_data) -#endif PPPIOCSLINKNAME -#endif LINKNAME_IOCTL +/* IrNET control channel stuff */ +#define IRNET_MAX_COMMAND 256 /* Max length of a command line */ /* PPP hardcore stuff */ @@ -127,4 +122,4 @@ ppp_irnet_ioctl }; -#endif IRNET_PPP_H +#endif /* IRNET_PPP_H */ |
From: Andy P. <at...@us...> - 2002-04-09 16:22:16
|
Update of /cvsroot/linux-vax/kernel-2.4/net/econet In directory usw-pr-cvs1:/tmp/cvs-serv30993/econet Modified Files: Makefile af_econet.c Removed Files: sysctl_net_ec.c Log Message: synch 2.4.15 commit 19 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/econet/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 17:13:12 -0000 1.1.1.1 +++ Makefile 9 Apr 2002 16:22:03 -0000 1.2 @@ -9,7 +9,8 @@ O_TARGET := econet.o -obj-y := af_econet.o sysctl_net_ec.o +obj-y := af_econet.o obj-m := $(O_TARGET) include $(TOPDIR)/Rules.make + Index: af_econet.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/econet/af_econet.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- af_econet.c 14 Jan 2001 17:13:15 -0000 1.1.1.1 +++ af_econet.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -68,7 +68,7 @@ unsigned long handle; }; -static unsigned long aun_seq = 0; +static unsigned long aun_seq; /* Queue of packets waiting to be transmitted. */ static struct sk_buff_head aun_queue; @@ -172,9 +172,8 @@ * Check legality */ - if (addr_len < sizeof(struct sockaddr_ec)) - return -EINVAL; - if (sec->sec_family != AF_ECONET) + if (addr_len < sizeof(struct sockaddr_ec) || + sec->sec_family != AF_ECONET) return -EINVAL; sk->protinfo.af_econet->cb = sec->cb; @@ -297,7 +296,7 @@ #ifdef CONFIG_ECONET_NATIVE atomic_inc(&dev->refcnt); - skb = sock_alloc_send_skb(sk, len+dev->hard_header_len+15, 0, + skb = sock_alloc_send_skb(sk, len+dev->hard_header_len+15, msg->msg_flags & MSG_DONTWAIT, &err); if (skb==NULL) goto out_unlock; @@ -410,7 +409,7 @@ } /* Get a skbuff (no data, just holds our cb information) */ - if ((skb = sock_alloc_send_skb(sk, 0, 0, + if ((skb = sock_alloc_send_skb(sk, 0, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) return err; @@ -485,7 +484,6 @@ static int econet_release(struct socket *sock) { - struct sk_buff *skb; struct sock *sk = sock->sk; if (!sk) @@ -505,8 +503,7 @@ /* Purge queues */ - while ((skb=skb_dequeue(&sk->receive_queue))!=NULL) - kfree_skb(skb); + skb_queue_purge(&sk->receive_queue); if (atomic_read(&sk->rmem_alloc) || atomic_read(&sk->wmem_alloc)) { sk->timer.data=(unsigned long)sk; @@ -695,8 +692,8 @@ } static struct net_proto_family econet_family_ops = { - PF_ECONET, - econet_create + family: PF_ECONET, + create: econet_create, }; static struct proto_ops SOCKOPS_WRAPPED(econet_ops) = { @@ -717,6 +714,7 @@ sendmsg: econet_sendmsg, recvmsg: econet_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; #include <linux/smp_lock.h> @@ -726,7 +724,7 @@ * Find the listening socket, if any, for the given data. */ -struct sock *ec_listening_socket(unsigned char port, unsigned char +static struct sock *ec_listening_socket(unsigned char port, unsigned char station, unsigned char net) { struct sock *sk = econet_sklist; @@ -1064,18 +1062,13 @@ hdr->port); } -struct packet_type econet_packet_type= -{ - 0, - NULL, - econet_rcv, - NULL, - NULL +static struct packet_type econet_packet_type = { + type: __constant_htons(ETH_P_ECONET), + func: econet_rcv, }; static void econet_hw_initialise(void) { - econet_packet_type.type = htons(ETH_P_ECONET); dev_add_pack(&econet_packet_type); } @@ -1104,15 +1097,12 @@ return NOTIFY_DONE; } -struct notifier_block econet_netdev_notifier={ - econet_notifier, - NULL, - 0 +static struct notifier_block econet_netdev_notifier = { + notifier_call: econet_notifier, }; -void __exit econet_proto_exit(void) +static void __exit econet_proto_exit(void) { - extern void econet_sysctl_unregister(void); #ifdef CONFIG_ECONET_AUNUDP del_timer(&ab_cleanup_timer); if (udpsock) @@ -1120,14 +1110,10 @@ #endif unregister_netdevice_notifier(&econet_netdev_notifier); sock_unregister(econet_family_ops.family); -#ifdef CONFIG_SYSCTL - econet_sysctl_unregister(); -#endif } -int __init econet_proto_init(void) +static int __init econet_proto_init(void) { - extern void econet_sysctl_register(void); sock_register(&econet_family_ops); #ifdef CONFIG_ECONET_AUNUDP spin_lock_init(&aun_queue_lock); @@ -1137,9 +1123,6 @@ econet_hw_initialise(); #endif register_netdevice_notifier(&econet_netdev_notifier); -#ifdef CONFIG_SYSCTL - econet_sysctl_register(); -#endif return 0; } --- sysctl_net_ec.c DELETED --- |
From: Andy P. <at...@us...> - 2002-04-09 16:22:14
|
Update of /cvsroot/linux-vax/kernel-2.4/net/ethernet In directory usw-pr-cvs1:/tmp/cvs-serv30993/ethernet Modified Files: Makefile eth.c Log Message: synch 2.4.15 commit 19 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ethernet/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 17:08:11 -0000 1.1.1.1 +++ Makefile 9 Apr 2002 16:22:03 -0000 1.2 @@ -26,6 +26,3 @@ obj-$(CONFIG_NET) := $(OBJS) $(OBJ2) include $(TOPDIR)/Rules.make - -tar: - tar -cvf /dev/f1 . Index: eth.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ethernet/eth.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- eth.c 14 Jan 2001 17:08:12 -0000 1.1.1.1 +++ eth.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -30,6 +30,7 @@ * Alan Cox : Protect against forwarding explosions with * older network drivers and IFF_ALLMULTI. * Christer Weinigel : Better rebuild header message. + * Andrew Morton : 26Feb01: kill ether_setup() - use netdev_boot_setup(). * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -60,31 +61,9 @@ #include <asm/system.h> #include <asm/checksum.h> -static int __init eth_setup(char *str) -{ - int ints[5]; - struct ifmap map; +extern int __init netdev_boot_setup(char *str); - str = get_options(str, ARRAY_SIZE(ints), ints); - if (!str || !*str) - return 0; - - /* Save settings */ - memset(&map, -1, sizeof(map)); - if (ints[0] > 0) - map.irq = ints[1]; - if (ints[0] > 1) - map.base_addr = ints[2]; - if (ints[0] > 2) - map.mem_start = ints[3]; - if (ints[0] > 3) - map.mem_end = ints[4]; - - /* Add new entry to the list */ - return netdev_boot_setup_add(str, &map); -} - -__setup("ether=", eth_setup); +__setup("ether=", netdev_boot_setup); /* * Create the Ethernet MAC header for an arbitrary protocol layer |
From: Andy P. <at...@us...> - 2002-04-09 16:22:12
|
Update of /cvsroot/linux-vax/kernel-2.4/net/decnet In directory usw-pr-cvs1:/tmp/cvs-serv30993/decnet Modified Files: af_decnet.c dn_dev.c dn_nsp_in.c dn_route.c sysctl_net_decnet.c Log Message: synch 2.4.15 commit 19 Index: af_decnet.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/decnet/af_decnet.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- af_decnet.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ af_decnet.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -1003,6 +1003,9 @@ if (DN_SK(newsk)->segsize_rem < 230) DN_SK(newsk)->segsize_rem = 230; + if ((DN_SK(newsk)->services_rem & NSP_FC_MASK) == NSP_FC_NONE) + DN_SK(newsk)->max_window = decnet_no_fc_max_cwnd; + newsk->state = TCP_LISTEN; newsk->zapped = 0; @@ -1072,7 +1075,9 @@ lock_sock(sk); if (peer) { - if (sock->state != SS_CONNECTED && scp->accept_mode == ACC_IMMED) + if ((sock->state != SS_CONNECTED && + sock->state != SS_CONNECTING) && + scp->accept_mode == ACC_IMMED) return -ENOTCONN; memcpy(sa, &scp->peer, sizeof(struct sockaddr_dn)); @@ -1431,10 +1436,13 @@ struct sock *sk = sock->sk; struct dn_scp *scp = DN_SK(sk); struct linkinfo_dn link; - int r_len = *optlen; + unsigned int r_len; void *r_data = NULL; - int val; + unsigned int val; + if(get_user(r_len , optlen)) + return -EFAULT; + switch(optname) { case DSO_CONDATA: if (r_len > sizeof(struct optdata_dn)) @@ -1485,7 +1493,11 @@ default: #ifdef CONFIG_NETFILTER { - int val, len = *optlen; + int val, len; + + if(get_user(len, optlen)) + return -EFAULT; + val = nf_getsockopt(sk, PF_DECnet, optname, optval, &len); if (val >= 0) @@ -2125,6 +2137,7 @@ sendmsg: dn_sendmsg, recvmsg: dn_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; #ifdef CONFIG_SYSCTL @@ -2137,6 +2150,7 @@ EXPORT_NO_SYMBOLS; MODULE_DESCRIPTION("The Linux DECnet Network Protocol"); MODULE_AUTHOR("Linux DECnet Project Team"); +MODULE_LICENSE("GPL"); static int addr[2] = {0, 0}; @@ -2144,7 +2158,7 @@ MODULE_PARM_DESC(addr, "The DECnet address of this machine: area,node"); #endif -static char banner[] __initdata = KERN_INFO "NET4: DECnet for Linux: V.2.4.0-test12s (C) 1995-2000 Linux DECnet Project Team\n"; +static char banner[] __initdata = KERN_INFO "NET4: DECnet for Linux: V.2.4.9s (C) 1995-2001 Linux DECnet Project Team\n"; static int __init decnet_init(void) { Index: dn_dev.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/decnet/dn_dev.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- dn_dev.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ dn_dev.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -68,106 +68,77 @@ static struct dn_dev_parms dn_dev_list[] = { { - ARPHRD_ETHER, /* Ethernet */ - DN_DEV_BCAST, - DN_DEV_S_RU, - 0, - 1498, - 1, - 10, - 0, - "ethernet", - NET_DECNET_CONF_ETHER, - dn_eth_up, - NULL, - dn_send_brd_hello, - NULL + type: ARPHRD_ETHER, /* Ethernet */ + mode: DN_DEV_BCAST, + state: DN_DEV_S_RU, + blksize: 1498, + t2: 1, + t3: 10, + name: "ethernet", + ctl_name: NET_DECNET_CONF_ETHER, + up: dn_eth_up, + timer3: dn_send_brd_hello, }, { - ARPHRD_IPGRE, /* DECnet tunneled over GRE in IP */ - DN_DEV_BCAST, - DN_DEV_S_RU, - 0, - 1400, - 1, - 10, - 0, - "ipgre", - NET_DECNET_CONF_GRE, - NULL, - NULL, - dn_send_brd_hello, - NULL + type: ARPHRD_IPGRE, /* DECnet tunneled over GRE in IP */ + mode: DN_DEV_BCAST, + state: DN_DEV_S_RU, + blksize: 1400, + t2: 1, + t3: 10, + name: "ipgre", + ctl_name: NET_DECNET_CONF_GRE, + timer3: dn_send_brd_hello, }, #if 0 { - ARPHRD_X25, /* Bog standard X.25 */ - DN_DEV_UCAST, - DN_DEV_S_DS, - 0, - 230, - 1, - 120, - 0, - "x25", - NET_DECNET_CONF_X25, - NULL, - NULL, - dn_send_ptp_hello, - NULL + type: ARPHRD_X25, /* Bog standard X.25 */ + mode: DN_DEV_UCAST, + state: DN_DEV_S_DS, + blksize: 230, + t2: 1, + t3: 120, + name: "x25", + ctl_name: NET_DECNET_CONF_X25, + timer3: dn_send_ptp_hello, }, #endif #if 0 { - ARPHRD_PPP, /* DECnet over PPP */ - DN_DEV_BCAST, - DN_DEV_S_RU, - 0, - 230, - 1, - 10, - 0, - "ppp", - NET_DECNET_CONF_PPP, - NULL, - NULL, - dn_send_brd_hello, - NULL + type: ARPHRD_PPP, /* DECnet over PPP */ + mode: DN_DEV_BCAST, + state: DN_DEV_S_RU, + blksize: 230, + t2: 1, + t3: 10, + name: "ppp", + ctl_name: NET_DECNET_CONF_PPP, + timer3: dn_send_brd_hello, }, #endif #if 0 { - ARPHRD_DDCMP, /* DECnet over DDCMP */ - DN_DEV_UCAST, - DN_DEV_S_DS, - 0, - 230, - 1, - 120, - 0, - "ddcmp", - NET_DECNET_CONF_DDCMP, - NULL, - NULL, - dn_send_ptp_hello, - NULL + type: ARPHRD_DDCMP, /* DECnet over DDCMP */ + mode: DN_DEV_UCAST, + state: DN_DEV_S_DS, + blksize: 230, + t2: 1, + t3: 120, + name: "ddcmp", + ctl_name: NET_DECNET_CONF_DDCMP, + timer3: dn_send_ptp_hello, }, #endif { - ARPHRD_LOOPBACK, /* Loopback interface - always last */ - DN_DEV_BCAST, - DN_DEV_S_RU, - 0, - 1498, - 1, - 10, - 0, - "loopback", - NET_DECNET_CONF_LOOPBACK, - NULL, - NULL, - dn_send_brd_hello, - NULL + type: ARPHRD_LOOPBACK, /* Loopback interface - always last */ + mode: DN_DEV_BCAST, + state: DN_DEV_S_RU, + blksize: 1498, + t2: 1, + t3: 10, + name: "loopback", + ctl_name: NET_DECNET_CONF_LOOPBACK, + timer3: dn_send_brd_hello, } }; @@ -182,7 +153,7 @@ static int min_t3[] = { 1 }; static int max_t3[] = { 8191 }; /* Must fit in 16 bits when multiplied by BCT3MULT or T3MULT */ -static int min_priority[] = { 0 }; +static int min_priority[1]; static int max_priority[] = { 127 }; /* From DECnet spec */ static int dn_forwarding_proc(ctl_table *, int, struct file *, @@ -344,7 +315,8 @@ if (newlen != sizeof(int)) return -EINVAL; - get_user(value, (int *)newval); + if (get_user(value, (int *)newval)) + return -EFAULT; if (value < 0) return -EINVAL; if (value > 2) Index: dn_nsp_in.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/decnet/dn_nsp_in.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- dn_nsp_in.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ dn_nsp_in.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -355,6 +355,9 @@ scp->info_rem = cb->info; scp->segsize_rem = cb->segsize; + if ((scp->services_rem & NSP_FC_MASK) == NSP_FC_NONE) + scp->max_window = decnet_no_fc_max_cwnd; + if (skb->len > 0) { unsigned char dlen = *skb->data; if ((dlen <= 16) && (dlen <= skb->len)) { Index: dn_route.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/decnet/dn_route.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- dn_route.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ dn_route.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -638,8 +638,8 @@ { struct dn_skb_cb *cb = DN_SKB_CB(skb); struct dst_entry *dst = skb->dst; - struct net_device *dev = skb->dev; struct neighbour *neigh; + struct net_device *dev = skb->dev; int err = -EINVAL; if ((neigh = dst->neighbour) == NULL) Index: sysctl_net_decnet.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/decnet/sysctl_net_decnet.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- sysctl_net_decnet.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ sysctl_net_decnet.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -27,12 +27,13 @@ #include <net/dn_route.h> -int decnet_debug_level = 0; +int decnet_debug_level; int decnet_time_wait = 30; int decnet_dn_count = 1; int decnet_di_count = 3; int decnet_dr_count = 3; int decnet_log_martians = 1; +int decnet_no_fc_max_cwnd = NSP_MIN_WINDOW; #ifdef CONFIG_SYSCTL extern int decnet_dst_gc_interval; @@ -42,6 +43,8 @@ static int max_state_count[] = { NSP_MAXRXTSHIFT }; static int min_decnet_dst_gc_interval[] = { 1 }; static int max_decnet_dst_gc_interval[] = { 60 }; +static int min_decnet_no_fc_max_cwnd[] = { NSP_MIN_WINDOW }; +static int max_decnet_no_fc_max_cwnd[] = { NSP_MAX_WINDOW }; static char node_name[7] = "???"; static struct ctl_table_header *dn_table_header = NULL; @@ -344,6 +347,10 @@ sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &min_decnet_dst_gc_interval, &max_decnet_dst_gc_interval}, + {NET_DECNET_NO_FC_MAX_CWND, "no_fc_max_cwnd", &decnet_no_fc_max_cwnd, + sizeof(int), 0644, + NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, + &min_decnet_no_fc_max_cwnd, &max_decnet_no_fc_max_cwnd}, {NET_DECNET_DEBUG_LEVEL, "debug", &decnet_debug_level, sizeof(int), 0644, NULL, &proc_dointvec, &sysctl_intvec, NULL, |
Update of /cvsroot/linux-vax/kernel-2.4/net/bluetooth In directory usw-pr-cvs1:/tmp/cvs-serv30993/bluetooth Added Files: Config.in Makefile af_bluetooth.c hci_core.c hci_sock.c l2cap_core.c l2cap_proc.c lib.c syms.c Log Message: synch 2.4.15 commit 19 --- NEW FILE --- # # Bluetooth configuration # if [ "$CONFIG_NET" != "n" ]; then mainmenu_option next_comment comment 'Bluetooth support' dep_tristate 'Bluetooth subsystem support' CONFIG_BLUEZ $CONFIG_NET if [ "$CONFIG_BLUEZ" != "n" ]; then dep_tristate 'L2CAP protocol support' CONFIG_BLUEZ_L2CAP $CONFIG_BLUEZ source drivers/bluetooth/Config.in fi endmenu fi --- NEW FILE --- # # Makefile for the Bluetooth subsystem # O_TARGET := bluetooth.o list-multi := hci.o l2cap.o export-objs := syms.o hci-objs := af_bluetooth.o hci_core.o hci_sock.o lib.o syms.o l2cap-objs := l2cap_core.o l2cap_proc.o obj-$(CONFIG_BLUEZ) += hci.o obj-$(CONFIG_BLUEZ_L2CAP) += l2cap.o include $(TOPDIR)/Rules.make hci.o: $(hci-objs) $(LD) -r -o $@ $(hci-objs) l2cap.o: $(l2cap-objs) $(LD) -r -o $@ $(l2cap-objs) --- NEW FILE --- /* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated Written 2000,2001 by Maxim Krasnyansky <ma...@qu...> 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 published by the Free Software Foundation; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 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 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ /* * BlueZ Bluetooth address family and sockets. * * $Id: af_bluetooth.c,v 1.1 2002/04/09 16:22:03 atp Exp $ */ #define VERSION "1.1" #include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/major.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/skbuff.h> #include <linux/init.h> #include <linux/proc_fs.h> #include <net/sock.h> #if defined(CONFIG_KMOD) #include <linux/kmod.h> #endif #include <net/bluetooth/bluetooth.h> #include <net/bluetooth/bluez.h> /* Bluetooth sockets */ static struct net_proto_family *bluez_sock[BLUEZ_MAX_PROTO]; int bluez_sock_register(int proto, struct net_proto_family *ops) { if (proto > BLUEZ_MAX_PROTO) return -EINVAL; if (bluez_sock[proto]) return -EEXIST; bluez_sock[proto] = ops; return 0; } int bluez_sock_unregister(int proto) { if (proto > BLUEZ_MAX_PROTO) return -EINVAL; if (!bluez_sock[proto]) return -ENOENT; bluez_sock[proto] = NULL; return 0; } static int bluez_sock_create(struct socket *sock, int proto) { if (proto > BLUEZ_MAX_PROTO) return -EINVAL; #if defined(CONFIG_KMOD) if (!bluez_sock[proto]) { char module_name[30]; sprintf(module_name, "bt-proto-%d", proto); request_module(module_name); } #endif if (!bluez_sock[proto]) return -ENOENT; return bluez_sock[proto]->create(sock, proto); } void bluez_sock_link(struct bluez_sock_list *l, struct sock *sk) { write_lock(&l->lock); sk->next = l->head; l->head = sk; sock_hold(sk); write_unlock(&l->lock); } void bluez_sock_unlink(struct bluez_sock_list *l, struct sock *sk) { struct sock **skp; write_lock(&l->lock); for (skp = &l->head; *skp; skp = &((*skp)->next)) { if (*skp == sk) { *skp = sk->next; __sock_put(sk); break; } } write_unlock(&l->lock); } struct net_proto_family bluez_sock_family_ops = { PF_BLUETOOTH, bluez_sock_create }; int bluez_init(void) { INF("BlueZ HCI Core ver %s Copyright (C) 2000,2001 Qualcomm Inc", VERSION); INF("Written 2000,2001 by Maxim Krasnyansky <ma...@qu...>"); proc_mkdir("bluetooth", NULL); sock_register(&bluez_sock_family_ops); /* Init HCI Core */ hci_core_init(); /* Init sockets */ hci_sock_init(); return 0; } void bluez_cleanup(void) { /* Release socket */ hci_sock_cleanup(); /* Release core */ hci_core_cleanup(); sock_unregister(PF_BLUETOOTH); remove_proc_entry("bluetooth", NULL); } #ifdef MODULE module_init(bluez_init); module_exit(bluez_cleanup); MODULE_AUTHOR("Maxim Krasnyansky <ma...@qu...>"); MODULE_DESCRIPTION("BlueZ HCI Core ver " VERSION); #endif --- NEW FILE --- /* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated Written 2000,2001 by Maxim Krasnyansky <ma...@qu...> 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 published by the Free Software Foundation; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 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 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. [...1993 lines suppressed...] skb_queue_tail(&hdev->rx_q, skb); hci_sched_rx(hdev); return 0; } int hci_core_init(void) { /* Init locks */ spin_lock_init(&hdev_list_lock); return 0; } int hci_core_cleanup(void) { return 0; } MODULE_LICENSE("GPL"); --- NEW FILE --- /* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated Written 2000,2001 by Maxim Krasnyansky <ma...@qu...> 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 published by the Free Software Foundation; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 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 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ /* * BlueZ HCI socket layer. * * $Id: hci_sock.c,v 1.1 2002/04/09 16:22:03 atp Exp $ */ #include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/major.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/poll.h> #include <linux/fcntl.h> #include <linux/init.h> #include <linux/skbuff.h> #include <linux/tqueue.h> #include <linux/interrupt.h> #include <linux/socket.h> #include <linux/ioctl.h> #include <net/sock.h> #include <asm/system.h> #include <asm/uaccess.h> #include <net/bluetooth/bluetooth.h> #include <net/bluetooth/bluez.h> #include <net/bluetooth/hci_core.h> #ifndef HCI_SOCK_DEBUG #undef DBG #define DBG( A... ) #endif /* HCI socket interface */ static struct bluez_sock_list hci_sk_list = { lock: RW_LOCK_UNLOCKED }; static struct sock *hci_sock_lookup(struct hci_dev *hdev) { struct sock *sk; read_lock(&hci_sk_list.lock); for (sk = hci_sk_list.head; sk; sk = sk->next) { if (hci_pi(sk)->hdev == hdev) break; } read_unlock(&hci_sk_list.lock); return sk; } /* Send frame to RAW socket */ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb) { struct sock * sk; DBG("hdev %p len %d", hdev, skb->len); read_lock(&hci_sk_list.lock); for (sk = hci_sk_list.head; sk; sk = sk->next) { struct hci_filter *flt; struct sk_buff *nskb; if (sk->state != BT_BOUND || hci_pi(sk)->hdev != hdev) continue; /* Don't send frame to the socket it came from */ if (skb->sk == sk) continue; /* Apply filter */ flt = &hci_pi(sk)->filter; if (!test_bit(skb->pkt_type, &flt->type_mask)) continue; if (skb->pkt_type == HCI_EVENT_PKT) { register int evt = (*(__u8 *)skb->data & 63); if (!test_bit(evt, &flt->event_mask)) continue; } if (!(nskb = skb_clone(skb, GFP_ATOMIC))) continue; /* Put type byte before the data */ memcpy(skb_push(nskb, 1), &nskb->pkt_type, 1); skb_queue_tail(&sk->receive_queue, nskb); sk->data_ready(sk, nskb->len); } read_unlock(&hci_sk_list.lock); } static int hci_sock_release(struct socket *sock) { struct sock *sk = sock->sk; struct hci_dev *hdev = hci_pi(sk)->hdev; DBG("sock %p sk %p", sock, sk); if (!sk) return 0; bluez_sock_unlink(&hci_sk_list, sk); if (hdev) { if (!hci_sock_lookup(hdev)) hdev->flags &= ~HCI_SOCK; hci_dev_put(hdev); } sock_orphan(sk); skb_queue_purge(&sk->receive_queue); skb_queue_purge(&sk->write_queue); sock_put(sk); MOD_DEC_USE_COUNT; return 0; } static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; struct hci_dev *hdev = hci_pi(sk)->hdev; __u32 mode; DBG("cmd %x arg %lx", cmd, arg); switch (cmd) { case HCIGETINFO: return hci_dev_info(arg); case HCIGETDEVLIST: return hci_dev_list(arg); case HCIDEVUP: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_open(arg); case HCIDEVDOWN: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_close(arg); case HCIDEVRESET: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_reset(arg); case HCIRESETSTAT: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_reset_stat(arg); case HCISETSCAN: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_setscan(arg); case HCISETAUTH: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_setauth(arg); case HCISETRAW: if (!capable(CAP_NET_ADMIN)) return -EACCES; if (!hdev) return -EBADFD; if (arg) mode = HCI_RAW; else mode = HCI_NORMAL; return hci_dev_setmode(hdev, mode); case HCISETPTYPE: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_setptype(arg); case HCIINQUIRY: return hci_inquiry(arg); case HCIGETCONNLIST: return hci_conn_list(arg); default: return -EINVAL; }; } static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) { struct sockaddr_hci *haddr = (struct sockaddr_hci *) addr; struct sock *sk = sock->sk; struct hci_dev *hdev = NULL; DBG("sock %p sk %p", sock, sk); if (!haddr || haddr->hci_family != AF_BLUETOOTH) return -EINVAL; if (hci_pi(sk)->hdev) { /* Already bound */ return 0; } if (haddr->hci_dev != HCI_DEV_NONE) { if (!(hdev = hci_dev_get(haddr->hci_dev))) return -ENODEV; hdev->flags |= HCI_SOCK; } hci_pi(sk)->hdev = hdev; sk->state = BT_BOUND; return 0; } static int hci_sock_getname(struct socket *sock, struct sockaddr *addr, int *addr_len, int peer) { struct sockaddr_hci *haddr = (struct sockaddr_hci *) addr; struct sock *sk = sock->sk; DBG("sock %p sk %p", sock, sk); *addr_len = sizeof(*haddr); haddr->hci_family = AF_BLUETOOTH; haddr->hci_dev = hci_pi(sk)->hdev->id; return 0; } static int hci_sock_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct scm_cookie *scm) { struct sock *sk = sock->sk; struct hci_dev *hdev = hci_pi(sk)->hdev; struct sk_buff *skb; int err; DBG("sock %p sk %p", sock, sk); if (msg->msg_flags & MSG_OOB) return -EOPNOTSUPP; if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_NOSIGNAL|MSG_ERRQUEUE)) return -EINVAL; if (!hdev) return -EBADFD; if (!(skb = bluez_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err))) return err; if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) { kfree_skb(skb); return -EFAULT; } skb->dev = (void *) hdev; skb->pkt_type = *((unsigned char *) skb->data); skb_pull(skb, 1); /* Send frame to HCI core */ hci_send_raw(skb); return len; } static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) { __u32 mask = hci_pi(sk)->cmsg_mask; if (mask & HCI_CMSG_DIR) put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(int), &bluez_cb(skb)->incomming); } static int hci_sock_recvmsg(struct socket *sock, struct msghdr *msg, int len, int flags, struct scm_cookie *scm) { int noblock = flags & MSG_DONTWAIT; struct sock *sk = sock->sk; struct sk_buff *skb; int copied, err; DBG("sock %p sk %p", sock, sk); if (flags & (MSG_OOB | MSG_PEEK)) return -EOPNOTSUPP; if (!(skb = skb_recv_datagram(sk, flags, noblock, &err))) return err; msg->msg_namelen = 0; copied = skb->len; if (len < copied) { msg->msg_flags |= MSG_TRUNC; copied = len; } skb->h.raw = skb->data; err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); if (hci_pi(sk)->cmsg_mask) hci_sock_cmsg(sk, msg, skb); skb_free_datagram(sk, skb); return err ? : copied; } int hci_sock_setsockopt(struct socket *sock, int level, int optname, char *optval, int len) { struct sock *sk = sock->sk; struct hci_filter flt; int err = 0, opt = 0; DBG("sk %p, opt %d", sk, optname); lock_sock(sk); switch (optname) { case HCI_DATA_DIR: if (get_user(opt, (int *)optval)) return -EFAULT; if (opt) hci_pi(sk)->cmsg_mask |= HCI_CMSG_DIR; else hci_pi(sk)->cmsg_mask &= ~HCI_CMSG_DIR; break; case HCI_FILTER: len = MIN(len, sizeof(struct hci_filter)); if (copy_from_user(&flt, optval, len)) { err = -EFAULT; break; } memcpy(&hci_pi(sk)->filter, &flt, len); break; default: err = -ENOPROTOOPT; break; }; release_sock(sk); return err; } int hci_sock_getsockopt(struct socket *sock, int level, int optname, char *optval, int *optlen) { struct sock *sk = sock->sk; int len, opt; if (get_user(len, optlen)) return -EFAULT; switch (optname) { case HCI_DATA_DIR: if (hci_pi(sk)->cmsg_mask & HCI_CMSG_DIR) opt = 1; else opt = 0; if (put_user(opt, optval)) return -EFAULT; break; case HCI_FILTER: len = MIN(len, sizeof(struct hci_filter)); if (copy_to_user(optval, &hci_pi(sk)->filter, len)) return -EFAULT; break; default: return -ENOPROTOOPT; break; }; return 0; } struct proto_ops hci_sock_ops = { family: PF_BLUETOOTH, release: hci_sock_release, bind: hci_sock_bind, getname: hci_sock_getname, sendmsg: hci_sock_sendmsg, recvmsg: hci_sock_recvmsg, ioctl: hci_sock_ioctl, poll: datagram_poll, listen: sock_no_listen, shutdown: sock_no_shutdown, setsockopt: hci_sock_setsockopt, getsockopt: hci_sock_getsockopt, connect: sock_no_connect, socketpair: sock_no_socketpair, accept: sock_no_accept, mmap: sock_no_mmap }; static int hci_sock_create(struct socket *sock, int protocol) { struct sock *sk; DBG("sock %p", sock); if (sock->type != SOCK_RAW) return -ESOCKTNOSUPPORT; sock->ops = &hci_sock_ops; if (!(sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, 1))) return -ENOMEM; sock->state = SS_UNCONNECTED; sock_init_data(sock, sk); memset(&sk->protinfo, 0, sizeof(struct hci_pinfo)); sk->destruct = NULL; sk->protocol = protocol; sk->state = BT_OPEN; /* Initialize filter */ hci_pi(sk)->filter.type_mask = (1<<HCI_EVENT_PKT); hci_pi(sk)->filter.event_mask[0] = ~0L; hci_pi(sk)->filter.event_mask[1] = ~0L; bluez_sock_link(&hci_sk_list, sk); MOD_INC_USE_COUNT; return 0; } static int hci_sock_dev_event(struct notifier_block *this, unsigned long event, void *ptr) { struct hci_dev *hdev = (struct hci_dev *) ptr; struct sk_buff *skb; DBG("hdev %s event %ld", hdev->name, event); /* Send event to sockets */ if ((skb = bluez_skb_alloc(HCI_EVENT_HDR_SIZE + EVT_HCI_DEV_EVENT_SIZE, GFP_ATOMIC))) { hci_event_hdr eh = { EVT_HCI_DEV_EVENT, EVT_HCI_DEV_EVENT_SIZE }; evt_hci_dev_event he = { event, hdev->id }; skb->pkt_type = HCI_EVENT_PKT; memcpy(skb_put(skb, HCI_EVENT_HDR_SIZE), &eh, HCI_EVENT_HDR_SIZE); memcpy(skb_put(skb, EVT_HCI_DEV_EVENT_SIZE), &he, EVT_HCI_DEV_EVENT_SIZE); hci_send_to_sock(NULL, skb); kfree_skb(skb); } if (event == HCI_DEV_UNREG) { struct sock *sk; /* Detach sockets from device */ read_lock(&hci_sk_list.lock); for (sk = hci_sk_list.head; sk; sk = sk->next) { if (hci_pi(sk)->hdev == hdev) { hci_pi(sk)->hdev = NULL; sk->err = EPIPE; sk->state = BT_OPEN; sk->state_change(sk); hci_dev_put(hdev); } } read_unlock(&hci_sk_list.lock); } return NOTIFY_DONE; } struct net_proto_family hci_sock_family_ops = { family: PF_BLUETOOTH, create: hci_sock_create }; struct notifier_block hci_sock_nblock = { notifier_call: hci_sock_dev_event }; int hci_sock_init(void) { if (bluez_sock_register(BTPROTO_HCI, &hci_sock_family_ops)) { ERR("Can't register HCI socket"); return -EPROTO; } hci_register_notifier(&hci_sock_nblock); return 0; } int hci_sock_cleanup(void) { if (bluez_sock_unregister(BTPROTO_HCI)) ERR("Can't unregister HCI socket"); hci_unregister_notifier(&hci_sock_nblock); return 0; } --- NEW FILE --- /* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated Written 2000,2001 by Maxim Krasnyansky <ma...@qu...> 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 published by the Free Software Foundation; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 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 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. [...2277 lines suppressed...] /* Free interface list and unlock HCI devices */ { struct list_head *list = &l2cap_iff_list; while (!list_empty(list)) { struct l2cap_iff *iff; iff = list_entry(list->next, struct l2cap_iff, list); l2cap_iff_del(iff->hdev); } } } module_init(l2cap_init); module_exit(l2cap_cleanup); MODULE_AUTHOR("Maxim Krasnyansky <ma...@qu...>"); MODULE_DESCRIPTION("BlueZ L2CAP ver " VERSION); MODULE_LICENSE("GPL"); --- NEW FILE --- /* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated Written 2000,2001 by Maxim Krasnyansky <ma...@qu...> 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 published by the Free Software Foundation; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 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 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ /* * BlueZ L2CAP proc fs support. * * $Id: l2cap_proc.c,v 1.1 2002/04/09 16:22:03 atp Exp $ */ #include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/major.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/poll.h> #include <linux/fcntl.h> #include <linux/init.h> #include <linux/skbuff.h> #include <linux/interrupt.h> #include <linux/socket.h> #include <linux/skbuff.h> #include <linux/proc_fs.h> #include <linux/list.h> #include <net/sock.h> #include <asm/system.h> #include <asm/uaccess.h> #include <net/bluetooth/bluez.h> #include <net/bluetooth/bluetooth.h> #include <net/bluetooth/hci_core.h> #include <net/bluetooth/l2cap_core.h> #ifndef L2CAP_DEBUG #undef DBG #define DBG( A... ) #endif /* ----- PROC fs support ----- */ static int l2cap_conn_dump(char *buf, struct l2cap_iff *iff) { struct list_head *p; char *ptr = buf; list_for_each(p, &iff->conn_list) { struct l2cap_conn *c; c = list_entry(p, struct l2cap_conn, list); ptr += sprintf(ptr, " %p %d %p %p %s %s\n", c, c->state, c->iff, c->hconn, batostr(&c->src), batostr(&c->dst)); } return ptr - buf; } static int l2cap_iff_dump(char *buf) { struct list_head *p; char *ptr = buf; ptr += sprintf(ptr, "Interfaces:\n"); write_lock(&l2cap_rt_lock); list_for_each(p, &l2cap_iff_list) { struct l2cap_iff *iff; iff = list_entry(p, struct l2cap_iff, list); ptr += sprintf(ptr, " %s %p %p\n", iff->hdev->name, iff, iff->hdev); l2cap_iff_lock(iff); ptr += l2cap_conn_dump(ptr, iff); l2cap_iff_unlock(iff); } write_unlock(&l2cap_rt_lock); ptr += sprintf(ptr, "\n"); return ptr - buf; } static int l2cap_sock_dump(char *buf, struct bluez_sock_list *list) { struct l2cap_pinfo *pi; struct sock *sk; char *ptr = buf; ptr += sprintf(ptr, "Sockets:\n"); write_lock(&list->lock); for (sk = list->head; sk; sk = sk->next) { pi = l2cap_pi(sk); ptr += sprintf(ptr, " %p %d %p %d %s %s 0x%4.4x 0x%4.4x %d %d\n", sk, sk->state, pi->conn, pi->psm, batostr(&pi->src), batostr(&pi->dst), pi->scid, pi->dcid, pi->imtu, pi->omtu ); } write_unlock(&list->lock); ptr += sprintf(ptr, "\n"); return ptr - buf; } static int l2cap_read_proc(char *buf, char **start, off_t offset, int count, int *eof, void *priv) { char *ptr = buf; int len; DBG("count %d, offset %ld", count, offset); ptr += l2cap_iff_dump(ptr); ptr += l2cap_sock_dump(ptr, &l2cap_sk_list); len = ptr - buf; if (len <= count + offset) *eof = 1; *start = buf + offset; len -= offset; if (len > count) len = count; if (len < 0) len = 0; return len; } void l2cap_register_proc(void) { create_proc_read_entry("bluetooth/l2cap", 0, 0, l2cap_read_proc, NULL); } void l2cap_unregister_proc(void) { remove_proc_entry("bluetooth/l2cap", NULL); } --- NEW FILE --- /* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated Written 2000,2001 by Maxim Krasnyansky <ma...@qu...> 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 published by the Free Software Foundation; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 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 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ /* * BlueZ kernel library. * * $Id: lib.c,v 1.1 2002/04/09 16:22:03 atp Exp $ */ #include <linux/kernel.h> #include <linux/stddef.h> #include <linux/string.h> #include <asm/errno.h> #include <net/bluetooth/bluetooth.h> void bluez_dump(char *pref, __u8 *buf, int count) { char *ptr; char line[100]; int i; printk(KERN_INFO "%s: dump, len %d\n", pref, count); ptr = line; *ptr = 0; for (i = 0; i<count; i++) { ptr += sprintf(ptr, " %2.2X", buf[i]); if (i && !((i + 1) % 20)) { printk(KERN_INFO "%s:%s\n", pref, line); ptr = line; *ptr = 0; } } if (line[0]) printk(KERN_INFO "%s:%s\n", pref, line); } void baswap(bdaddr_t *dst, bdaddr_t *src) { unsigned char *d = (unsigned char *) dst; unsigned char *s = (unsigned char *) src; int i; for (i = 0; i < 6; i++) d[i] = s[5 - i]; } char *batostr(bdaddr_t *ba) { static char str[2][18]; static int i = 1; i ^= 1; sprintf(str[i], "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", ba->b[0], ba->b[1], ba->b[2], ba->b[3], ba->b[4], ba->b[5]); return str[i]; } /* Bluetooth error codes to Unix errno mapping */ int bterr(__u16 code) { switch (code) { case 0: return 0; case 0x01: return EBADRQC; case 0x02: return ENOTCONN; case 0x03: return EIO; case 0x04: return EHOSTDOWN; case 0x05: return EACCES; case 0x06: return EINVAL; case 0x07: return ENOMEM; case 0x08: return ETIMEDOUT; case 0x09: return EMLINK; case 0x0a: return EMLINK; case 0x0b: return EALREADY; case 0x0c: return EBUSY; case 0x0d: case 0x0e: case 0x0f: return ECONNREFUSED; case 0x10: return ETIMEDOUT; case 0x11: case 0x27: case 0x29: case 0x20: return EOPNOTSUPP; case 0x12: return EINVAL; case 0x13: case 0x14: case 0x15: return ECONNRESET; case 0x16: return ECONNABORTED; case 0x17: return ELOOP; case 0x18: return EACCES; case 0x1a: return EPROTONOSUPPORT; case 0x1b: return ECONNREFUSED; case 0x19: case 0x1e: case 0x23: case 0x24: case 0x25: return EPROTO; default: return ENOSYS; }; } --- NEW FILE --- /* BlueZ - Bluetooth protocol stack for Linux Copyright (C) 2000-2001 Qualcomm Incorporated Written 2000,2001 by Maxim Krasnyansky <ma...@qu...> 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 published by the Free Software Foundation; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 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 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. */ /* * BlueZ symbols. * * $Id: syms.c,v 1.1 2002/04/09 16:22:03 atp Exp $ */ #include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/skbuff.h> #include <linux/socket.h> #include <net/bluetooth/bluetooth.h> #include <net/bluetooth/bluez.h> #include <net/bluetooth/hci_core.h> /* HCI Core */ EXPORT_SYMBOL(hci_register_dev); EXPORT_SYMBOL(hci_unregister_dev); EXPORT_SYMBOL(hci_register_proto); EXPORT_SYMBOL(hci_unregister_proto); EXPORT_SYMBOL(hci_register_notifier); EXPORT_SYMBOL(hci_unregister_notifier); EXPORT_SYMBOL(hci_connect); EXPORT_SYMBOL(hci_disconnect); EXPORT_SYMBOL(hci_dev_get); EXPORT_SYMBOL(hci_recv_frame); EXPORT_SYMBOL(hci_send_acl); EXPORT_SYMBOL(hci_send_sco); EXPORT_SYMBOL(hci_send_raw); /* BlueZ lib */ EXPORT_SYMBOL(bluez_dump); EXPORT_SYMBOL(baswap); EXPORT_SYMBOL(batostr); EXPORT_SYMBOL(bterr); /* BlueZ sockets */ EXPORT_SYMBOL(bluez_sock_register); EXPORT_SYMBOL(bluez_sock_unregister); EXPORT_SYMBOL(bluez_sock_link); EXPORT_SYMBOL(bluez_sock_unlink); |
From: Andy P. <at...@us...> - 2002-04-09 16:22:08
|
Update of /cvsroot/linux-vax/kernel-2.4/net/bridge In directory usw-pr-cvs1:/tmp/cvs-serv30993/bridge Modified Files: br.c br_device.c br_fdb.c br_forward.c br_if.c br_input.c br_ioctl.c br_notify.c br_private.h br_private_stp.h br_private_timer.h br_stp.c br_stp_bpdu.c br_stp_if.c br_stp_timer.c Log Message: synch 2.4.15 commit 19 Index: br.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- br.c 14 Jan 2001 17:13:04 -0000 1.1.1.1 +++ br.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -82,3 +82,4 @@ module_init(br_init) module_exit(br_deinit) +MODULE_LICENSE("GPL"); Index: br_device.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_device.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- br_device.c 14 Jan 2001 17:13:06 -0000 1.1.1.1 +++ br_device.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -53,20 +53,21 @@ br->statistics.tx_packets++; br->statistics.tx_bytes += skb->len; - dest = skb->data; + dest = skb->mac.raw = skb->data; + skb_pull(skb, ETH_HLEN); if (dest[0] & 1) { - br_flood(br, skb, 0); + br_flood_deliver(br, skb, 0); return 0; } if ((dst = br_fdb_get(br, dest)) != NULL) { - br_forward(dst->dst, skb); + br_deliver(dst->dst, skb); br_fdb_put(dst); return 0; } - br_flood(br, skb, 0); + br_flood_deliver(br, skb, 0); return 0; } Index: br_fdb.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_fdb.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: br_forward.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_forward.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- br_forward.c 14 Jan 2001 17:13:05 -0000 1.1.1.1 +++ br_forward.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -18,9 +18,10 @@ #include <linux/inetdevice.h> #include <linux/skbuff.h> #include <linux/if_bridge.h> +#include <linux/netfilter_bridge.h> #include "br_private.h" -static inline int should_forward(struct net_bridge_port *p, struct sk_buff *skb) +static inline int should_deliver(struct net_bridge_port *p, struct sk_buff *skb) { if (skb->dev == p->dev || p->state != BR_STATE_FORWARDING) @@ -29,16 +30,59 @@ return 1; } +static int __dev_queue_push_xmit(struct sk_buff *skb) +{ + skb_push(skb, ETH_HLEN); + dev_queue_xmit(skb); + + return 0; +} + +static int __br_forward_finish(struct sk_buff *skb) +{ + NF_HOOK(PF_BRIDGE, NF_BR_POST_ROUTING, skb, NULL, skb->dev, + __dev_queue_push_xmit); + + return 0; +} + +static void __br_deliver(struct net_bridge_port *to, struct sk_buff *skb) +{ + struct net_device *indev; + + indev = skb->dev; + skb->dev = to->dev; + + NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_OUT, skb, indev, skb->dev, + __br_forward_finish); +} + static void __br_forward(struct net_bridge_port *to, struct sk_buff *skb) { + struct net_device *indev; + + indev = skb->dev; skb->dev = to->dev; - dev_queue_xmit(skb); + + NF_HOOK(PF_BRIDGE, NF_BR_FORWARD, skb, indev, skb->dev, + __br_forward_finish); +} + +/* called under bridge lock */ +void br_deliver(struct net_bridge_port *to, struct sk_buff *skb) +{ + if (should_deliver(to, skb)) { + __br_deliver(to, skb); + return; + } + + kfree_skb(skb); } /* called under bridge lock */ void br_forward(struct net_bridge_port *to, struct sk_buff *skb) { - if (should_forward(to, skb)) { + if (should_deliver(to, skb)) { __br_forward(to, skb); return; } @@ -47,7 +91,8 @@ } /* called under bridge lock */ -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)(struct net_bridge_port *p, struct sk_buff *skb)) { struct net_bridge_port *p; struct net_bridge_port *prev; @@ -67,7 +112,7 @@ p = br->port_list; while (p != NULL) { - if (should_forward(p, skb)) { + if (should_deliver(p, skb)) { if (prev != NULL) { struct sk_buff *skb2; @@ -77,7 +122,7 @@ return; } - __br_forward(prev, skb2); + __packet_hook(prev, skb2); } prev = p; @@ -87,9 +132,21 @@ } if (prev != NULL) { - __br_forward(prev, skb); + __packet_hook(prev, skb); return; } kfree_skb(skb); +} + +/* called under bridge lock */ +void br_flood_deliver(struct net_bridge *br, struct sk_buff *skb, int clone) +{ + br_flood(br, skb, clone, __br_deliver); +} + +/* called under bridge lock */ +void br_flood_forward(struct net_bridge *br, struct sk_buff *skb, int clone) +{ + br_flood(br, skb, clone, __br_forward); } Index: br_if.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_if.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: br_input.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_input.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- br_input.c 14 Jan 2001 17:13:06 -0000 1.1.1.1 +++ br_input.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -17,20 +17,33 @@ #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/if_bridge.h> +#include <linux/netfilter_bridge.h> #include "br_private.h" unsigned char bridge_ula[6] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }; +static int br_pass_frame_up_finish(struct sk_buff *skb) +{ + netif_rx(skb); + + return 0; +} + static void br_pass_frame_up(struct net_bridge *br, struct sk_buff *skb) { + struct net_device *indev; + br->statistics.rx_packets++; br->statistics.rx_bytes += skb->len; + indev = skb->dev; skb->dev = &br->dev; skb->pkt_type = PACKET_HOST; - skb_pull(skb, skb->mac.raw - skb->data); + skb_push(skb, ETH_HLEN); skb->protocol = eth_type_trans(skb, &br->dev); - netif_rx(skb); + + NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, indev, NULL, + br_pass_frame_up_finish); } static void __br_handle_frame(struct sk_buff *skb) @@ -51,8 +64,6 @@ p->state == BR_STATE_DISABLED) goto freeandout; - skb_push(skb, skb->data - skb->mac.raw); - if (br->dev.flags & IFF_PROMISC) { struct sk_buff *skb2; @@ -91,7 +102,7 @@ goto freeandout; if (dest[0] & 1) { - br_flood(br, skb, 1); + br_flood_forward(br, skb, 1); if (!passedup) br_pass_frame_up(br, skb); else @@ -116,7 +127,7 @@ return; } - br_flood(br, skb, 0); + br_flood_forward(br, skb, 0); return; handle_special_frame: @@ -129,7 +140,7 @@ kfree_skb(skb); } -void br_handle_frame(struct sk_buff *skb) +static int br_handle_frame_finish(struct sk_buff *skb) { struct net_bridge *br; @@ -137,4 +148,12 @@ read_lock(&br->lock); __br_handle_frame(skb); read_unlock(&br->lock); + + return 0; +} + +void br_handle_frame(struct sk_buff *skb) +{ + NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL, + br_handle_frame_finish); } Index: br_ioctl.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_ioctl.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: br_notify.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_notify.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: br_private.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_private.h,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- br_private.h 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ br_private.h 9 Apr 2002 16:22:03 -0000 1.2 @@ -141,11 +141,16 @@ int is_local); /* br_forward.c */ +extern void br_deliver(struct net_bridge_port *to, + struct sk_buff *skb); extern void br_forward(struct net_bridge_port *to, struct sk_buff *skb); -extern void br_flood(struct net_bridge *br, - struct sk_buff *skb, - int clone); +extern void br_flood_deliver(struct net_bridge *br, + struct sk_buff *skb, + int clone); +extern void br_flood_forward(struct net_bridge *br, + struct sk_buff *skb, + int clone); /* br_if.c */ extern int br_add_bridge(char *name); Index: br_private_stp.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_private_stp.h,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 Index: br_private_timer.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_private_timer.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: br_stp.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_stp.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: br_stp_bpdu.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_stp_bpdu.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- br_stp_bpdu.c 14 Jan 2001 17:13:10 -0000 1.1.1.1 +++ br_stp_bpdu.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -14,6 +14,7 @@ */ #include <linux/kernel.h> +#include <linux/if_ether.h> #include <linux/if_bridge.h> #include "br_private.h" #include "br_private_stp.h" @@ -42,6 +43,7 @@ } skb->dev = dev; + skb->protocol = htons(ETH_P_802_2); skb->mac.raw = skb_put(skb, size); memcpy(skb->mac.raw, bridge_ula, ETH_ALEN); memcpy(skb->mac.raw+ETH_ALEN, dev->dev_addr, ETH_ALEN); Index: br_stp_if.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_stp_if.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- br_stp_if.c 14 Jan 2001 17:13:11 -0000 1.1.1.1 +++ br_stp_if.c 9 Apr 2002 16:22:03 -0000 1.2 @@ -203,7 +203,10 @@ /* called under bridge lock */ void br_stp_set_port_priority(struct net_bridge_port *p, int newprio) { - int new_port_id = ((newprio & 0xFF) << 8) | p->port_no; + __u16 new_port_id; + + p->priority = newprio & 0xFF; + new_port_id = br_make_port_id(p); if (br_is_designated_port(p)) p->designated_port = new_port_id; Index: br_stp_timer.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/bridge/br_stp_timer.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 |
From: Andy P. <at...@us...> - 2002-04-09 16:20:50
|
Update of /cvsroot/linux-vax/kernel-2.4/net/ax25 In directory usw-pr-cvs1:/tmp/cvs-serv30559/ax25 Modified Files: af_ax25.c ax25_in.c ax25_ip.c ax25_subr.c Log Message: synch 2.4.15 commit 18 Index: af_ax25.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ax25/af_ax25.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- af_ax25.c 25 Feb 2001 23:14:55 -0000 1.1.1.2 +++ af_ax25.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -751,7 +751,7 @@ return -EFAULT; valptr = (void *) &val; - length = min(maxlen, sizeof(int)); + length = min_t(unsigned int, maxlen, sizeof(int)); switch (optname) { case AX25_WINDOW: @@ -803,7 +803,7 @@ if (ax25_dev != NULL && ax25_dev->dev != NULL) { strncpy(devname, ax25_dev->dev->name, IFNAMSIZ); - length = min(strlen(ax25_dev->dev->name)+1, maxlen); + length = min_t(unsigned int, strlen(ax25_dev->dev->name)+1, maxlen); devname[length-1] = '\0'; } else { *devname = '\0'; @@ -1451,7 +1451,7 @@ /* Assume the worst case */ size = len + 3 + ax25_addr_size(dp) + AX25_BPQ_HEADER_LEN; - if ((skb = sock_alloc_send_skb(sk, size, 0, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) + if ((skb = sock_alloc_send_skb(sk, size, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) return err; skb_reserve(skb, size - len); @@ -1805,6 +1805,7 @@ sendmsg: ax25_sendmsg, recvmsg: ax25_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; #include <linux/smp_lock.h> @@ -1840,7 +1841,7 @@ EXPORT_SYMBOL(null_ax25_address); EXPORT_SYMBOL(ax25_display_timer); -static const char banner[] __initdata = KERN_INFO "NET4: G4KLX/GW4PTS AX.25 for Linux. Version 0.37 for Linux NET4.0\n"; +static char banner[] __initdata = KERN_INFO "NET4: G4KLX/GW4PTS AX.25 for Linux. Version 0.37 for Linux NET4.0\n"; static int __init ax25_init(void) { Index: ax25_in.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ax25/ax25_in.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- ax25_in.c 25 Feb 2001 23:14:55 -0000 1.1.1.2 +++ ax25_in.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -83,9 +83,11 @@ /* Last fragment received ? */ if (ax25->fragno == 0) { - if ((skbn = alloc_skb(AX25_MAX_HEADER_LEN + ax25->fraglen, GFP_ATOMIC)) == NULL) { - while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL) - kfree_skb(skbo); + skbn = alloc_skb(AX25_MAX_HEADER_LEN + + ax25->fraglen, + GFP_ATOMIC); + if (!skbn) { + skb_queue_purge(&ax25->frag_queue); return 1; } @@ -113,8 +115,7 @@ } else { /* First fragment received */ if (*skb->data & AX25_SEG_FIRST) { - while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL) - kfree_skb(skbo); + skb_queue_purge(&ax25->frag_queue); ax25->fragno = *skb->data & AX25_SEG_REM; skb_pull(skb, 1); /* skip fragno */ ax25->fraglen = skb->len; @@ -416,7 +417,8 @@ /* * Sort out any digipeated paths. */ - if (dp.ndigi != 0 && ax25->digipeat == NULL && (ax25->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { + if (dp.ndigi && !ax25->digipeat && + (ax25->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { kfree_skb(skb); ax25_destroy_socket(ax25); return 0; @@ -429,7 +431,7 @@ } } else { /* Reverse the source SABM's path */ - memcpy(&ax25->digipeat, &reverse_dp, sizeof(ax25_digi)); + memcpy(ax25->digipeat, &reverse_dp, sizeof(ax25_digi)); } if ((*skb->data & ~AX25_PF) == AX25_SABME) { @@ -468,7 +470,8 @@ /* * Receive an AX.25 frame via a SLIP interface. */ -int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *ptype) +int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev, + struct packet_type *ptype) { skb->sk = NULL; /* Initially we don't know who it's for */ skb->destructor = NULL; /* Who initializes this, dammit?! */ Index: ax25_ip.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ax25/ax25_ip.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ax25_ip.c 14 Jan 2001 17:08:08 -0000 1.1.1.1 +++ ax25_ip.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -56,9 +56,14 @@ int ax25_encapsulate(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len) { - /* header is an AX.25 UI frame from us to them */ - unsigned char *buff = skb_push(skb, AX25_HEADER_LEN); + unsigned char *buff; + + /* they sometimes come back to us... */ + if (type == ETH_P_AX25) + return 0; + /* header is an AX.25 UI frame from us to them */ + buff = skb_push(skb, AX25_HEADER_LEN); *buff++ = 0x00; /* KISS DATA */ if (daddr != NULL) @@ -90,7 +95,7 @@ *buff++ = AX25_P_ARP; break; default: - printk(KERN_ERR "AX.25: ax25_encapsulate - wrong protocol type 0x%x2.2\n", type); + printk(KERN_ERR "AX.25: ax25_encapsulate - wrong protocol type 0x%2.2x\n", type); *buff++ = 0; break; } @@ -160,7 +165,7 @@ dst_c = *dst; skb_pull(ourskb, AX25_HEADER_LEN - 1); /* Keep PID */ - skb->nh.raw = skb->data; + ourskb->nh.raw = ourskb->data; ax25_send_frame(ourskb, ax25_dev->values[AX25_VALUES_PACLEN], &src_c, &dst_c, route->digipeat, dev); Index: ax25_subr.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/ax25/ax25_subr.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ax25_subr.c 14 Jan 2001 17:08:01 -0000 1.1.1.1 +++ ax25_subr.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -59,19 +59,10 @@ */ void ax25_clear_queues(ax25_cb *ax25) { - struct sk_buff *skb; - - while ((skb = skb_dequeue(&ax25->write_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&ax25->ack_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&ax25->reseq_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&ax25->frag_queue)) != NULL) - kfree_skb(skb); + skb_queue_purge(&ax25->write_queue); + skb_queue_purge(&ax25->ack_queue); + skb_queue_purge(&ax25->reseq_queue); + skb_queue_purge(&ax25->frag_queue); } /* |
From: Andy P. <at...@us...> - 2002-04-09 16:20:50
|
Update of /cvsroot/linux-vax/kernel-2.4/net/atm In directory usw-pr-cvs1:/tmp/cvs-serv30559/atm Modified Files: Makefile addr.c addr.h clip.c common.c lec.c mpc.c mpoa_proc.c proc.c pvc.c resources.c signaling.c svc.c Added Files: pppoatm.c Log Message: synch 2.4.15 commit 18 --- NEW FILE --- /* net/atm/pppoatm.c - RFC2364 PPP over ATM/AAL5 */ /* Copyright 1999-2000 by Mitchell Blank Jr */ /* Based on clip.c; 1995-1999 by Werner Almesberger, EPFL LRC/ICA */ /* And on ppp_async.c; Copyright 1999 Paul Mackerras */ /* And help from Jens Axboe */ /* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * * This driver provides the encapsulation and framing for sending * and receiving PPP frames in ATM AAL5 PDUs. */ /* * One shortcoming of this driver is that it does not comply with * section 8 of RFC2364 - we are supposed to detect a change * in encapsulation and immediately abort the connection (in order * to avoid a black-hole being created if our peer loses state * and changes encapsulation unilaterally. However, since the * ppp_generic layer actually does the decapsulation, we need * a way of notifying it when we _think_ there might be a problem) * There's two cases: * 1. LLC-encapsulation was missing when it was enabled. In * this case, we should tell the upper layer "tear down * this session if this skb looks ok to you" * 2. LLC-encapsulation was present when it was disabled. Then * we need to tell the upper layer "this packet may be * ok, but if its in error tear down the session" * These hooks are not yet available in ppp_generic */ #include <linux/module.h> #include <linux/config.h> #include <linux/init.h> #include <linux/skbuff.h> #include <linux/atm.h> #include <linux/atmdev.h> #include <linux/ppp_defs.h> #include <linux/if_ppp.h> #include <linux/ppp_channel.h> #include <linux/atmppp.h> #if 0 #define DPRINTK(format, args...) \ printk(KERN_DEBUG "pppoatm: " format, ##args) #else #define DPRINTK(format, args...) #endif enum pppoatm_encaps { e_autodetect = PPPOATM_ENCAPS_AUTODETECT, e_vc = PPPOATM_ENCAPS_VC, e_llc = PPPOATM_ENCAPS_LLC, }; struct pppoatm_vcc { struct atm_vcc *atmvcc; /* VCC descriptor */ void (*old_push)(struct atm_vcc *, struct sk_buff *); void (*old_pop)(struct atm_vcc *, struct sk_buff *); /* keep old push/pop for detaching */ enum pppoatm_encaps encaps; int flags; /* SC_COMP_PROT - compress protocol */ struct ppp_channel chan; /* interface to generic ppp layer */ struct tasklet_struct wakeup_tasklet; }; /* * Header used for LLC Encapsulated PPP (4 bytes) followed by the LCP protocol * ID (0xC021) used in autodetection */ static const unsigned char pppllc[6] = { 0xFE, 0xFE, 0x03, 0xCF, 0xC0, 0x21 }; #define LLC_LEN (4) static inline struct pppoatm_vcc *atmvcc_to_pvcc(const struct atm_vcc *atmvcc) { return (struct pppoatm_vcc *) (atmvcc->user_back); } static inline struct pppoatm_vcc *chan_to_pvcc(const struct ppp_channel *chan) { return (struct pppoatm_vcc *) (chan->private); } /* * We can't do this directly from our _pop handler, since the ppp code * doesn't want to be called in interrupt context, so we do it from * a tasklet */ static void pppoatm_wakeup_sender(unsigned long arg) { ppp_output_wakeup((struct ppp_channel *) arg); } /* * This gets called every time the ATM card has finished sending our * skb. The ->old_pop will take care up normal atm flow control, * but we also need to wake up the device if we blocked it */ static void pppoatm_pop(struct atm_vcc *atmvcc, struct sk_buff *skb) { struct pppoatm_vcc *pvcc = atmvcc_to_pvcc(atmvcc); pvcc->old_pop(atmvcc, skb); /* * We don't really always want to do this since it's * really inefficient - it would be much better if we could * test if we had actually throttled the generic layer. * Unfortunately then there would be a nasty SMP race where * we could clear that flag just as we refuse another packet. * For now we do the safe thing. */ tasklet_schedule(&pvcc->wakeup_tasklet); } /* * Unbind from PPP - currently we only do this when closing the socket, * but we could put this into an ioctl if need be */ static void pppoatm_unassign_vcc(struct atm_vcc *atmvcc) { struct pppoatm_vcc *pvcc; pvcc = atmvcc_to_pvcc(atmvcc); atmvcc->push = pvcc->old_push; atmvcc->pop = pvcc->old_pop; tasklet_disable(&pvcc->wakeup_tasklet); ppp_unregister_channel(&pvcc->chan); atmvcc->user_back = NULL; kfree(pvcc); /* Gee, I hope we have the big kernel lock here... */ MOD_DEC_USE_COUNT; } /* Called when an AAL5 PDU comes in */ static void pppoatm_push(struct atm_vcc *atmvcc, struct sk_buff *skb) { struct pppoatm_vcc *pvcc = atmvcc_to_pvcc(atmvcc); DPRINTK("pppoatm push\n"); if (skb == NULL) { /* VCC was closed */ DPRINTK("removing ATMPPP VCC %p\n", pvcc); pppoatm_unassign_vcc(atmvcc); atmvcc->push(atmvcc, NULL); /* Pass along bad news */ return; } atm_return(atmvcc, skb->truesize); switch (pvcc->encaps) { case e_llc: if (skb->len < LLC_LEN || memcmp(skb->data, pppllc, LLC_LEN)) goto error; skb_pull(skb, LLC_LEN); break; case e_autodetect: if (pvcc->chan.ppp == NULL) { /* Not bound yet! */ kfree_skb(skb); return; } if (skb->len >= sizeof(pppllc) && !memcmp(skb->data, pppllc, sizeof(pppllc))) { pvcc->encaps = e_llc; skb_pull(skb, LLC_LEN); break; } if (skb->len >= (sizeof(pppllc) - LLC_LEN) && !memcmp(skb->data, &pppllc[LLC_LEN], sizeof(pppllc) - LLC_LEN)) { pvcc->encaps = e_vc; pvcc->chan.mtu += LLC_LEN; break; } DPRINTK("(unit %d): Couldn't autodetect yet " "(skb: %02X %02X %02X %02X %02X %02X)\n", pvcc->chan.unit, skb->data[0], skb->data[1], skb->data[2], skb->data[3], skb->data[4], skb->data[5]); goto error; case e_vc: break; } ppp_input(&pvcc->chan, skb); return; error: kfree_skb(skb); ppp_input_error(&pvcc->chan, 0); } /* * Called by the ppp_generic.c to send a packet - returns true if packet * was accepted. If we return false, then it's our job to call * ppp_output_wakeup(chan) when we're feeling more up to it. * Note that in the ENOMEM case (as opposed to the !atm_may_send case) * we should really drop the packet, but the generic layer doesn't * support this yet. We just return 'DROP_PACKET' which we actually define * as success, just to be clear what we're really doing. */ #define DROP_PACKET 1 static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb) { struct pppoatm_vcc *pvcc = chan_to_pvcc(chan); ATM_SKB(skb)->vcc = pvcc->atmvcc; DPRINTK("(unit %d): pppoatm_send (skb=0x%p, vcc=0x%p)\n", pvcc->chan.unit, skb, pvcc->atmvcc); if (skb->data[0] == '\0' && (pvcc->flags & SC_COMP_PROT)) (void) skb_pull(skb, 1); switch (pvcc->encaps) { /* LLC encapsulation needed */ case e_llc: if (skb_headroom(skb) < LLC_LEN) { struct sk_buff *n; n = skb_realloc_headroom(skb, LLC_LEN); if (n != NULL && !atm_may_send(pvcc->atmvcc, n->truesize)) { kfree_skb(n); goto nospace; } kfree_skb(skb); if ((skb = n) == NULL) return DROP_PACKET; } else if (!atm_may_send(pvcc->atmvcc, skb->truesize)) goto nospace; memcpy(skb_push(skb, LLC_LEN), pppllc, LLC_LEN); break; case e_vc: if (!atm_may_send(pvcc->atmvcc, skb->truesize)) goto nospace; break; case e_autodetect: DPRINTK("(unit %d): Trying to send without setting encaps!\n", pvcc->chan.unit); kfree_skb(skb); return 1; } atomic_add(skb->truesize, &ATM_SKB(skb)->vcc->tx_inuse); ATM_SKB(skb)->iovcnt = 0; ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options; DPRINTK("(unit %d): atm_skb(%p)->vcc(%p)->dev(%p)\n", pvcc->chan.unit, skb, ATM_SKB(skb)->vcc, ATM_SKB(skb)->vcc->dev); return ATM_SKB(skb)->vcc->send(ATM_SKB(skb)->vcc, skb) ? DROP_PACKET : 1; nospace: /* * We don't have space to send this SKB now, but we might have * already applied SC_COMP_PROT compression, so may need to undo */ if ((pvcc->flags & SC_COMP_PROT) && skb_headroom(skb) > 0 && skb->data[-1] == '\0') (void) skb_push(skb, 1); return 0; } /* This handles ioctls sent to the /dev/ppp interface */ static int pppoatm_devppp_ioctl(struct ppp_channel *chan, unsigned int cmd, unsigned long arg) { switch (cmd) { case PPPIOCGFLAGS: return put_user(chan_to_pvcc(chan)->flags, (int *) arg) ? -EFAULT : 0; case PPPIOCSFLAGS: return get_user(chan_to_pvcc(chan)->flags, (int *) arg) ? -EFAULT : 0; } return -ENOTTY; } static /*const*/ struct ppp_channel_ops pppoatm_ops = { start_xmit: pppoatm_send, ioctl: pppoatm_devppp_ioctl, }; static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, unsigned long arg) { struct atm_backend_ppp be; struct pppoatm_vcc *pvcc; int err; /* * Each PPPoATM instance has its own tasklet - this is just a * prototypical one used to initialize them */ static const DECLARE_TASKLET(tasklet_proto, pppoatm_wakeup_sender, 0); if (copy_from_user(&be, (void *) arg, sizeof be)) return -EFAULT; if (be.encaps != PPPOATM_ENCAPS_AUTODETECT && be.encaps != PPPOATM_ENCAPS_VC && be.encaps != PPPOATM_ENCAPS_LLC) return -EINVAL; MOD_INC_USE_COUNT; pvcc = kmalloc(sizeof(*pvcc), GFP_KERNEL); if (pvcc == NULL) { MOD_DEC_USE_COUNT; return -ENOMEM; } memset(pvcc, 0, sizeof(*pvcc)); pvcc->atmvcc = atmvcc; pvcc->old_push = atmvcc->push; pvcc->old_pop = atmvcc->pop; pvcc->encaps = (enum pppoatm_encaps) be.encaps; pvcc->chan.private = pvcc; pvcc->chan.ops = &pppoatm_ops; pvcc->chan.mtu = atmvcc->qos.txtp.max_sdu - PPP_HDRLEN - (be.encaps == e_vc ? 0 : LLC_LEN); pvcc->wakeup_tasklet = tasklet_proto; pvcc->wakeup_tasklet.data = (unsigned long) &pvcc->chan; if ((err = ppp_register_channel(&pvcc->chan)) != 0) { kfree(pvcc); return err; } atmvcc->user_back = pvcc; atmvcc->push = pppoatm_push; atmvcc->pop = pppoatm_pop; return 0; } /* * This handles ioctls actually performed on our vcc - we must return * -ENOIOCTLCMD for any unrecognized ioctl */ static int pppoatm_ioctl(struct atm_vcc *atmvcc, unsigned int cmd, unsigned long arg) { if (cmd != ATM_SETBACKEND && atmvcc->push != pppoatm_push) return -ENOIOCTLCMD; switch (cmd) { case ATM_SETBACKEND: { atm_backend_t b; if (get_user(b, (atm_backend_t *) arg)) return -EFAULT; if (b != ATM_BACKEND_PPP) return -ENOIOCTLCMD; if (!capable(CAP_NET_ADMIN)) return -EPERM; return pppoatm_assign_vcc(atmvcc, arg); } case PPPIOCGCHAN: return put_user(ppp_channel_index(&atmvcc_to_pvcc(atmvcc)-> chan), (int *) arg) ? -EFAULT : 0; case PPPIOCGUNIT: return put_user(ppp_unit_number(&atmvcc_to_pvcc(atmvcc)-> chan), (int *) arg) ? -EFAULT : 0; } return -ENOIOCTLCMD; } /* the following avoids some spurious warnings from the compiler */ #define UNUSED __attribute__((unused)) extern int (*pppoatm_ioctl_hook)(struct atm_vcc *, unsigned int, unsigned long); static int __init UNUSED pppoatm_init(void) { pppoatm_ioctl_hook = pppoatm_ioctl; return 0; } static void __exit UNUSED pppoatm_exit(void) { pppoatm_ioctl_hook = NULL; } module_init(pppoatm_init); module_exit(pppoatm_exit); MODULE_AUTHOR("Mitchell Blank Jr <mi...@sf...>"); MODULE_DESCRIPTION("RFC2364 PPP over ATM/AAL5"); Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 17:17:08 -0000 1.1.1.1 +++ Makefile 9 Apr 2002 16:20:45 -0000 1.2 @@ -7,16 +7,14 @@ # # Note 2! The CFLAGS definition is now in the main makefile... -include ../../.config +O_TARGET := atm.o -O_TARGET= atm.o +export-objs := common.o atm_misc.o raw.o resources.o ipcommon.o proc.o -export-objs = common.o atm_misc.o raw.o resources.o ipcommon.o proc.o +list-multi := mpoa.o +mpoa-objs := mpc.o mpoa_caches.o mpoa_proc.o -multi-list = mpoa.o -mpoa-objs = mpc.o mpoa_caches.o mpoa_proc.o - -obj-$(CONFIG_ATM) = addr.o pvc.o signaling.o svc.o common.o atm_misc.o raw.o resources.o +obj-$(CONFIG_ATM) := addr.o pvc.o signaling.o svc.o common.o atm_misc.o raw.o resources.o ifeq ($(CONFIG_ATM_CLIP),y) obj-y += clip.o @@ -35,6 +33,7 @@ obj-$(CONFIG_ATM_LANE) += lec.o obj-$(CONFIG_ATM_MPOA) += mpoa.o +obj-$(CONFIG_PPPOATM) += pppoatm.o include $(TOPDIR)/Rules.make Index: addr.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/addr.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- addr.c 14 Jan 2001 17:17:09 -0000 1.1.1.1 +++ addr.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -52,25 +52,26 @@ sigd_enq(NULL,as_itf_notify,NULL,&pvc,NULL); } +/* + * This is called from atm_ioctl only. You must hold the lock as a caller + */ -void reset_addr(struct atm_dev *dev) +void atm_reset_addr(struct atm_dev *dev) { struct atm_dev_addr *this; down(&local_lock); - spin_lock (&atm_dev_lock); while (dev->local) { this = dev->local; dev->local = this->next; kfree(this); } up(&local_lock); - spin_unlock (&atm_dev_lock); notify_sigd(dev); } -int add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr) +int atm_add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr) { struct atm_dev_addr **walk; int error; @@ -96,7 +97,7 @@ } -int del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr) +int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr) { struct atm_dev_addr **walk,*this; int error; @@ -119,7 +120,7 @@ } -int get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size) +int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size) { struct atm_dev_addr *walk; int total; Index: addr.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/addr.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- addr.h 14 Jan 2001 17:17:09 -0000 1.1.1.1 +++ addr.h 9 Apr 2002 16:20:45 -0000 1.2 @@ -10,9 +10,9 @@ #include <linux/atmdev.h> -void reset_addr(struct atm_dev *dev); -int add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); -int del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); -int get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size); +void atm_reset_addr(struct atm_dev *dev); +int atm_add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); +int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr); +int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size); #endif Index: clip.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/clip.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- clip.c 14 Jan 2001 17:17:12 -0000 1.1.1.1 +++ clip.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -571,7 +571,6 @@ /* compromise between decent burst-tolerance and protection */ /* against memory hogs. */ dev->flags = 0; - dev_init_buffers(dev); /* is this ever supposed to be used ? */ return 0; } @@ -686,8 +685,6 @@ static void atmarpd_close(struct atm_vcc *vcc) { - struct sk_buff *skb; - DPRINTK("atmarpd_close\n"); atmarpd = NULL; /* assumed to be atomic */ barrier(); @@ -696,7 +693,7 @@ if (skb_peek(&vcc->recvq)) printk(KERN_ERR "atmarpd_close: closing with requests " "pending\n"); - while ((skb = skb_dequeue(&vcc->recvq))) kfree_skb(skb); + skb_queue_purge(&vcc->recvq); DPRINTK("(done)\n"); } Index: common.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/common.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- common.c 25 Feb 2001 23:14:57 -0000 1.1.1.2 +++ common.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -58,6 +58,11 @@ #endif #endif +#if defined(CONFIG_PPPOATM) || defined(CONFIG_PPPOATM_MODULE) +int (*pppoatm_ioctl_hook)(struct atm_vcc *, unsigned int, unsigned long); +EXPORT_SYMBOL(pppoatm_ioctl_hook); +#endif + #include "resources.h" /* atm_find_dev */ #include "common.h" /* prototypes */ #include "protocols.h" /* atm_init_<transport> */ @@ -544,7 +549,7 @@ { struct atm_dev *dev; struct atm_vcc *vcc; - int *tmp_buf; + int *tmp_buf, *tmp_p; void *buf; int error,len,size,number, ret_val; @@ -598,14 +603,13 @@ ret_val = -ENOMEM; goto done; } + tmp_p = tmp_buf; for (dev = atm_devs; dev; dev = dev->next) - *tmp_buf++ = dev->number; - if (copy_to_user(buf,(char *) tmp_buf-size,size)) { - ret_val = -EFAULT; - goto done; - } - ret_val = put_user(size, - &((struct atm_iobuf *) arg)->length) ? -EFAULT : 0; + *tmp_p++ = dev->number; + ret_val = ((copy_to_user(buf, tmp_buf, size)) || + put_user(size, &((struct atm_iobuf *) arg)->length) + ) ? -EFAULT : 0; + kfree(tmp_buf); goto done; case SIOCGSTAMP: /* borrowed from IP */ if (!vcc->timestamp.tv_sec) { @@ -774,6 +778,13 @@ default: break; } +#if defined(CONFIG_PPPOATM) || defined(CONFIG_PPPOATM_MODULE) + if (pppoatm_ioctl_hook) { + ret_val = pppoatm_ioctl_hook(vcc, cmd, arg); + if (ret_val != -ENOIOCTLCMD) + goto done; + } +#endif if (get_user(buf,&((struct atmif_sioc *) arg)->arg)) { ret_val = -EFAULT; goto done; @@ -867,7 +878,7 @@ ret_val = -EPERM; goto done; } - reset_addr(dev); + atm_reset_addr(dev); break; case ATM_ADDADDR: case ATM_DELADDR: @@ -883,13 +894,13 @@ goto done; } if (cmd == ATM_ADDADDR) - ret_val = add_addr(dev,&addr); + ret_val = atm_add_addr(dev,&addr); else - ret_val = del_addr(dev,&addr); + ret_val = atm_del_addr(dev,&addr); goto done; } case ATM_GETADDR: - size = get_addr(dev,buf,len); + size = atm_get_addr(dev,buf,len); if (size < 0) ret_val = size; else @@ -931,6 +942,8 @@ if (size) ret_val = put_user(size,&((struct atmif_sioc *) arg)->length) ? -EFAULT : 0; + else + ret_val = 0; done: spin_unlock (&atm_dev_lock); Index: lec.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/lec.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- lec.c 25 Feb 2001 23:14:57 -0000 1.1.1.2 +++ lec.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -51,9 +51,9 @@ #define DPRINTK(format,args...) #endif -struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br, +extern struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br, unsigned char *addr); -void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent); +extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent); #define DUMP_PACKETS 0 /* 0 = None, @@ -281,6 +281,10 @@ dev->name, skb->len,skb->truesize); nb=(unsigned char*)kmalloc(64, GFP_ATOMIC); + if (nb == NULL) { + dev_kfree_skb(skb); + return 0; + } memcpy(nb,skb->data,skb->len); kfree(skb->head); skb->head = skb->data = nb; @@ -1796,6 +1800,10 @@ entry = lec_arp_find(priv, mac_addr); if (!entry) { entry = make_entry(priv, mac_addr); + if (!entry) { + lec_arp_unlock(priv); + return; + } entry->status = ESI_UNKNOWN; lec_arp_put(priv->lec_arp_tables, entry); /* Temporary, changes before end of function */ @@ -1890,6 +1898,10 @@ ioc_data->atm_addr[16],ioc_data->atm_addr[17], ioc_data->atm_addr[18],ioc_data->atm_addr[19]); entry = make_entry(priv, bus_mac); + if (entry == NULL) { + lec_arp_unlock(priv); + return; + } memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN); memset(entry->mac_addr, 0, ETH_ALEN); entry->recv_vcc = vcc; @@ -1967,6 +1979,10 @@ /* Not found, snatch address from first data packet that arrives from this vcc */ entry = make_entry(priv, bus_mac); + if (!entry) { + lec_arp_unlock(priv); + return; + } entry->vcc = vcc; entry->old_push = old_push; memcpy(entry->atm_addr, ioc_data->atm_addr, ATM_ESA_LEN); @@ -2177,3 +2193,4 @@ lec_arp_put(priv->lec_arp_tables,entry); lec_arp_unlock(priv); } +MODULE_LICENSE("GPL"); Index: mpc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/mpc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- mpc.c 14 Jan 2001 17:17:34 -0000 1.1.1.1 +++ mpc.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -772,6 +772,8 @@ if (mpc == NULL) { dprintk("mpoa: mpoad_attach: allocating new mpc for itf %d\n", arg); mpc = alloc_mpc(); + if (mpc == NULL) + return -ENOMEM; mpc->dev_num = arg; mpc->dev = find_lec_by_itfnum(arg); /* NULL if there was no lec */ } @@ -1477,3 +1479,4 @@ return; } #endif /* MODULE */ +MODULE_LICENSE("GPL"); Index: mpoa_proc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/mpoa_proc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- mpoa_proc.c 14 Jan 2001 17:17:38 -0000 1.1.1.1 +++ mpoa_proc.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -109,8 +109,6 @@ eg_cache_entry *eg_entry; struct timeval now; unsigned char ip_string[16]; - if(count < 0) - return -EINVAL; if(count == 0) return 0; page = get_free_page(GFP_KERNEL); @@ -173,9 +171,8 @@ char *page, c; const char *tmp; - if (nbytes < 0) return -EINVAL; if (nbytes == 0) return 0; - if (nbytes > PAGE_SIZE) nbytes = PAGE_SIZE-1; + if (nbytes >= PAGE_SIZE) nbytes = PAGE_SIZE-1; error = verify_area(VERIFY_READ, buff, nbytes); if (error) return error; Index: proc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/proc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- proc.c 14 Jan 2001 17:17:40 -0000 1.1.1.1 +++ proc.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -495,7 +495,7 @@ unsigned long page; int length; - if (count < 0) return -EINVAL; + if (count == 0) return 0; page = get_free_page(GFP_KERNEL); if (!page) return -ENOMEM; dev = ((struct proc_dir_entry *) file->f_dentry->d_inode->u.generic_ip) @@ -524,7 +524,7 @@ info = ((struct proc_dir_entry *) file->f_dentry->d_inode->u.generic_ip) ->data; - if (count < 0) return -EINVAL; + if (count == 0) return 0; page = get_free_page(GFP_KERNEL); if (!page) return -ENOMEM; length = (*info)(*pos,(char *) page); @@ -561,7 +561,6 @@ dev->proc_entry->proc_fops = &proc_dev_atm_operations; dev->proc_entry->owner = THIS_MODULE; return 0; - kfree(dev->proc_entry); fail0: kfree(dev->proc_name); fail1: Index: pvc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/pvc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- pvc.c 14 Jan 2001 17:17:41 -0000 1.1.1.1 +++ pvc.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -95,6 +95,7 @@ sendmsg: atm_sendmsg, recvmsg: atm_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; Index: resources.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/resources.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- resources.c 14 Jan 2001 17:17:41 -0000 1.1.1.1 +++ resources.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -36,13 +36,18 @@ if (!dev) return NULL; memset(dev,0,sizeof(*dev)); dev->type = type; - dev->prev = last_dev; dev->signal = ATM_PHY_SIG_UNKNOWN; dev->link_rate = ATM_OC3_PCR; dev->next = NULL; + + spin_lock(&atm_dev_lock); + + dev->prev = last_dev; + if (atm_devs) last_dev->next = dev; else atm_devs = dev; last_dev = dev; + spin_unlock(&atm_dev_lock); return dev; } Index: signaling.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/signaling.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- signaling.c 14 Jan 2001 17:17:42 -0000 1.1.1.1 +++ signaling.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -211,14 +211,13 @@ static void sigd_close(struct atm_vcc *vcc) { - struct sk_buff *skb; struct atm_dev *dev; DPRINTK("sigd_close\n"); sigd = NULL; if (skb_peek(&vcc->recvq)) printk(KERN_ERR "sigd_close: closing with requests pending\n"); - while ((skb = skb_dequeue(&vcc->recvq))) kfree_skb(skb); + skb_queue_purge(&vcc->recvq); purge_vccs(nodev_vccs); spin_lock (&atm_dev_lock); Index: svc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/atm/svc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- svc.c 14 Jan 2001 17:17:44 -0000 1.1.1.1 +++ svc.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -408,6 +408,7 @@ sendmsg: atm_sendmsg, recvmsg: atm_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; |
From: Andy P. <at...@us...> - 2002-04-09 16:20:49
|
Update of /cvsroot/linux-vax/kernel-2.4/net/appletalk In directory usw-pr-cvs1:/tmp/cvs-serv30559/appletalk Modified Files: aarp.c ddp.c Log Message: synch 2.4.15 commit 18 Index: aarp.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/appletalk/aarp.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- aarp.c 25 Feb 2001 23:14:55 -0000 1.1.1.2 +++ aarp.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -58,6 +58,7 @@ #include <linux/atalk.h> #include <linux/init.h> #include <linux/proc_fs.h> +#include <linux/module.h> int sysctl_aarp_expiry_time = AARP_EXPIRY_TIME; int sysctl_aarp_tick_time = AARP_TICK_TIME; @@ -97,11 +98,7 @@ */ static void __aarp_expire(struct aarp_entry *a) { - struct sk_buff *skb; - - while ((skb = skb_dequeue(&a->packet_queue)) != NULL) - kfree_skb(skb); - + skb_queue_purge(&a->packet_queue); kfree(a); } @@ -844,9 +841,7 @@ } static struct notifier_block aarp_notifier = { - aarp_device_event, - NULL, - 0 + notifier_call: aarp_device_event, }; static char aarp_snap_id[] = { 0x00, 0x00, 0x00, 0x80, 0xF3 }; @@ -888,8 +883,8 @@ int len, ct; len = sprintf(buffer, - "%-10.10s ""%-10.10s""%-18.18s""%12.12s""%12.12s"" xmit_count status\n", - "address","device","hw addr","last_sent", "expires"); + "%-10.10s %-10.10s%-18.18s%12.12s%12.12s xmit_count status\n", + "address", "device", "hw addr", "last_sent", "expires"); spin_lock_bh(&aarp_lock); @@ -988,3 +983,4 @@ } #endif #endif /* CONFIG_ATALK || CONFIG_ATALK_MODULE */ +MODULE_LICENSE("GPL"); Index: ddp.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/appletalk/ddp.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- ddp.c 25 Feb 2001 23:14:55 -0000 1.1.1.2 +++ ddp.c 9 Apr 2002 16:20:45 -0000 1.2 @@ -113,8 +113,6 @@ struct datalink_proto *ddp_dl, *aarp_dl; static struct proto_ops atalk_dgram_ops; -#define min(a,b) (((a)<(b))?(a):(b)) - /**************************************************************************\ * * * Handlers for the socket list. * @@ -754,7 +752,7 @@ /* ioctl calls. Shouldn't even need touching */ /* Device configuration ioctl calls */ -int atif_ioctl(int cmd, void *arg) +static int atif_ioctl(int cmd, void *arg) { static char aarp_mcast[6] = {0x09, 0x00, 0x00, 0xFF, 0xFF, 0xFF}; struct ifreq atreq; @@ -1392,7 +1390,7 @@ /* Trim buffer in case of stray trailing data */ origlen = skb->len; - skb_trim(skb, min(skb->len, ddphv.deh_len)); + skb_trim(skb, min_t(unsigned int, skb->len, ddphv.deh_len)); /* * Size check to see if ddp->deh_len was crap @@ -1457,7 +1455,7 @@ } /* Fix up skb->len field */ - skb_trim(skb, min(origlen, rt->dev->hard_header_len + + skb_trim(skb, min_t(unsigned int, origlen, rt->dev->hard_header_len + ddp_dl->header_length + ddphv.deh_len)); /* Mend the byte order */ @@ -1672,7 +1670,7 @@ sk, size, dev->name); size += dev->hard_header_len; - skb = sock_alloc_send_skb(sk, size, 0, (flags & MSG_DONTWAIT), &err); + skb = sock_alloc_send_skb(sk, size, (flags & MSG_DONTWAIT), &err); if (!skb) return err; @@ -1857,7 +1855,15 @@ case SIOCDIFADDR: case SIOCSARP: /* proxy AARP */ case SIOCDARP: /* proxy AARP */ - return atif_ioctl(cmd, (void *)arg); + { + int ret; + + rtnl_lock(); + ret = atif_ioctl(cmd, (void *)arg); + rtnl_unlock(); + + return ret; + } /* Physical layer ioctl calls */ case SIOCSIFLINK: case SIOCGIFHWADDR: @@ -1913,6 +1919,7 @@ sendmsg: atalk_sendmsg, recvmsg: atalk_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; #include <linux/smp_lock.h> @@ -1988,7 +1995,7 @@ * Use counts are incremented/decremented when * sockets are created/deleted. * - * AppleTalk interfaces are not incremented untill atalkd is run + * AppleTalk interfaces are not incremented until atalkd is run * and are only decremented when they are downed. * * Ergo, before the AppleTalk module can be removed, all AppleTalk |
From: Andy P. <at...@us...> - 2002-04-09 16:20:48
|
Update of /cvsroot/linux-vax/kernel-2.4/net/802 In directory usw-pr-cvs1:/tmp/cvs-serv30559/802 Modified Files: Makefile TODO cl2llc.c cl2llc.pre hippi.c llc_sendpdu.c Log Message: synch 2.4.15 commit 18 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/802/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 17:07:07 -0000 1.1.1.1 +++ Makefile 9 Apr 2002 16:20:44 -0000 1.2 @@ -58,6 +58,3 @@ cl2llc.c: cl2llc.pre sed -f ./pseudo/opcd2num.sed cl2llc.pre >cl2llc.c - -tar: - tar -cvf /dev/f1 . Index: TODO =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/802/TODO,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- TODO 14 Jan 2001 17:07:14 -0000 1.1.1.1 +++ TODO 9 Apr 2002 16:20:44 -0000 1.2 @@ -9,7 +9,7 @@ 2. The code is currently able to handle one connection only, there is more work in register_cl2llc_client() to make a chain of llc structures and in mac_data_indicate() to find back -the llc structure addressed by an incomming frame. +the llc structure addressed by an incoming frame. According to IEEE, connections are identified by (remote mac + local mac + dsap + ssap). dsap and ssap do not seem important: existing applications always use the same dsap/ssap. Its probably sufficient to index on Index: cl2llc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/802/cl2llc.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- cl2llc.c 25 Feb 2001 23:14:55 -0000 1.1.1.2 +++ cl2llc.c 9 Apr 2002 16:20:44 -0000 1.2 @@ -162,7 +162,7 @@ * Interpret_pseudo_code() executes the actions in the connection component * state transition table. Table 4 in document on p88. * - * If this function is called to handle an incomming pdu, skb will point + * If this function is called to handle an incoming pdu, skb will point * to the buffer with the pdu and type will contain the decoded pdu type. * * If called by data_request skb points to an skb that was skb_alloc-ed by Index: cl2llc.pre =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/802/cl2llc.pre,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cl2llc.pre 14 Jan 2001 17:07:16 -0000 1.1.1.1 +++ cl2llc.pre 9 Apr 2002 16:20:44 -0000 1.2 @@ -28,7 +28,7 @@ #include <linux/types.h> #include <linux/kernel.h> -#include <linux/malloc.h> +#include <linux/slab.h> #include <linux/netdevice.h> #include <linux/skbuff.h> #include <net/p8022.h> @@ -162,7 +162,7 @@ * Interpret_pseudo_code() executes the actions in the connection component * state transition table. Table 4 in document on p88. * - * If this function is called to handle an incomming pdu, skb will point + * If this function is called to handle an incoming pdu, skb will point * to the buffer with the pdu and type will contain the decoded pdu type. * * If called by data_request skb points to an skb that was skb_alloc-ed by Index: hippi.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/802/hippi.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- hippi.c 14 Jan 2001 17:07:12 -0000 1.1.1.1 +++ hippi.c 9 Apr 2002 16:20:44 -0000 1.2 @@ -98,7 +98,7 @@ memcpy(&skb->private.ifield, daddr + 2, 4); return HIPPI_HLEN; } - return -HIPPI_HLEN; + return -((int)HIPPI_HLEN); } Index: llc_sendpdu.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/802/llc_sendpdu.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- llc_sendpdu.c 25 Feb 2001 23:14:55 -0000 1.1.1.2 +++ llc_sendpdu.c 9 Apr 2002 16:20:44 -0000 1.2 @@ -98,7 +98,7 @@ /* * Sendpdu() constructs an output frame in a new skb and - * gives it to the MAC layer for transmision. + * gives it to the MAC layer for transmission. * This function is not used to send I pdus. * No queues are updated here, nothing is saved for retransmission. * @@ -186,7 +186,7 @@ /* * llc_sendipdu() Completes an I pdu in an existing skb and gives it - * to the MAC layer for transmision. + * to the MAC layer for transmission. * Parameter "type" must be either I_CMD or I_RSP. * The skb is not freed after xmit, it is kept in case a retransmission * is requested. If needed it can be picked up again from the rtq. |
From: Andy P. <at...@us...> - 2002-04-09 16:20:48
|
Update of /cvsroot/linux-vax/kernel-2.4/net/802/pseudo In directory usw-pr-cvs1:/tmp/cvs-serv30559/802/pseudo Modified Files: pseudocode Log Message: synch 2.4.15 commit 18 Index: pseudocode =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/802/pseudo/pseudocode,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- pseudocode 14 Jan 2001 17:07:22 -0000 1.1.1.1 +++ pseudocode 9 Apr 2002 16:20:44 -0000 1.2 @@ -246,7 +246,7 @@ START_REJ_TIMER ; ; the order of opcodes in NORMAL8 is changed. -; the transition table will execute NORMAL8A for incomming pdus +; the transition table will execute NORMAL8A for incoming pdus ; with p/f 1, pdus with pf 0 are treated in NORMAL8B. ; NORMAL8A V(R):=V(R)+1 |
From: Andy P. <at...@us...> - 2002-04-09 16:20:48
|
Update of /cvsroot/linux-vax/kernel-2.4/net/802/transit In directory usw-pr-cvs1:/tmp/cvs-serv30559/802/transit Modified Files: pdutr.pre Log Message: synch 2.4.15 commit 18 Index: pdutr.pre =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/802/transit/pdutr.pre,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- pdutr.pre 14 Jan 2001 17:07:35 -0000 1.1.1.1 +++ pdutr.pre 9 Apr 2002 16:20:44 -0000 1.2 @@ -1,6 +1,6 @@ COMPILE pdutr INDEX ; -; Transition tables for incomming pdu events. +; Transition tables for incoming pdu events. ; translate this thing into C with ; awk -f ./compile.awk pdu.trans > pdutr.h ; |
From: Andy P. <at...@us...> - 2002-04-09 16:20:47
|
Update of /cvsroot/linux-vax/kernel-2.4/net In directory usw-pr-cvs1:/tmp/cvs-serv30559 Modified Files: Config.in Makefile README Log Message: synch 2.4.15 commit 18 Index: Config.in =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/Config.in,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- Config.in 25 Feb 2001 23:14:55 -0000 1.1.1.2 +++ Config.in 9 Apr 2002 16:20:44 -0000 1.2 @@ -46,6 +46,9 @@ tristate ' Multi-Protocol Over ATM (MPOA) support' CONFIG_ATM_MPOA fi fi + + dep_tristate '802.1Q VLAN Support (EXPERIMENTAL)' CONFIG_VLAN_8021Q $CONFIG_EXPERIMENTAL + fi comment ' ' @@ -81,7 +84,7 @@ mainmenu_option next_comment comment 'QoS and/or fair queueing' -bool 'QoS and/or fair queueing (EXPERIMENTAL)' CONFIG_NET_SCHED +bool 'QoS and/or fair queueing' CONFIG_NET_SCHED if [ "$CONFIG_NET_SCHED" = "y" ]; then source net/sched/Config.in fi Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 17:06:51 -0000 1.1.1.1 +++ Makefile 9 Apr 2002 16:20:44 -0000 1.2 @@ -7,7 +7,7 @@ O_TARGET := network.o -mod-subdirs := ipv4/netfilter ipv6/netfilter ipx irda atm netlink sched +mod-subdirs := ipv4/netfilter ipv6/netfilter ipx irda bluetooth atm netlink sched export-objs := netsyms.o subdir-y := core ethernet @@ -40,10 +40,12 @@ subdir-$(CONFIG_ROSE) += rose subdir-$(CONFIG_AX25) += ax25 subdir-$(CONFIG_IRDA) += irda +subdir-$(CONFIG_BLUEZ) += bluetooth subdir-$(CONFIG_SUNRPC) += sunrpc subdir-$(CONFIG_ATM) += atm subdir-$(CONFIG_DECNET) += decnet subdir-$(CONFIG_ECONET) += econet +subdir-$(CONFIG_VLAN_8021Q) += 8021q obj-y := socket.o $(join $(subdir-y), $(patsubst %,/%.o,$(notdir $(subdir-y)))) Index: README =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/README,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- README 14 Jan 2001 17:06:59 -0000 1.1.1.1 +++ README 9 Apr 2002 16:20:44 -0000 1.2 @@ -5,7 +5,7 @@ -------------------+------------------------------------------- 802 [other ] al...@lx... [token ring ] p.n...@co... -appletalk js...@tu... +appletalk js...@sa... ax25 g4...@g4... bridge bu...@gn... core al...@lx... @@ -13,7 +13,8 @@ ethernet al...@lx... ipv4 da...@ca...,Eri...@dn... ipv6 da...@ca...,Eri...@dn... -ipx/spx js...@tu... +ipx ac...@co... +spx js...@sa... irda da...@cs... lapb g4...@g4... netrom g4...@g4... @@ -21,5 +22,5 @@ wanrouter ge...@co..., jaspreet@sangoma and dm...@sa... unix al...@lx... x25 g4...@g4... - +bluetooth ma...@qu... |
From: Andy P. <at...@us...> - 2002-04-09 15:14:14
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/utils In directory usw-pr-cvs1:/tmp/cvs-serv22358/arch/ppc/boot/utils Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/utils added to the repository |
From: Andy P. <at...@us...> - 2002-04-09 15:14:06
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/message In directory usw-pr-cvs1:/tmp/cvs-serv15435/drivers/message Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/message added to the repository |
From: Andy P. <at...@us...> - 2002-04-09 15:14:06
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/ospm/ac_adapter In directory usw-pr-cvs1:/tmp/cvs-serv13840/acpi/ospm/ac_adapter Added Files: Makefile ac.c ac_osl.c Log Message: synch 2.4.15 commit 17 --- NEW FILE --- O_TARGET := ospm_$(notdir $(CURDIR)).o obj-m := $(O_TARGET) EXTRA_CFLAGS += $(ACPI_CFLAGS) obj-y := $(patsubst %.c,%.o,$(wildcard *.c)) include $(TOPDIR)/Rules.make --- NEW FILE --- /***************************************************************************** * * Module Name: ac.c * $Revision: 1.1 $ * *****************************************************************************/ /* * Copyright (C) 2000, 2001 Andrew Grover * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <acpi.h> #include "ac.h" #define _COMPONENT ACPI_AC_ADAPTER MODULE_NAME ("ac") /**************************************************************************** * Internal Functions ****************************************************************************/ /**************************************************************************** * * FUNCTION: ac_print * * PARAMETERS: * * RETURN: * * DESCRIPTION: Prints out information on a specific ac_adapter. * ****************************************************************************/ void ac_print ( AC_CONTEXT *ac_adapter) { #ifdef ACPI_DEBUG acpi_buffer buffer; PROC_NAME("ac_print"); if (!ac_adapter) { return; } buffer.length = 256; buffer.pointer = acpi_os_callocate(buffer.length); if (!buffer.pointer) { return; } /* * Get the full pathname for this ACPI object. */ acpi_get_name(ac_adapter->acpi_handle, ACPI_FULL_PATHNAME, &buffer); /* * Print out basic adapter information. */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| AC Adapter[%02x]:[%p] %s\n", ac_adapter->device_handle, ac_adapter->acpi_handle, (char*)buffer.pointer)); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n")); acpi_os_free(buffer.pointer); #endif /*ACPI_DEBUG*/ return; } /**************************************************************************** * * FUNCTION: ac_add_device * * PARAMETERS: * * RETURN: * * DESCRIPTION: * ****************************************************************************/ acpi_status ac_add_device( BM_HANDLE device_handle, void **context) { acpi_status status = AE_OK; BM_DEVICE *device = NULL; AC_CONTEXT *ac_adapter = NULL; acpi_device_info info; FUNCTION_TRACE("ac_add_device"); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding ac_adapter device [%02x].\n", device_handle)); if (!context || *context) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.")); return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * Get information on this device. */ status = bm_get_device_info(device_handle, &device); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* * Allocate a new AC_CONTEXT structure. */ ac_adapter = acpi_os_callocate(sizeof(AC_CONTEXT)); if (!ac_adapter) { return_ACPI_STATUS(AE_NO_MEMORY); } ac_adapter->device_handle = device->handle; ac_adapter->acpi_handle = device->acpi_handle; /* * Get information on this object. */ status = acpi_get_object_info(ac_adapter->acpi_handle, &info); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to get object info for ac_adapter device.")); goto end; } /* * _UID? * ----- */ if (info.valid & ACPI_VALID_UID) { strncpy(ac_adapter->uid, info.unique_id, sizeof(info.unique_id)); } else { strncpy(ac_adapter->uid, "0", sizeof("0")); } /* * _STA? * ----- */ if (!(info.valid & ACPI_VALID_STA)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Must have valid _STA.\n")); status = AE_ERROR; goto end; } status = ac_osl_add_device(ac_adapter); if (ACPI_FAILURE(status)) { goto end; } *context = ac_adapter; ac_print(ac_adapter); end: if (ACPI_FAILURE(status)) { acpi_os_free(ac_adapter); } return_ACPI_STATUS(status); } /**************************************************************************** * * FUNCTION: ac_remove_device * * PARAMETERS: * * RETURN: * * DESCRIPTION: * ****************************************************************************/ acpi_status ac_remove_device ( void **context) { acpi_status status = AE_OK; AC_CONTEXT *ac_adapter = NULL; FUNCTION_TRACE("ac_remove_device"); if (!context || !*context) { return_ACPI_STATUS(AE_BAD_PARAMETER); } ac_adapter = (AC_CONTEXT*)*context; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing ac_adapter device [%02x].\n", ac_adapter->device_handle)); ac_osl_remove_device(ac_adapter); acpi_os_free(ac_adapter); *context = NULL; return_ACPI_STATUS(status); } /**************************************************************************** * External Functions ****************************************************************************/ /**************************************************************************** * * FUNCTION: ac_initialize * * PARAMETERS: <none> * * RETURN: * * DESCRIPTION: * ****************************************************************************/ acpi_status ac_initialize (void) { acpi_status status = AE_OK; BM_DEVICE_ID criteria; BM_DRIVER driver; FUNCTION_TRACE("ac_initialize"); MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID)); MEMSET(&driver, 0, sizeof(BM_DRIVER)); driver.notify = &ac_notify; driver.request = &ac_request; /* * Register driver for AC Adapter devices. */ MEMCPY(criteria.hid, AC_HID_AC_ADAPTER, sizeof(AC_HID_AC_ADAPTER)); status = bm_register_driver(&criteria, &driver); return_ACPI_STATUS(status); } /**************************************************************************** * * FUNCTION: ac_terminate * * PARAMETERS: <none> * * RETURN: * * DESCRIPTION: * ****************************************************************************/ acpi_status ac_terminate (void) { acpi_status status = AE_OK; BM_DEVICE_ID criteria; BM_DRIVER driver; FUNCTION_TRACE("ac_terminate"); MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID)); MEMSET(&driver, 0, sizeof(BM_DRIVER)); /* * Unregister driver for AC Adapter devices. */ MEMCPY(criteria.hid, AC_HID_AC_ADAPTER, sizeof(AC_HID_AC_ADAPTER)); driver.notify = &ac_notify; driver.request = &ac_request; status = bm_unregister_driver(&criteria, &driver); return_ACPI_STATUS(status); } /***************************************************************************** * * FUNCTION: ac_notify * * PARAMETERS: <none> * * RETURN: * * DESCRIPTION: * ****************************************************************************/ acpi_status ac_notify ( BM_NOTIFY notify_type, BM_HANDLE device_handle, void **context) { acpi_status status = AE_OK; FUNCTION_TRACE("ac_notify"); if (!context) { return_ACPI_STATUS(AE_BAD_PARAMETER); } switch (notify_type) { case BM_NOTIFY_DEVICE_ADDED: status = ac_add_device(device_handle, context); break; case BM_NOTIFY_DEVICE_REMOVED: status = ac_remove_device(context); break; case AC_NOTIFY_STATUS_CHANGE: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status change event detected.\n")); status = ac_osl_generate_event(notify_type, ((AC_CONTEXT*)*context)); break; default: status = AE_SUPPORT; break; } return_ACPI_STATUS(status); } /**************************************************************************** * * FUNCTION: ac_request * * PARAMETERS: * * RETURN: * * DESCRIPTION: * ****************************************************************************/ acpi_status ac_request ( BM_REQUEST *request, void *context) { acpi_status status = AE_OK; FUNCTION_TRACE("ac_request"); /* * Must have a valid request structure and context. */ if (!request || !context) { return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * Handle Request: * --------------- */ switch (request->command) { default: status = AE_SUPPORT; break; } request->status = status; return_ACPI_STATUS(status); } --- NEW FILE --- /***************************************************************************** * * Module Name: ac_osl.c * $Revision: 1.1 $ * *****************************************************************************/ /* * Copyright (C) 2000, 2001 Andrew Grover * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/proc_fs.h> #include <acpi.h> #include "ac.h" MODULE_AUTHOR("Andrew Grover"); MODULE_DESCRIPTION("ACPI Component Architecture (CA) - AC Adapter Driver"); #define AC_PROC_ROOT "ac_adapter" #define AC_PROC_STATUS "status" #define AC_ON_LINE "on-line" #define AC_OFF_LINE "off-line" extern struct proc_dir_entry *bm_proc_root; static struct proc_dir_entry *ac_proc_root = NULL; /**************************************************************************** * * FUNCTION: ac_osl_proc_read_status * ****************************************************************************/ static int ac_osl_proc_read_status ( char *page, char **start, off_t off, int count, int *eof, void *context) { acpi_status status = AE_OK; AC_CONTEXT *ac_adapter = NULL; char *p = page; int len; if (!context) { goto end; } ac_adapter = (AC_CONTEXT*)context; /* don't get status more than once for a single proc read */ if (off != 0) { goto end; } status = bm_evaluate_simple_integer(ac_adapter->acpi_handle, "_PSR", &(ac_adapter->is_online)); if (ACPI_FAILURE(status)) { p += sprintf(p, "Error reading AC Adapter status\n"); goto end; } if (ac_adapter->is_online) { p += sprintf(p, "Status: %s\n", AC_ON_LINE); } else { p += sprintf(p, "Status: %s\n", AC_OFF_LINE); } end: len = (p - page); if (len <= off+count) *eof = 1; *start = page + off; len -= off; if (len>count) len = count; if (len<0) len = 0; return(len); } /**************************************************************************** * * FUNCTION: ac_osl_add_device * ****************************************************************************/ acpi_status ac_osl_add_device( AC_CONTEXT *ac_adapter) { struct proc_dir_entry *proc_entry = NULL; if (!ac_adapter) { return(AE_BAD_PARAMETER); } printk(KERN_INFO "ACPI: AC Adapter found\n"); proc_entry = proc_mkdir(ac_adapter->uid, ac_proc_root); if (!proc_entry) { return(AE_ERROR); } create_proc_read_entry(AC_PROC_STATUS, S_IFREG | S_IRUGO, proc_entry, ac_osl_proc_read_status, (void*)ac_adapter); return(AE_OK); } /**************************************************************************** * * FUNCTION: ac_osl_remove_device * ****************************************************************************/ acpi_status ac_osl_remove_device ( AC_CONTEXT *ac_adapter) { char proc_entry[64]; if (!ac_adapter) { return(AE_BAD_PARAMETER); } sprintf(proc_entry, "%s/%s", ac_adapter->uid, AC_PROC_STATUS); remove_proc_entry(proc_entry, ac_proc_root); sprintf(proc_entry, "%s", ac_adapter->uid); remove_proc_entry(proc_entry, ac_proc_root); return(AE_OK); } /**************************************************************************** * * FUNCTION: ac_osl_generate_event * ****************************************************************************/ acpi_status ac_osl_generate_event ( u32 event, AC_CONTEXT *ac_adapter) { acpi_status status = AE_OK; if (!ac_adapter) { return(AE_BAD_PARAMETER); } switch (event) { case AC_NOTIFY_STATUS_CHANGE: status = bm_osl_generate_event(ac_adapter->device_handle, AC_PROC_ROOT, ac_adapter->uid, event, 0); break; default: return(AE_BAD_PARAMETER); break; } return(status); } /**************************************************************************** * * FUNCTION: ac_osl_init * * PARAMETERS: <none> * * RETURN: 0: Success * * DESCRIPTION: Module initialization. * ****************************************************************************/ static int __init ac_osl_init (void) { acpi_status status = AE_OK; ac_proc_root = proc_mkdir(AC_PROC_ROOT, bm_proc_root); if (!ac_proc_root) { status = AE_ERROR; } else { status = ac_initialize(); if (ACPI_FAILURE(status)) { remove_proc_entry(AC_PROC_ROOT, bm_proc_root); } } return (ACPI_SUCCESS(status)) ? 0 : -ENODEV; } /**************************************************************************** * * FUNCTION: ac_osl_cleanup * * PARAMETERS: <none> * * RETURN: <none> * * DESCRIPTION: Module cleanup. * ****************************************************************************/ static void __exit ac_osl_cleanup (void) { ac_terminate(); if (ac_proc_root) { remove_proc_entry(AC_PROC_ROOT, bm_proc_root); } return; } module_init(ac_osl_init); module_exit(ac_osl_cleanup); |
From: Andy P. <at...@us...> - 2002-04-09 15:14:04
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/ospm In directory usw-pr-cvs1:/tmp/cvs-serv13840/acpi/ospm Added Files: Makefile Log Message: synch 2.4.15 commit 17 --- NEW FILE --- # # Makefile for the Linux OSPM code. # O_TARGET := $(notdir $(CURDIR)).o ACPI_CFLAGS += -I$(CURDIR)/include EXTRA_CFLAGS += $(ACPI_CFLAGS) subdir-$(CONFIG_ACPI_BUSMGR) += busmgr subdir-$(CONFIG_ACPI_EC) += ec subdir-$(CONFIG_ACPI_SYS) += system subdir-$(CONFIG_ACPI_CPU) += processor subdir-$(CONFIG_ACPI_CMBATT) += battery subdir-$(CONFIG_ACPI_AC) += ac_adapter subdir-$(CONFIG_ACPI_BUTTON) += button subdir-$(CONFIG_ACPI_THERMAL) += thermal obj-y += $(foreach dir,$(subdir-y),$(dir)/ospm_$(dir).o) include $(TOPDIR)/Rules.make |
From: Andy P. <at...@us...> - 2002-04-09 15:14:03
|
Update of /cvsroot/linux-vax/kernel-2.4/Documentation/power In directory usw-pr-cvs1:/tmp/cvs-serv25064/Documentation/power Log Message: Directory /cvsroot/linux-vax/kernel-2.4/Documentation/power added to the repository |
From: Andy P. <at...@us...> - 2002-04-09 15:14:01
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/cris/drivers/examples In directory usw-pr-cvs1:/tmp/cvs-serv26816/arch/cris/drivers/examples Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/cris/drivers/examples added to the repository |
From: Andy P. <at...@us...> - 2002-04-09 15:13:57
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/utilities In directory usw-pr-cvs1:/tmp/cvs-serv9461/drivers/acpi/utilities Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/acpi/utilities added to the repository |