[PATCH] Add a number of protocols to __SOCKADDR_ALLTYPES

2017-08-03 Thread Ralf Baechle
__SOCKADDR_ALLTYPES is lacking a number of sockaddr_* variants so those
can't be passed to syscalls such as bind, sendto, recvfrom oder
getsockname or a warning or build error such as

beacon.c: In function ‘main’:
beacon.c:188:15: error: incompatible type for argument 2 of ‘bind’
   if (bind(s, , len) == -1) {

will hit.  Adding a number of sockaddr_* fixes these problems.

2017-08-03  Ralf Baechle  <r...@linux-mips.org>

* socket/sys/socket.h (__SOCKADDR_ALLTYPES.): Add
full_sockaddr_ax25 , sockaddr_ll, sockaddr_pkt and sockaddr_rose.

---
 socket/sys/socket.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/socket/sys/socket.h b/socket/sys/socket.h
index bbfde8f602..061f457993 100644
--- a/socket/sys/socket.h
+++ b/socket/sys/socket.h
@@ -61,6 +61,7 @@ enum
 /* Add more `struct sockaddr_AF' types here as necessary.
These are all the ones I found on NetBSD and Linux.  */
 # define __SOCKADDR_ALLTYPES \
+  __SOCKADDR_ONETYPE (full_sockaddr_ax25) \
   __SOCKADDR_ONETYPE (sockaddr) \
   __SOCKADDR_ONETYPE (sockaddr_at) \
   __SOCKADDR_ONETYPE (sockaddr_ax25) \
@@ -71,7 +72,10 @@ enum
   __SOCKADDR_ONETYPE (sockaddr_inarp) \
   __SOCKADDR_ONETYPE (sockaddr_ipx) \
   __SOCKADDR_ONETYPE (sockaddr_iso) \
+  __SOCKADDR_ONETYPE (sockaddr_ll) \
   __SOCKADDR_ONETYPE (sockaddr_ns) \
+  __SOCKADDR_ONETYPE (sockaddr_pkt) \
+  __SOCKADDR_ONETYPE (sockaddr_rose) \
   __SOCKADDR_ONETYPE (sockaddr_un) \
   __SOCKADDR_ONETYPE (sockaddr_x25)
 
--
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] AX.25 sockets not destroyed

2017-02-23 Thread Ralf Baechle DL5RB
On Thu, Feb 23, 2017 at 02:53:36PM +0100, f6bvp wrote:

> 8c80b5ed5800 ax0 F6BVP-7 F4BWT-9 1 0 0 0 18446744073709549 100 0 3 0 300 
> 0 0 9 10 5 2 256 * * *
> 8c80b5ed5400 ax0 F6BVP-7 WA3MEZ-9 1 0 0 0 18446744073709549 100 0 3 0 300 
> 0 0 9 10 5 2 256 * * *

> then it displays a very large number for a while,

The large number is an already expired t1 timer.  That means the time
to expiry is relativly small negative number like -1616 or as a hex
number 0xf9b0 which will be divied by HZ (probably 1000)
and displayed as a something like 18446744073709550.

Looking further into it.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] NET: Fix /proc/net/arp for AX.25

2017-02-10 Thread Ralf Baechle
When sending ARP requests over AX.25 links the hwaddress in the neighbour
cache are not getting initialized.  For such an incomplete arp entry
ax2asc2 will generate an empty string resulting in /proc/net/arp output
like the following:

$ cat /proc/net/arp
IP address   HW type Flags   HW addressMask Device
192.168.122.10x1 0x2 52:54:00:00:5d:5f *ens3
172.20.1.99  0x3 0x0  *bpq0

The missing field will confuse the procfs parsing of arp(8) resulting in
incorrect output for the device such as the following:

$ arp
Address  HWtype  HWaddress   Flags MaskIface
gateway  ether   52:54:00:00:5d:5f   C ens3
172.20.1.99  (incomplete)  ens3

This changes the content of /proc/net/arp to:

$ cat /proc/net/arp
IP address   HW type Flags   HW addressMask Device
172.20.1.99  0x3 0x0 * *bpq0
192.168.122.10x1 0x2 52:54:00:00:5d:5f *ens3

To do so it change ax2asc to put the string "*" in buf for a NULL address
argument.  Finally the HW address field is left aligned in a 17 character
field (the length of an ethernet HW address in the usual hex notation) for
readability.

Signed-off-by: Ralf Baechle <r...@linux-mips.org>
---
 net/ipv4/arp.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 89a8cac4..51b27ae 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1263,7 +1263,7 @@ void __init arp_init(void)
 /*
  * ax25 -> ASCII conversion
  */
-static char *ax2asc2(ax25_address *a, char *buf)
+static void ax2asc2(ax25_address *a, char *buf)
 {
char c, *s;
int n;
@@ -1285,10 +1285,10 @@ static char *ax2asc2(ax25_address *a, char *buf)
*s++ = n + '0';
*s++ = '\0';
 
-   if (*buf == '\0' || *buf == '-')
-   return "*";
-
-   return buf;
+   if (*buf == '\0' || *buf == '-') {
+   buf[0] = '*';
+   buf[1] = '\0';
+   }
 }
 #endif /* CONFIG_AX25 */
 
@@ -1322,7 +1322,7 @@ static void arp_format_neigh_entry(struct seq_file *seq,
}
 #endif
sprintf(tbuf, "%pI4", n->primary_key);
-   seq_printf(seq, "%-16s 0x%-10x0x%-10x%s *%s\n",
+   seq_printf(seq, "%-16s 0x%-10x0x%-10x%-17s *%s\n",
   tbuf, hatype, arp_state_to_flags(n), hbuffer, dev->name);
read_unlock(>lock);
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: AX.25 Kernel - problem - ax25_sendmsg returns EMSGSIZE !

2007-10-08 Thread Ralf Baechle DL5RB
On Sun, Oct 07, 2007 at 09:58:06PM +0200, Tihomir Heidelberg - 9a4gl wrote:

 Using kernel 2.6.21.6 here. If you write to AX.25 socket bytes more then
 MTU, write will return -1 and errno will be set to 90 (EMSGSIZE =
 [Message too long]).
 
 This happend in net/ax25/af_ax25.c in function ax25_sendmsg at:
 
 if (len  ax25-ax25_dev-dev-mtu) {
 err = -EMSGSIZE;
 goto out;
 }

This is a Linux 2.6.2 change, I append the patch which introduced the
change below.  I'm cc'ing Stephen Hemminger who hopefully recalls why his
patch did introduce this change.

(git users: commit id is 89aeba7545d7a2947e2f8f5fdee70f841c14 which is
only available in tglx's history tree on kernel.org)

 Old kernels, 2.2.x and 2.4.x accepted write with data length larger then
 MTU and for SOCK_SEQPACKET sockets the ax25_output function did the
 fragmentation job.
 
 According to man 2 write, write should return number of bytes written.
 I think that:
 
 1. ax25_sendmsg should accept data larger then mtu and pass the data to
 ax25_output.
 2. ax25_output should do fragmentation and queue frames into device queue.
 3. ax25_output should stop fragmenting when device queue is full
 4. ax25_output should return number of bytes queued on device
 5. ax25_sendmsg should return number of bytes accepted for xmiting

Agreed.

 Also, as I see, currently ax25 stack is not checking if dev_queue_xmit
 fails. Does this means that AX.25 kernel can loose some frames when
 device queue is full ?

Yes.  This isn't a bug - packet delivery is unreliable.  But what I'd
really like to see is the AX.25 stack to throttle itself instead of
continuing to stuff packets into an overflowing queue.

 By the way, this problem is having OpenBCM V1.07b3, very popular BBS
 software (http://dnx274.dyndns.org/baybox/) which writes as much data as
 it prepared.
 
 73 de Tihomir Heidelberg, 9a4gl(_a_t_)hamradio(d_o_t)hr
 

73 de DL5RB op Ralf

--
Loc.JN47BS / CQ 14 / ITU 28 / DOK A21
Packet: [EMAIL PROTECTED]

From 89aeba7545d7a2947e2f8f5fdee70f841c14 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger [EMAIL PROTECTED]
Date: Thu, 8 Jan 2004 09:53:15 -0800
Subject: [PATCH] [AX25]: Use size_t for size in {send,recv}msg.


diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 4fb1519..43472c6 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1401,7 +1401,7 @@ out:
 }
 
 static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
-   struct msghdr *msg, int len)
+   struct msghdr *msg, size_t len)
 {
struct sockaddr_ax25 *usax = (struct sockaddr_ax25 *)msg-msg_name;
struct sock *sk = sock-sk;
@@ -1410,7 +1410,8 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket 
*sock,
ax25_digi dtmp, *dp;
unsigned char *asmptr;
ax25_cb *ax25;
-   int lv, size, err, addr_len = msg-msg_namelen;
+   size_t size;
+   int lv, err, addr_len = msg-msg_namelen;
 
if (msg-msg_flags  ~(MSG_DONTWAIT|MSG_EOR)) {
return -EINVAL;
@@ -1435,6 +1436,11 @@ static int ax25_sendmsg(struct kiocb *iocb, struct 
socket *sock,
goto out;
}
 
+   if (len  ax25-ax25_dev-dev-mtu) {
+   err = -EMSGSIZE;
+   goto out;
+   }
+   
if (usax != NULL) {
if (usax-sax25_family != AF_AX25) {
err = -EINVAL;
@@ -1580,7 +1586,7 @@ out:
 }
 
 static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock,
-   struct msghdr *msg, int size, int flags)
+   struct msghdr *msg, size_t size, int flags)
 {
struct sock *sk = sock-sk;
struct sk_buff *skb;
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: AX25 tools and packages

2007-08-02 Thread Ralf Baechle DL5RB
On Thu, Aug 02, 2007 at 11:24:51AM +1000, Hamish Moffatt wrote:

  I'm using the latest patches from Debian since that seemed to be the latest 
  I could find.  Because my current builds are targeted at a 2.4 series 
  kernel in
  an embedded system they work with a few small patches but I'm planning
  on switching to 2.6 as soon as possible.
 
 There appears to be a misconception that 2.6 requires new tools. Notice
 that Ralf said newer Linux distributions (meaning newer libc, gcc etc)
 rather than newer kernels.

Correct.  Binary compatibility across kernels is one of the holy grails
in Linux and AX.25 is not exception to that.  Unfortunately that's a
little different for source code of the tools which at times may need a
little update to compile on a more recent system.

73 de DL5RB op Ralf

--
Loc.JN47BS / CQ 14 / ITU 28 / DOK A21
Packet: [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: AX25 tools and packages

2007-07-30 Thread Ralf Baechle DL5RB
On Thu, Jul 26, 2007 at 05:23:32PM +, Bill Vodall WA7NWP wrote:

 Is sourceforge still the primary repository for the ax25 library and tools?

Actually DL9SAU and me have moved the development away to another
machine a while ago when Sourceforge was basically unusable for weeks.
The new site is {cvs,www,ftp}.linux-ax25.org.  Thomas DL9SAU has done
various improvments and plenty of bugfixing as necessary to keep the
tools in shape for newer Linux distributions, but what we haven't done
yet and what is really overdue is a formal release.

73 de DL5RB op Ralf

--
Loc.JN47BS / CQ 14 / ITU 28 / DOK A21
Packet: [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] baycom_ser_fdx: also allow i/o ports = 0x1000 and enhanced failure logging

2007-03-05 Thread Ralf Baechle DL5RB
On Mon, Mar 05, 2007 at 02:45:09PM +0100, Thomas Sailer wrote:

 The baycom modem really doesn't have anything to do with RS232, it just
 uses the RS232 port as a PIO port + timer. That's why it needs its own
 16550 driver.

A few people asked me if it is possible to drive one of those RS232 abusing
modems through a USB-to-RS232 converter but I guess the answer is no?

73 de DL5RB op Ralf

--
Loc.JN47BS / CQ 14 / ITU 28 / DOK A21
Packet: [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: multiple kiss ports

2007-02-14 Thread Ralf Baechle DL5RB
On Thu, Feb 15, 2007 at 12:03:06AM +1030, Stef Daniels VK5HSX wrote:

 P4 1.2Ghz Celeron
 MSI Motherboard
 512MB RAM
 40GB ATA Drive
 ttyS0 -  9600bd -MFJ 1270b (1200bd TNC) axport '2'
 ttyS1 -  4800bd - AEA PK232 (4800bd TNC) axport '3'
 Debian GNU\linux 3.1  (2.4.27 kernel)
 using: libax25-0.0.11, ax25-apps-0.0.6, aax25-tools-0.0.8, node-0.3.2,
 fbb7.04j
 
 The problem is after we run our ax25 script to call up modules, tnc into
 kiss and kissattach devices (which all work fine), upon connect using
 port '2' the tnc sta LED comes on and tnc hangs.
 
 We have tried the following:
 
 Different- Computers, Cables, TNC's, O\S's, kernel's, hardrive, P\Supply
 and Serial ports (PCI Serial Cards), to NO avail.
 
 Any ideas, help, comments greatfully and most appreciatedly received!!

Did you try a 2.6 kernel also?  The 2.4 mkiss driver usually works just
fine but it's a fairly suspect piece of code anyway,  so I've turned the
KISS driver upside down for Linux 2.6.

A no-no at the current state of the code are SMP or preemptible kernels.

73 de DL5RB op Ralf

--
Loc.JN47BS / CQ 14 / ITU 28 / DOK A21
Packet: [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[AX.25 1/7] Mark all kmalloc users __must_check

2006-12-14 Thread Ralf Baechle
The recent fix 0506d4068bad834aab1141b5dc5e748eb175c6b3 made obvious that
error values were not being propagated through the AX.25 stack.  To help
with that this patch marks all kmalloc users in the AX.25, NETROM and
ROSE stacks as __must_check.

Signed-off-by: Ralf Baechle [EMAIL PROTECTED]

 include/net/ax25.h|   11 ++-
 include/net/rose.h|4 ++--
 net/ax25/af_ax25.c|4 ++--
 net/ax25/ax25_route.c |2 +-
 net/netrom/nr_route.c |8 +---
 net/rose/rose_route.c |2 +-
 6 files changed, 17 insertions(+), 14 deletions(-)

Index: linux-net/include/net/ax25.h
===
--- linux-net.orig/include/net/ax25.h
+++ linux-net/include/net/ax25.h
@@ -277,7 +277,7 @@ struct sock *ax25_get_socket(ax25_addres
 extern ax25_cb *ax25_find_cb(ax25_address *, ax25_address *, ax25_digi *, 
struct net_device *);
 extern void ax25_send_to_raw(ax25_address *, struct sk_buff *, int);
 extern void ax25_destroy_socket(ax25_cb *);
-extern ax25_cb *ax25_create_cb(void);
+extern ax25_cb * __must_check ax25_create_cb(void);
 extern void ax25_fillin_cb(ax25_cb *, ax25_dev *);
 extern struct sock *ax25_make_new(struct sock *, struct ax25_dev *);
 
@@ -333,11 +333,12 @@ extern void ax25_ds_t3timer_expiry(ax25_
 extern void ax25_ds_idletimer_expiry(ax25_cb *);
 
 /* ax25_iface.c */
-extern int  ax25_protocol_register(unsigned int, int (*)(struct sk_buff *, 
ax25_cb *));
+extern int __must_check ax25_protocol_register(unsigned int, int (*)(struct 
sk_buff *, ax25_cb *));
 extern void ax25_protocol_release(unsigned int);
-extern int  ax25_linkfail_register(void (*)(ax25_cb *, int));
+extern int __must_check ax25_linkfail_register(void (*)(ax25_cb *, int));
 extern void ax25_linkfail_release(void (*)(ax25_cb *, int));
-extern int  ax25_listen_register(ax25_address *, struct net_device *);
+extern int __must_check ax25_listen_register(ax25_address *,
+   struct net_device *);
 extern void ax25_listen_release(ax25_address *, struct net_device *);
 extern int  (*ax25_protocol_function(unsigned int))(struct sk_buff *, ax25_cb 
*);
 extern int  ax25_listen_mine(ax25_address *, struct net_device *);
@@ -415,7 +416,7 @@ extern unsigned long ax25_display_timer(
 /* ax25_uid.c */
 extern int  ax25_uid_policy;
 extern ax25_uid_assoc *ax25_findbyuid(uid_t);
-extern int  ax25_uid_ioctl(int, struct sockaddr_ax25 *);
+extern int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *);
 extern struct file_operations ax25_uid_fops;
 extern void ax25_uid_free(void);
 
Index: linux-net/include/net/rose.h
===
--- linux-net.orig/include/net/rose.h
+++ linux-net/include/net/rose.h
@@ -193,8 +193,8 @@ extern struct file_operations rose_neigh
 extern struct file_operations rose_nodes_fops;
 extern struct file_operations rose_routes_fops;
 
-extern int  rose_add_loopback_neigh(void);
-extern int  rose_add_loopback_node(rose_address *);
+extern int __must_check rose_add_loopback_neigh(void);
+extern int __must_check rose_add_loopback_node(rose_address *);
 extern void rose_del_loopback_node(rose_address *);
 extern void rose_rt_device_down(struct net_device *);
 extern void rose_link_device_down(struct net_device *);
Index: linux-net/net/ax25/af_ax25.c
===
--- linux-net.orig/net/ax25/af_ax25.c
+++ linux-net/net/ax25/af_ax25.c
@@ -1088,8 +1088,8 @@ out:
 /*
  * FIXME: nonblock behaviour looks like it may have a bug.
  */
-static int ax25_connect(struct socket *sock, struct sockaddr *uaddr,
-   int addr_len, int flags)
+static int __must_check ax25_connect(struct socket *sock,
+   struct sockaddr *uaddr, int addr_len, int flags)
 {
struct sock *sk = sock-sk;
ax25_cb *ax25 = ax25_sk(sk), *ax25t;
Index: linux-net/net/ax25/ax25_route.c
===
--- linux-net.orig/net/ax25/ax25_route.c
+++ linux-net/net/ax25/ax25_route.c
@@ -71,7 +71,7 @@ void ax25_rt_device_down(struct net_devi
write_unlock(ax25_route_lock);
 }
 
-static int ax25_rt_add(struct ax25_routes_struct *route)
+static int __must_check ax25_rt_add(struct ax25_routes_struct *route)
 {
ax25_route *ax25_rt;
ax25_dev *ax25_dev;
Index: linux-net/net/rose/rose_route.c
===
--- linux-net.orig/net/rose/rose_route.c
+++ linux-net/net/rose/rose_route.c
@@ -52,7 +52,7 @@ struct rose_neigh *rose_loopback_neigh;
  * Add a new route to a node, and in the process add the node and the
  * neighbour if it is new.
  */
-static int rose_add_node(struct rose_route_struct *rose_route,
+static int __must_check rose_add_node(struct rose_route_struct *rose_route,
struct net_device *dev)
 {
struct rose_node  *rose_node, *rose_tmpn, *rose_tmpp;
Index: linux-net/net/netrom/nr_route.c

[AX.25 7/7] Fix unchecked rose_add_loopback_neigh uses

2006-12-14 Thread Ralf Baechle
rose_add_loopback_neigh uses kmalloc and the callers were ignoring the
error value.  Rewrite to let the caller deal with the allocation.  This
allows the use of static allocation of kmalloc use entirely.

Signed-off-by: Ralf Baechle [EMAIL PROTECTED]

 include/net/rose.h   |4 ++--
 net/rose/rose_loopback.c |5 +++--
 net/rose/rose_route.c|   45 +
 3 files changed, 26 insertions(+), 28 deletions(-)

Index: linux-net/include/net/rose.h
===
--- linux-net.orig/include/net/rose.h
+++ linux-net/include/net/rose.h
@@ -188,12 +188,12 @@ extern void rose_kick(struct sock *);
 extern void rose_enquiry_response(struct sock *);
 
 /* rose_route.c */
-extern struct rose_neigh *rose_loopback_neigh;
+extern struct rose_neigh rose_loopback_neigh;
 extern struct file_operations rose_neigh_fops;
 extern struct file_operations rose_nodes_fops;
 extern struct file_operations rose_routes_fops;
 
-extern int __must_check rose_add_loopback_neigh(void);
+extern void rose_add_loopback_neigh(void);
 extern int __must_check rose_add_loopback_node(rose_address *);
 extern void rose_del_loopback_node(rose_address *);
 extern void rose_rt_device_down(struct net_device *);
Index: linux-net/net/rose/rose_loopback.c
===
--- linux-net.orig/net/rose/rose_loopback.c
+++ linux-net/net/rose/rose_loopback.c
@@ -79,7 +79,8 @@ static void rose_loopback_timer(unsigned
 
skb-h.raw = skb-data;
 
-   if ((sk = rose_find_socket(lci_o, rose_loopback_neigh)) != 
NULL) {
+   sk = rose_find_socket(lci_o, rose_loopback_neigh);
+   if (sk) {
if (rose_process_rx_frame(sk, skb) == 0)
kfree_skb(skb);
continue;
@@ -87,7 +88,7 @@ static void rose_loopback_timer(unsigned
 
if (frametype == ROSE_CALL_REQUEST) {
if ((dev = rose_dev_get(dest)) != NULL) {
-   if (rose_rx_call_request(skb, dev, 
rose_loopback_neigh, lci_o) == 0)
+   if (rose_rx_call_request(skb, dev, 
rose_loopback_neigh, lci_o) == 0)
kfree_skb(skb);
} else {
kfree_skb(skb);
Index: linux-net/net/rose/rose_route.c
===
--- linux-net.orig/net/rose/rose_route.c
+++ linux-net/net/rose/rose_route.c
@@ -46,7 +46,7 @@ static DEFINE_SPINLOCK(rose_neigh_list_l
 static struct rose_route *rose_route_list;
 static DEFINE_SPINLOCK(rose_route_list_lock);
 
-struct rose_neigh *rose_loopback_neigh;
+struct rose_neigh rose_loopback_neigh;
 
 /*
  * Add a new route to a node, and in the process add the node and the
@@ -361,33 +361,30 @@ out:
 /*
  * Add the loopback neighbour.
  */
-int rose_add_loopback_neigh(void)
+void rose_add_loopback_neigh(void)
 {
-   if ((rose_loopback_neigh = kmalloc(sizeof(struct rose_neigh), 
GFP_ATOMIC)) == NULL)
-   return -ENOMEM;
+   struct rose_neigh *sn = rose_loopback_neigh;
 
-   rose_loopback_neigh-callsign  = null_ax25_address;
-   rose_loopback_neigh-digipeat  = NULL;
-   rose_loopback_neigh-ax25  = NULL;
-   rose_loopback_neigh-dev   = NULL;
-   rose_loopback_neigh-count = 0;
-   rose_loopback_neigh-use   = 0;
-   rose_loopback_neigh-dce_mode  = 1;
-   rose_loopback_neigh-loopback  = 1;
-   rose_loopback_neigh-number= rose_neigh_no++;
-   rose_loopback_neigh-restarted = 1;
+   sn-callsign  = null_ax25_address;
+   sn-digipeat  = NULL;
+   sn-ax25  = NULL;
+   sn-dev   = NULL;
+   sn-count = 0;
+   sn-use   = 0;
+   sn-dce_mode  = 1;
+   sn-loopback  = 1;
+   sn-number= rose_neigh_no++;
+   sn-restarted = 1;
 
-   skb_queue_head_init(rose_loopback_neigh-queue);
+   skb_queue_head_init(sn-queue);
 
-   init_timer(rose_loopback_neigh-ftimer);
-   init_timer(rose_loopback_neigh-t0timer);
+   init_timer(sn-ftimer);
+   init_timer(sn-t0timer);
 
spin_lock_bh(rose_neigh_list_lock);
-   rose_loopback_neigh-next = rose_neigh_list;
-   rose_neigh_list   = rose_loopback_neigh;
+   sn-next = rose_neigh_list;
+   rose_neigh_list   = sn;
spin_unlock_bh(rose_neigh_list_lock);
-
-   return 0;
 }
 
 /*
@@ -421,13 +418,13 @@ int rose_add_loopback_node(rose_address 
rose_node-mask = 10;
rose_node-count= 1;
rose_node-loopback = 1;
-   rose_node-neighbour[0] = rose_loopback_neigh;
+   rose_node-neighbour[0] = rose_loopback_neigh;
 
/* Insert at the head of list. Address is always mask=10 */
rose_node-next = rose_node_list;
rose_node_list

[AX.25 5/7] Fix unchecked ax25_linkfail_register uses

2006-12-14 Thread Ralf Baechle
ax25_linkfail_register uses kmalloc and the callers were ignoring the
error value.  Rewrite to let the caller deal with the allocation.  This
allows the use of static allocation of kmalloc use entirely.

Signed-off-by: Ralf Baechle [EMAIL PROTECTED]

 include/net/ax25.h |   10 +++-
 net/ax25/ax25_iface.c  |   55 -
 net/netrom/af_netrom.c |8 +--
 net/rose/af_rose.c |8 +--
 4 files changed, 29 insertions(+), 52 deletions(-)

Index: linux-net/include/net/ax25.h
===
--- linux-net.orig/include/net/ax25.h
+++ linux-net/include/net/ax25.h
@@ -342,8 +342,14 @@ struct ax25_protocol {
 
 extern void ax25_register_pid(struct ax25_protocol *ap);
 extern void ax25_protocol_release(unsigned int);
-extern int __must_check ax25_linkfail_register(void (*)(ax25_cb *, int));
-extern void ax25_linkfail_release(void (*)(ax25_cb *, int));
+
+struct ax25_linkfail {
+   struct hlist_node lf_node;
+   void (*func)(ax25_cb *, int);
+};
+
+extern void ax25_linkfail_register(struct ax25_linkfail *lf);
+extern void ax25_linkfail_release(struct ax25_linkfail *lf);
 extern int __must_check ax25_listen_register(ax25_address *,
struct net_device *);
 extern void ax25_listen_release(ax25_address *, struct net_device *);
Index: linux-net/net/ax25/ax25_iface.c
===
--- linux-net.orig/net/ax25/ax25_iface.c
+++ linux-net/net/ax25/ax25_iface.c
@@ -32,10 +32,7 @@
 static struct ax25_protocol *protocol_list;
 static DEFINE_RWLOCK(protocol_list_lock);
 
-static struct linkfail_struct {
-   struct linkfail_struct *next;
-   void (*func)(ax25_cb *, int);
-} *linkfail_list = NULL;
+static HLIST_HEAD(ax25_linkfail_list);
 static DEFINE_SPINLOCK(linkfail_lock);
 
 static struct listen_struct {
@@ -93,54 +90,19 @@ void ax25_protocol_release(unsigned int 
 
 EXPORT_SYMBOL(ax25_protocol_release);
 
-int ax25_linkfail_register(void (*func)(ax25_cb *, int))
+void ax25_linkfail_register(struct ax25_linkfail *lf)
 {
-   struct linkfail_struct *linkfail;
-
-   if ((linkfail = kmalloc(sizeof(*linkfail), GFP_ATOMIC)) == NULL)
-   return 0;
-
-   linkfail-func = func;
-
spin_lock_bh(linkfail_lock);
-   linkfail-next = linkfail_list;
-   linkfail_list  = linkfail;
+   hlist_add_head(lf-lf_node, ax25_linkfail_list);
spin_unlock_bh(linkfail_lock);
-
-   return 1;
 }
 
 EXPORT_SYMBOL(ax25_linkfail_register);
 
-void ax25_linkfail_release(void (*func)(ax25_cb *, int))
+void ax25_linkfail_release(struct ax25_linkfail *lf)
 {
-   struct linkfail_struct *s, *linkfail;
-
spin_lock_bh(linkfail_lock);
-   linkfail = linkfail_list;
-   if (linkfail == NULL) {
-   spin_unlock_bh(linkfail_lock);
-   return;
-   }
-
-   if (linkfail-func == func) {
-   linkfail_list = linkfail-next;
-   spin_unlock_bh(linkfail_lock);
-   kfree(linkfail);
-   return;
-   }
-
-   while (linkfail != NULL  linkfail-next != NULL) {
-   if (linkfail-next-func == func) {
-   s = linkfail-next;
-   linkfail-next = linkfail-next-next;
-   spin_unlock_bh(linkfail_lock);
-   kfree(s);
-   return;
-   }
-
-   linkfail = linkfail-next;
-   }
+   hlist_del_init(lf-lf_node);
spin_unlock_bh(linkfail_lock);
 }
 
@@ -237,11 +199,12 @@ int (*ax25_protocol_function(unsigned in
 
 void ax25_link_failed(ax25_cb *ax25, int reason)
 {
-   struct linkfail_struct *linkfail;
+   struct ax25_linkfail *lf;
+   struct hlist_node *node;
 
spin_lock_bh(linkfail_lock);
-   for (linkfail = linkfail_list; linkfail != NULL; linkfail = 
linkfail-next)
-   (linkfail-func)(ax25, reason);
+   hlist_for_each_entry(lf, node, ax25_linkfail_list, lf_node)
+   lf-func(ax25, reason);
spin_unlock_bh(linkfail_lock);
 }
 
Index: linux-net/net/netrom/af_netrom.c
===
--- linux-net.orig/net/netrom/af_netrom.c
+++ linux-net/net/netrom/af_netrom.c
@@ -1382,6 +1382,10 @@ static struct ax25_protocol nr_pid = {
.func   = nr_route_frame
 };
 
+static struct ax25_linkfail nr_linkfail_notifier = {
+   .func   = nr_link_failed,
+};
+
 static int __init nr_proto_init(void)
 {
int i;
@@ -1430,7 +1434,7 @@ static int __init nr_proto_init(void)
register_netdevice_notifier(nr_dev_notifier);
 
ax25_register_pid(nr_pid);
-   ax25_linkfail_register(nr_link_failed);
+   ax25_linkfail_register(nr_linkfail_notifier);
 
 #ifdef CONFIG_SYSCTL
nr_register_sysctl();
@@ -1479,7 +1483,7 @@ static void __exit nr_exit(void)
nr_unregister_sysctl();
 #endif

[AX.25 3/7] Fix unchecked ax25_listen_register uses

2006-12-14 Thread Ralf Baechle
Fix ax25_listen_register to return something that's a sane error code,
then all callers to use it.

Signed-off-by: Ralf Baechle [EMAIL PROTECTED]

 net/ax25/ax25_iface.c |7 ---
 net/netrom/nr_dev.c   |   24 ++--
 net/rose/af_rose.c|3 ++-
 3 files changed, 24 insertions(+), 10 deletions(-)

Index: linux-net/net/ax25/ax25_iface.c
===
--- linux-net.orig/net/ax25/ax25_iface.c
+++ linux-net/net/ax25/ax25_iface.c
@@ -154,7 +154,7 @@ int ax25_listen_register(ax25_address *c
return 0;
 
if ((listen = kmalloc(sizeof(*listen), GFP_ATOMIC)) == NULL)
-   return 0;
+   return -ENOMEM;
 
listen-callsign = *callsign;
listen-dev  = dev;
@@ -164,7 +164,7 @@ int ax25_listen_register(ax25_address *c
listen_list  = listen;
spin_unlock_bh(listen_lock);
 
-   return 1;
+   return 0;
 }
 
 EXPORT_SYMBOL(ax25_listen_register);
@@ -225,7 +225,8 @@ int ax25_listen_mine(ax25_address *calls
 
spin_lock_bh(listen_lock);
for (listen = listen_list; listen != NULL; listen = listen-next)
-   if (ax25cmp(listen-callsign, callsign) == 0  (listen-dev 
== dev || listen-dev == NULL)) {
+   if (ax25cmp(listen-callsign, callsign) == 0 
+   (listen-dev == dev || listen-dev == NULL)) {
spin_unlock_bh(listen_lock);
return 1;
}
Index: linux-net/net/netrom/nr_dev.c
===
--- linux-net.orig/net/netrom/nr_dev.c
+++ linux-net/net/netrom/nr_dev.c
@@ -128,25 +128,37 @@ static int nr_header(struct sk_buff *skb
return -37;
 }
 
-static int nr_set_mac_address(struct net_device *dev, void *addr)
+static int __must_check nr_set_mac_address(struct net_device *dev, void *addr)
 {
struct sockaddr *sa = addr;
+   int err;
+
+   if (!memcmp(dev-dev_addr, sa-sa_data, dev-addr_len))
+   return 0;
+
+   if (dev-flags  IFF_UP) {
+   err = ax25_listen_register((ax25_address *)sa-sa_data, NULL);
+   if (err)
+   return err;
 
-   if (dev-flags  IFF_UP)
ax25_listen_release((ax25_address *)dev-dev_addr, NULL);
+   }
 
memcpy(dev-dev_addr, sa-sa_data, dev-addr_len);
 
-   if (dev-flags  IFF_UP)
-   ax25_listen_register((ax25_address *)dev-dev_addr, NULL);
-
return 0;
 }
 
 static int nr_open(struct net_device *dev)
 {
+   int err;
+
+   err = ax25_listen_register((ax25_address *)dev-dev_addr, NULL);
+   if (err)
+   return err;
+
netif_start_queue(dev);
-   ax25_listen_register((ax25_address *)dev-dev_addr, NULL);
+
return 0;
 }
 
Index: linux-net/net/rose/af_rose.c
===
--- linux-net.orig/net/rose/af_rose.c
+++ linux-net/net/rose/af_rose.c
@@ -1314,7 +1314,8 @@ static int rose_ioctl(struct socket *soc
if (copy_from_user(rose_callsign, argp, sizeof(ax25_address)))
return -EFAULT;
if (ax25cmp(rose_callsign, null_ax25_address) != 0)
-   ax25_listen_register(rose_callsign, NULL);
+   return ax25_listen_register(rose_callsign, NULL);
+
return 0;
 
case SIOCRSGL2CALL:
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Something about timers

2005-09-09 Thread Ralf Baechle DL5RB
On Fri, Sep 09, 2005 at 08:34:51AM +0300, jarmo wrote:

 Just noticed, that if you compile kernel without looking,
 Prosessor type and features - Timer frequency, default is
 250ms, you get quite suprising behaviour with your ax25 stuff,
 especially 6pack :)
 I'd say quite quick actions and in server case crashes :(. That
 mean you have both fbb and cluster running in same computer
 with 5 user ports.
 
 So when taking forinstance kernel 2.6.13 in use, select timer as 1000ms,
 then your normal ax25 timers should work.

Time in AX.25, NET/ROM and ROSE is still being meassured in units of
timer ticks which has not only changed going from 2.4 to 2.6; it's
also differing between architectures.  I've recently sent out a set of
three patches to standardize that on ms.  That's probably a too small unit
so I think I'm going to change that again before submitting to upstream.

Any crashes you may see are certainly unrelated to this.

73 de DL5RB op Ralf

--
Loc. JN47BS / CQ 14 / ITU 28 / DOK A21
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[AX.25] Make asc2ax thread-proof

2005-09-07 Thread Ralf Baechle DL5RB
Asc2ax was still using a static buffer for all invocations which isn't
exactly SMP-safe.  Change asc2ax to take an additional result buffer as
the argument.  Change all callers to provide such a buffer.

This one only really is a fix for ROSE and as per recent discussions
there's still much more to fix in ROSE ...

Signed-off-by: Ralf Baechle DL5RB [EMAIL PROTECTED]

 include/net/ax25.h   |2 +-
 net/ax25/ax25_addr.c |   27 ---
 net/rose/rose_subr.c |4 ++--
 3 files changed, 15 insertions(+), 18 deletions(-)

Index: linux-cvs/include/net/ax25.h
===
--- linux-cvs.orig/include/net/ax25.h
+++ linux-cvs/include/net/ax25.h
@@ -279,7 +279,7 @@ extern struct sock *ax25_make_new(struct
 /* ax25_addr.c */
 extern ax25_address null_ax25_address;
 extern char *ax2asc(char *buf, ax25_address *);
-extern ax25_address *asc2ax(char *);
+extern void asc2ax(ax25_address *addr, char *callsign);
 extern int  ax25cmp(ax25_address *, ax25_address *);
 extern int  ax25digicmp(ax25_digi *, ax25_digi *);
 extern unsigned char *ax25_addr_parse(unsigned char *, int, ax25_address *, 
ax25_address *, ax25_digi *, int *, int *);
Index: linux-cvs/net/ax25/ax25_addr.c
===
--- linux-cvs.orig/net/ax25/ax25_addr.c
+++ linux-cvs/net/ax25/ax25_addr.c
@@ -67,37 +67,34 @@ char *ax2asc(char *buf, ax25_address *a)
 /*
  * ascii - ax25 conversion
  */
-ax25_address *asc2ax(char *callsign)
+void asc2ax(ax25_address *addr, char *callsign)
 {
-   static ax25_address addr;
char *s;
int n;
 
for (s = callsign, n = 0; n  6; n++) {
if (*s != '\0'  *s != '-')
-   addr.ax25_call[n] = *s++;
+   addr-ax25_call[n] = *s++;
else
-   addr.ax25_call[n] = ' ';
-   addr.ax25_call[n] = 1;
-   addr.ax25_call[n] = 0xFE;
+   addr-ax25_call[n] = ' ';
+   addr-ax25_call[n] = 1;
+   addr-ax25_call[n] = 0xFE;
}
 
if (*s++ == '\0') {
-   addr.ax25_call[6] = 0x00;
-   return addr;
+   addr-ax25_call[6] = 0x00;
+   return;
}
 
-   addr.ax25_call[6] = *s++ - '0';
+   addr-ax25_call[6] = *s++ - '0';
 
if (*s != '\0') {
-   addr.ax25_call[6] *= 10;
-   addr.ax25_call[6] += *s++ - '0';
+   addr-ax25_call[6] *= 10;
+   addr-ax25_call[6] += *s++ - '0';
}
 
-   addr.ax25_call[6] = 1;
-   addr.ax25_call[6] = 0x1E;
-
-   return addr;
+   addr-ax25_call[6] = 1;
+   addr-ax25_call[6] = 0x1E;
 }
 
 /*
Index: linux-cvs/net/rose/rose_subr.c
===
--- linux-cvs.orig/net/rose/rose_subr.c
+++ linux-cvs/net/rose/rose_subr.c
@@ -337,13 +337,13 @@ static int rose_parse_ccitt(unsigned cha
memcpy(facilities-source_addr, p + 7, 
ROSE_ADDR_LEN);
memcpy(callsign, p + 12,   l - 10);
callsign[l - 10] = '\0';
-   facilities-source_call = *asc2ax(callsign);
+   asc2ax(facilities-source_call, callsign);
}
if (*p == FAC_CCITT_SRC_NSAP) {
memcpy(facilities-dest_addr, p + 7, 
ROSE_ADDR_LEN);
memcpy(callsign, p + 12, l - 10);
callsign[l - 10] = '\0';
-   facilities-dest_call = *asc2ax(callsign);
+   asc2ax(facilities-dest_call, callsign);
}
p   += l + 2;
n   += l + 2;
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[AX.25] Make ax2asc thread-proof

2005-09-06 Thread Ralf Baechle
Ax2asc was still using a static buffer for all invocations which isn't
exactly SMP-safe.  Change ax2asc to take an additional result buffer as
the argument.  Change all callers to provide such a buffer.

Signed-off-by: Ralf Baechle DL5RB [EMAIL PROTECTED]

 include/net/ax25.h |2 +-
 net/ax25/af_ax25.c |7 ---
 net/ax25/ax25_addr.c   |3 +--
 net/ax25/ax25_route.c  |7 +--
 net/ax25/ax25_uid.c|4 +++-
 net/netrom/af_netrom.c |7 ---
 net/netrom/nr_route.c  |8 +---
 net/rose/af_rose.c |6 --
 net/rose/rose_route.c  |   14 +-
 net/rose/rose_subr.c   |5 +++--
 10 files changed, 39 insertions(+), 24 deletions(-)

Index: linux-cvs/include/net/ax25.h
===
--- linux-cvs.orig/include/net/ax25.h
+++ linux-cvs/include/net/ax25.h
@@ -278,7 +278,7 @@ extern struct sock *ax25_make_new(struct
 
 /* ax25_addr.c */
 extern ax25_address null_ax25_address;
-extern char *ax2asc(ax25_address *);
+extern char *ax2asc(char *buf, ax25_address *);
 extern ax25_address *asc2ax(char *);
 extern int  ax25cmp(ax25_address *, ax25_address *);
 extern int  ax25digicmp(ax25_digi *, ax25_digi *);
Index: linux-cvs/net/ax25/af_ax25.c
===
--- linux-cvs.orig/net/ax25/af_ax25.c
+++ linux-cvs/net/ax25/af_ax25.c
@@ -1863,6 +1863,7 @@ static void ax25_info_stop(struct seq_fi
 static int ax25_info_show(struct seq_file *seq, void *v)
 {
ax25_cb *ax25 = v;
+   char buf[11];
int k;
 
 
@@ -1874,13 +1875,13 @@ static int ax25_info_show(struct seq_fil
seq_printf(seq, %8.8lx %s %s%s ,
   (long) ax25,
   ax25-ax25_dev == NULL? ??? : ax25-ax25_dev-dev-name,
-  ax2asc(ax25-source_addr),
+  ax2asc(buf, ax25-source_addr),
   ax25-iamdigi? *:);
-   seq_printf(seq, %s, ax2asc(ax25-dest_addr));
+   seq_printf(seq, %s, ax2asc(buf, ax25-dest_addr));
 
for (k=0; (ax25-digipeat != NULL)  (k  ax25-digipeat-ndigi); k++) 
{
seq_printf(seq, ,%s%s,
-  ax2asc(ax25-digipeat-calls[k]),
+  ax2asc(buf, ax25-digipeat-calls[k]),
   ax25-digipeat-repeated[k]? *:);
}
 
Index: linux-cvs/net/ax25/ax25_addr.c
===
--- linux-cvs.orig/net/ax25/ax25_addr.c
+++ linux-cvs/net/ax25/ax25_addr.c
@@ -36,9 +36,8 @@ ax25_address null_ax25_address = {{0x40,
 /*
  * ax25 - ascii conversion
  */
-char *ax2asc(ax25_address *a)
+char *ax2asc(char *buf, ax25_address *a)
 {
-   static char buf[11];
char c, *s;
int n;
 
Index: linux-cvs/net/ax25/ax25_route.c
===
--- linux-cvs.orig/net/ax25/ax25_route.c
+++ linux-cvs/net/ax25/ax25_route.c
@@ -284,6 +284,8 @@ static void ax25_rt_seq_stop(struct seq_
 
 static int ax25_rt_seq_show(struct seq_file *seq, void *v)
 {
+   char buf[11];
+
if (v == SEQ_START_TOKEN)
seq_puts(seq, callsign  dev  mode digipeaters\n);
else {
@@ -294,7 +296,7 @@ static int ax25_rt_seq_show(struct seq_f
if (ax25cmp(ax25_rt-callsign, null_ax25_address) == 0)
callsign = default;
else
-   callsign = ax2asc(ax25_rt-callsign);
+   callsign = ax2asc(buf, ax25_rt-callsign);
 
seq_printf(seq, %-9s %-4s,
callsign,
@@ -314,7 +316,8 @@ static int ax25_rt_seq_show(struct seq_f
 
if (ax25_rt-digipeat != NULL)
for (i = 0; i  ax25_rt-digipeat-ndigi; i++)
-   seq_printf(seq,  %s, 
ax2asc(ax25_rt-digipeat-calls[i]));
+   seq_printf(seq,  %s,
+ax2asc(buf, ax25_rt-digipeat-calls[i]));
 
seq_puts(seq, \n);
}
Index: linux-cvs/net/ax25/ax25_uid.c
===
--- linux-cvs.orig/net/ax25/ax25_uid.c
+++ linux-cvs/net/ax25/ax25_uid.c
@@ -168,12 +168,14 @@ static void ax25_uid_seq_stop(struct seq
 
 static int ax25_uid_seq_show(struct seq_file *seq, void *v)
 {
+   char buf[11];
+
if (v == SEQ_START_TOKEN)
seq_printf(seq, Policy: %d\n, ax25_uid_policy);
else {
struct ax25_uid_assoc *pt = v;
 
-   seq_printf(seq, %6d %s\n, pt-uid, ax2asc(pt-call));
+   seq_printf(seq, %6d %s\n, pt-uid, ax2asc(buf, pt-call));
}
return 0;
 }
Index: linux-cvs/net/netrom/af_netrom.c
===
--- linux-cvs.orig/net/netrom/af_netrom.c
+++ linux-cvs/net/netrom/af_netrom.c
@@ -1265,6 +1265,7 @@ static int nr_info_show(struct seq_file

Re: ax25-howto

2005-09-06 Thread Ralf Baechle DL5RB
On Sun, Sep 04, 2005 at 08:15:22AM -0400, Harold Hartley wrote:

 I must agree as I have found it talks in some places about files that 
 are not relevent to most distro's now and in fact are very out of date.
 Now with the newer files such as the ax25-config, ax25-tools and 
 ax25-apps, most of the how-to don't apply to the newer files and mainly 
 applies the the old ax25-utils and such...
 
 I'm wondering if someone will evenually update the How-to in places that 
 does need some update to, but not all the How-to needs updating.

THe AX.25 and Ham Howtos are all horribly outdated - probably beyond
recovery.  I'm working on converting them into a wiki so everybody
can start contributing.

73 de DL5RB op Ralf

--
Loc. JN47BS / CQ 14 / ITU 28 / DOK A21
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] SMP fix for 6pack driver

2005-09-01 Thread Ralf Baechle DL5RB
On Sun, Aug 28, 2005 at 10:46:09PM +0200, Iñaki Arenaza wrote:

  You could try EB6EBU's m6pack which is an application level solution
  to the problem.
 
 Just a little correction. It's EB2EBU, not EB6EBU (otherwise Google
 will not find my patch against ax25-tools-0.0.8 ;-)

Sorry :-)

 You can get it at:
 
 
 http://www.escomposlinux.org/iarenaza/hamradio/m6pack/files/ax25-tools-0.0.8-m6pack.diff.bz2

I'm still contemplating if this should preferably be done in userspace or
in kernelspace ...

  Ralf
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Ethereal ax25 monitoring

2005-09-01 Thread Ralf Baechle DL5RB
On Wed, Aug 31, 2005 at 10:46:34PM +0100, Richard Stearn wrote:

 An update on AX.25 in Ethereal.
 
 I have enquired on the Ethereal list and the attitude (sample of 1) is
 that if the protocol exists and is used then it will be accepted.
 Subject to a few pratical provisos.
 
 The deeper issue I have found is that Ethereal uses libpcap for the
 actual packet capture, and libpcap does not support AX.25 as a packet
 type.
 
 There appears to a replacement for libpcap in development within Ethereal
 however that is probably a long term project. So my next move is to see
 what the issues are with getting the AX.25 packet type added to libpcap.
 
 It looks to me that AX.25 on Ethereal is going to be a long time coming.

Libpcap is also being used for example by tcpdump, so it's certainly very
useful to have it ported anyway.

73 de DL5RB op Ralf

--
Loc. JN47BS / CQ 14 / ITU 28 / DOK A21
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] SMP fix for 6pack driver

2005-09-01 Thread Ralf Baechle DL5RB
On Thu, Sep 01, 2005 at 07:47:46AM -0500, Chuck Hast wrote:

   
   http://www.escomposlinux.org/iarenaza/hamradio/m6pack/files/ax25-tools-0.0.8-m6pack.diff.bz2
  
  I'm still contemplating if this should preferably be done in userspace or
  in kernelspace ...
  
 
 Is there anymore on making 6pack operate in multi-tnc mode as is done with the
 dos drivers? We certainly can use that, I wish I could work on it, but
 I fear I do not
 know enough to do anything there. 

See above URL.

  Ralf
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Netdevice reference leak in af_ax25.c ??

2005-09-01 Thread Ralf Baechle
On Thu, Sep 01, 2005 at 08:56:19PM +0200, Patrick McHardy wrote:

  I believe the SO_BINDTODEVICE case in net/ax25/af_x25.c  (line 613 or so)
  leaks a reference to a net device.  It does a dev_get_by_name,
  which holds a reference, but since it never assigns the pointer
  anywhere, I do not see how it can ever free it later.
  
  Please clue me in as to where it's released if it actually is.
 
 I can't find the code you're talking about, there's no dev_get* in my
 version of af_x25.c. Please paste the code you're talking about in
 your bugreports, thanks.

Ben meant net/ax25/af_ax25.  The dev value is stored in the ax25_cb
indirectly after converting it to an ax25dev pointer and will be freed
what that ax25_cb (which really is the protocol-specific part of the
socket) is going to be closed.

You poked my nose at a bug though - it is possible to leak references by
performing multiple SO_BINDTODEVICE operations; we should either only
permit the first one to succeed or to drop the reference of the old
device in case of a repeated SO_BINDTODEVICE.  After the weekend ...

  Ralf
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Another mkiss patch (was: Re: AX-25 software that works on Fedora Core 4?)

2005-08-24 Thread Ralf Baechle
On Tue, Aug 23, 2005 at 09:17:02PM +0200, Jacques Chion wrote:

   If i do the command ifconfig, i have the interface sm0 with the HWaddr 
   LINUX-1 instead of my callsign F6CWO.
   this can be corrected with the command ifconfig sm0 hw ax25 F6CWO up
   and all is working fine. I don't see from where is coming this LINUX-1.
  
  LINUX-1 is the driver's builtin default MAC address.
  
 
 I will search what is wrong on my box. Sure it's something stupid :)

I did setup soundmodem myself last night and was able to reproduce the
fault.  The problem is being caused by soundmodem passng slightly different
arguments to the failing ioctl than kissattach and the drivers strict
sanity checks did reject that.  I changed that and it's working now.

Latest version attached below.  This I hope is going to be the final
version of this patch.

73 de DL5RB op Ralf

--
Loc. JN47BS / CQ 14 / ITU 28 / DOK A21

Signed-off-by: Ralf Baechle DL5RB [EMAIL PROTECTED]


 drivers/net/hamradio/Kconfig |2 
 drivers/net/hamradio/mkiss.c | 1087 ---
 2 files changed, 525 insertions(+), 564 deletions(-)

Index: linux-cvs/drivers/net/hamradio/mkiss.c
===
--- linux-cvs.orig/drivers/net/hamradio/mkiss.c
+++ linux-cvs/drivers/net/hamradio/mkiss.c
@@ -1,30 +1,19 @@
 /*
- * MKISS Driver
+ *  This program is free software; you can distribute it and/or modify it
+ *  under the terms of the GNU General Public License (Version 2) as
+ *  published by the Free Software Foundation.
  *
- * This module:
- * This module 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 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.
  *
- * This module implements the AX.25 protocol for kernel-based
- * devices like TTYs. It interfaces between a raw TTY, and the
- * kernel's AX.25 protocol layers, just like slip.c.
- * AX.25 needs to be separated from slip.c while slip.c is no
- * longer a static kernel device since it is a module.
- * This method clears the way to implement other kiss protocols
- * like mkiss smack g8bpq . so far only mkiss is implemented.
+ *  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.
  *
- * Hans Alblas [EMAIL PROTECTED]
- *
- * History
- * Jonathan (G4KLX)Fixed to match Linux networking changes - 
2.1.15.
- * Matthias (DG2FEF)   Added support for FlexNet CRC (on special 
request)
- *  Fixed bug in ax25_close(): dev_lock_wait() was
- *  called twice, causing a deadlock.
- * Jeroen (PE1RXQ) Removed old MKISS_MAGIC stuff and calls to
- * MOD_*_USE_COUNT
- * Remove cli() and fix rtnl lock usage.
+ * Copyright (C) Hans Alblas PE1AYX [EMAIL PROTECTED]
+ * Copyright (C) 2004, 05 Ralf Baechle DL5RB [EMAIL PROTECTED]
  */
 
 #include linux/config.h
@@ -49,174 +38,296 @@
 
 #include net/ax25.h
 
-#include mkiss.h
-
 #ifdef CONFIG_INET
 #include linux/ip.h
 #include linux/tcp.h
 #endif
 
-static char banner[] __initdata = KERN_INFO mkiss: AX.25 Multikiss, Hans 
Albas PE1AYX\n;
-
-typedef struct ax25_ctrl {
-   struct ax_disp ctrl;/*  */
-   struct net_device  dev; /* the device   */
-} ax25_ctrl_t;
-
-static ax25_ctrl_t **ax25_ctrls;
+#define AX_MTU 236
 
-int ax25_maxdev = AX25_MAXDEV; /* Can be overridden with insmod! */
+/* SLIP/KISS protocol characters. */
+#define END 0300   /* indicates end of frame   */
+#define ESC 0333   /* indicates byte stuffing  */
+#define ESC_END 0334   /* ESC ESC_END means END 'data' */
+#define ESC_ESC 0335   /* ESC ESC_ESC means ESC 'data' */
+
+struct mkiss {
+   struct tty_struct   *tty;   /* ptr to TTY structure */
+   struct net_device   *dev;   /* easy for intr handling   */
+
+   /* These are pointers to the malloc()ed frame buffers. */
+   spinlock_t  buflock;/* lock for rbuf and xbuf */
+   unsigned char   *rbuff; /* receiver buffer  */
+   int rcount; /* received chars counter   */
+   unsigned char   *xbuff

Re: AX-25 software that works on Fedora Core 4?

2005-08-22 Thread Ralf Baechle DL5RB
On Sun, Aug 21, 2005 at 12:05:57PM +0200, Jacques Chion wrote:

 -the patch you have sent by mail refuse to apply after line 885, but i 
 finished by hand, and no problem to compile.
 -soundmodem, that i use, is complaining about SIOCSIFHADDR, but it seems to 
 work properly.
 
 So, thank you and again, great job !

So here's the next version to test, it should fix the SIOCSIFHADDR issue.
Again the patch is against 2.6.13-rc6.

73 de DL5RB op Ralf

--
Loc. JN47BS / CQ 14 / ITU 28 / DOK A21

Signed-off-by: Ralf Baechle DL5RB [EMAIL PROTECTED]


 drivers/net/hamradio/Kconfig |2 
 drivers/net/hamradio/mkiss.c | 1092 ---
 2 files changed, 530 insertions(+), 564 deletions(-)

Index: linux-cvs/drivers/net/hamradio/mkiss.c
===
--- linux-cvs.orig/drivers/net/hamradio/mkiss.c
+++ linux-cvs/drivers/net/hamradio/mkiss.c
@@ -1,30 +1,19 @@
 /*
- * MKISS Driver
+ *  This program is free software; you can distribute it and/or modify it
+ *  under the terms of the GNU General Public License (Version 2) as
+ *  published by the Free Software Foundation.
  *
- * This module:
- * This module 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 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.
  *
- * This module implements the AX.25 protocol for kernel-based
- * devices like TTYs. It interfaces between a raw TTY, and the
- * kernel's AX.25 protocol layers, just like slip.c.
- * AX.25 needs to be separated from slip.c while slip.c is no
- * longer a static kernel device since it is a module.
- * This method clears the way to implement other kiss protocols
- * like mkiss smack g8bpq . so far only mkiss is implemented.
+ *  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.
  *
- * Hans Alblas [EMAIL PROTECTED]
- *
- * History
- * Jonathan (G4KLX)Fixed to match Linux networking changes - 
2.1.15.
- * Matthias (DG2FEF)   Added support for FlexNet CRC (on special 
request)
- *  Fixed bug in ax25_close(): dev_lock_wait() was
- *  called twice, causing a deadlock.
- * Jeroen (PE1RXQ) Removed old MKISS_MAGIC stuff and calls to
- * MOD_*_USE_COUNT
- * Remove cli() and fix rtnl lock usage.
+ * Copyright (C) Hans Alblas PE1AYX [EMAIL PROTECTED]
+ * Copyright (C) 2004, 05 Ralf Baechle DL5RB [EMAIL PROTECTED]
  */
 
 #include linux/config.h
@@ -49,174 +38,302 @@
 
 #include net/ax25.h
 
-#include mkiss.h
-
 #ifdef CONFIG_INET
 #include linux/ip.h
 #include linux/tcp.h
 #endif
 
-static char banner[] __initdata = KERN_INFO mkiss: AX.25 Multikiss, Hans 
Albas PE1AYX\n;
-
-typedef struct ax25_ctrl {
-   struct ax_disp ctrl;/*  */
-   struct net_device  dev; /* the device   */
-} ax25_ctrl_t;
-
-static ax25_ctrl_t **ax25_ctrls;
+#define AX_MTU 236
 
-int ax25_maxdev = AX25_MAXDEV; /* Can be overridden with insmod! */
+/* SLIP/KISS protocol characters. */
+#define END 0300   /* indicates end of frame   */
+#define ESC 0333   /* indicates byte stuffing  */
+#define ESC_END 0334   /* ESC ESC_END means END 'data' */
+#define ESC_ESC 0335   /* ESC ESC_ESC means ESC 'data' */
+
+struct mkiss {
+   struct tty_struct   *tty;   /* ptr to TTY structure */
+   struct net_device   *dev;   /* easy for intr handling   */
+
+   /* These are pointers to the malloc()ed frame buffers. */
+   spinlock_t  buflock;/* lock for rbuf and xbuf */
+   unsigned char   *rbuff; /* receiver buffer  */
+   int rcount; /* received chars counter   */
+   unsigned char   *xbuff; /* transmitter buffer   */
+   unsigned char   *xhead; /* pointer to next byte to XMIT */
+   int xleft;  /* bytes left in XMIT queue */
+
+   struct net_device_stats stats;
+
+   /* Detailed SLIP statistics. */
+   int mtu;/* Our mtu (to spot changes!)   */
+   int buffsize;   /* Max buffers sizes

Re: AX-25 software that works on Fedora Core 4?

2005-08-22 Thread Ralf Baechle DL5RB
On Sat, Aug 20, 2005 at 08:30:37PM -, [EMAIL PROTECTED] wrote:

 What version is it actually intended for? The above are the latest Suse
 9.2 and 9.3 respactively. I hope the above tells you something.

2.6.13-rc6.  Always the latest.

73 de DL5RB op Ralf

--
Loc. JN47BS / CQ 14 / ITU 28 / DOK A21
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Fix socket bitop damage

2005-08-22 Thread Ralf Baechle
The socket flag cleanups that went into 2.6.12-rc1 are basically oring
the flags of an old socket into the socket just being created.
Unfortunately that one was just initialized by sock_init_data(), so already
has SOCK_ZAPPED set.  As the result zapped sockets are created and all
incoming connection will fail due to this bug which again was carefully
replicated to at least AX.25, NET/ROM or ROSE.

In order to keep the abstraction alive I've introduced sock_copy_flags()
to copy the socket flags from one sockets to another and used that
instead of the bitwise copy thing.  Anyway, the idea here has probably
been to copy all flags, so sock_copy_flags() should be the right thing.
With this the ham radio protocols are usable again, so I hope this will
make it into 2.6.13.

Signed-off-by: Ralf Baechle DL5RB [EMAIL PROTECTED]

 include/net/sock.h |5 +
 net/ax25/af_ax25.c |7 +--
 net/netrom/af_netrom.c |7 +--
 net/rose/af_rose.c |7 +--
 4 files changed, 8 insertions(+), 18 deletions(-)

Index: linux-cvs/net/netrom/af_netrom.c
===
--- linux-cvs.orig/net/netrom/af_netrom.c
+++ linux-cvs/net/netrom/af_netrom.c
@@ -465,12 +465,7 @@ static struct sock *nr_make_new(struct s
sk-sk_sndbuf   = osk-sk_sndbuf;
sk-sk_state= TCP_ESTABLISHED;
sk-sk_sleep= osk-sk_sleep;
-
-   if (sock_flag(osk, SOCK_ZAPPED))
-   sock_set_flag(sk, SOCK_ZAPPED);
-
-   if (sock_flag(osk, SOCK_DBG))
-   sock_set_flag(sk, SOCK_DBG);
+   sock_copy_flags(sk, osk);
 
skb_queue_head_init(nr-ack_queue);
skb_queue_head_init(nr-reseq_queue);
Index: linux-cvs/include/net/sock.h
===
--- linux-cvs.orig/include/net/sock.h
+++ linux-cvs/include/net/sock.h
@@ -384,6 +384,11 @@ enum sock_flags {
SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
 };
 
+static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
+{
+   nsk-sk_flags = osk-sk_flags;
+}
+
 static inline void sock_set_flag(struct sock *sk, enum sock_flags flag)
 {
__set_bit(flag, sk-sk_flags);
Index: linux-cvs/net/ax25/af_ax25.c
===
--- linux-cvs.orig/net/ax25/af_ax25.c
+++ linux-cvs/net/ax25/af_ax25.c
@@ -884,12 +884,7 @@ struct sock *ax25_make_new(struct sock *
sk-sk_sndbuf   = osk-sk_sndbuf;
sk-sk_state= TCP_ESTABLISHED;
sk-sk_sleep= osk-sk_sleep;
-
-   if (sock_flag(osk, SOCK_DBG))
-   sock_set_flag(sk, SOCK_DBG);
-
-   if (sock_flag(osk, SOCK_ZAPPED))
-   sock_set_flag(sk, SOCK_ZAPPED);
+   sock_copy_flags(sk, osk);
 
oax25 = ax25_sk(osk);
 
Index: linux-cvs/net/rose/af_rose.c
===
--- linux-cvs.orig/net/rose/af_rose.c
+++ linux-cvs/net/rose/af_rose.c
@@ -556,12 +556,7 @@ static struct sock *rose_make_new(struct
sk-sk_sndbuf   = osk-sk_sndbuf;
sk-sk_state= TCP_ESTABLISHED;
sk-sk_sleep= osk-sk_sleep;
-
-   if (sock_flag(osk, SOCK_ZAPPED))
-   sock_set_flag(sk, SOCK_ZAPPED);
-
-   if (sock_flag(osk, SOCK_DBG))
-   sock_set_flag(sk, SOCK_DBG);
+   sock_copy_flags(sk, osk);
 
init_timer(rose-timer);
init_timer(rose-idletimer);
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] AX.25 UID fixes

2005-08-22 Thread Ralf Baechle
 o Brown paperbag bug - ax25_findbyuid() was always returning a NULL pointer
   as the result.  Breaks ROSE completly and AX.25 if UID policy set to deny.

 o While the list structure of AX.25's UID to callsign mapping table was
   properly protected by a spinlock, it's elements were not refcounted
   resulting in a race between removal and usage of an element.

Signed-off-by: Ralf Baechle DL5RB [EMAIL PROTECTED]

 include/net/ax25.h |   18 +-
 net/ax25/af_ax25.c |   20 +++
 net/ax25/ax25_route.c  |   12 ---
 net/ax25/ax25_uid.c|   83 +
 net/netrom/af_netrom.c |   24 +-
 net/rose/af_rose.c |   20 +++
 6 files changed, 100 insertions(+), 77 deletions(-)

Index: linux-cvs/include/net/ax25.h
===
--- linux-cvs.orig/include/net/ax25.h
+++ linux-cvs/include/net/ax25.h
@@ -148,11 +148,25 @@ enum {
 #define AX25_DEF_DS_TIMEOUT18  /* DAMA timeout 3 
minutes */
 
 typedef struct ax25_uid_assoc {
-   struct ax25_uid_assoc   *next;
+   struct hlist_node   uid_node;
+   atomic_trefcount;
uid_t   uid;
ax25_addresscall;
 } ax25_uid_assoc;
 
+#define ax25_uid_for_each(__ax25, node, list) \
+   hlist_for_each_entry(__ax25, node, list, uid_node)
+
+#define ax25_uid_hold(ax25) \
+   atomic_inc(((ax25)-refcount))
+
+static inline void ax25_uid_put(ax25_uid_assoc *assoc)
+{
+   if (atomic_dec_and_test(assoc-refcount)) {
+   kfree(assoc);
+   }
+}
+
 typedef struct {
ax25_addresscalls[AX25_MAX_DIGIS];
unsigned char   repeated[AX25_MAX_DIGIS];
@@ -386,7 +400,7 @@ extern unsigned long ax25_display_timer(
 
 /* ax25_uid.c */
 extern int  ax25_uid_policy;
-extern ax25_address *ax25_findbyuid(uid_t);
+extern ax25_uid_assoc *ax25_findbyuid(uid_t);
 extern int  ax25_uid_ioctl(int, struct sockaddr_ax25 *);
 extern struct file_operations ax25_uid_fops;
 extern void ax25_uid_free(void);
Index: linux-cvs/net/ax25/ax25_route.c
===
--- linux-cvs.orig/net/ax25/ax25_route.c
+++ linux-cvs/net/ax25/ax25_route.c
@@ -422,8 +422,8 @@ static inline void ax25_adjust_path(ax25
  */
 int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr)
 {
+   ax25_uid_assoc *user;
ax25_route *ax25_rt;
-   ax25_address *call;
int err;
 
if ((ax25_rt = ax25_get_route(addr, NULL)) == NULL)
@@ -434,16 +434,18 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25
goto put;
}
 
-   if ((call = ax25_findbyuid(current-euid)) == NULL) {
+   user = ax25_findbyuid(current-euid);
+   if (user) {
+   ax25-source_addr = user-call;
+   ax25_uid_put(user);
+   } else {
if (ax25_uid_policy  !capable(CAP_NET_BIND_SERVICE)) {
err = -EPERM;
goto put;
}
-   call = (ax25_address *)ax25-ax25_dev-dev-dev_addr;
+   ax25-source_addr = *(ax25_address 
*)ax25-ax25_dev-dev-dev_addr;
}
 
-   ax25-source_addr = *call;
-
if (ax25_rt-digipeat != NULL) {
if ((ax25-digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) 
== NULL) {
err = -ENOMEM;
Index: linux-cvs/net/ax25/ax25_uid.c
===
--- linux-cvs.orig/net/ax25/ax25_uid.c
+++ linux-cvs/net/ax25/ax25_uid.c
@@ -28,6 +28,7 @@
 #include linux/fcntl.h
 #include linux/mm.h
 #include linux/interrupt.h
+#include linux/list.h
 #include linux/notifier.h
 #include linux/proc_fs.h
 #include linux/seq_file.h
@@ -41,38 +42,41 @@
  * Callsign/UID mapper. This is in kernel space for security on 
multi-amateur machines.
  */
 
-static ax25_uid_assoc *ax25_uid_list;
+HLIST_HEAD(ax25_uid_list);
 static DEFINE_RWLOCK(ax25_uid_lock);
 
 int ax25_uid_policy = 0;
 
-ax25_address *ax25_findbyuid(uid_t uid)
+ax25_uid_assoc *ax25_findbyuid(uid_t uid)
 {
-   ax25_uid_assoc *ax25_uid;
-   ax25_address *res = NULL;
+   ax25_uid_assoc *ax25_uid, *res = NULL;
+   struct hlist_node *node;
 
read_lock(ax25_uid_lock);
-   for (ax25_uid = ax25_uid_list; ax25_uid != NULL; ax25_uid = 
ax25_uid-next) {
+   ax25_uid_for_each(ax25_uid, node, ax25_uid_list) {
if (ax25_uid-uid == uid) {
-   res = ax25_uid-call;
+   ax25_uid_hold(ax25_uid);
+   res = ax25_uid;
break;
}
}
read_unlock(ax25_uid_lock);
 
-   return NULL;
+   return res;
 }
 
 int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax)
 {
-   ax25_uid_assoc *s, *ax25_uid;
+   ax25_uid_assoc *ax25_uid;
+   struct hlist_node *node;
+   ax25_uid_assoc

Re: AX-25 software that works on Fedora Core 4?

2005-08-20 Thread Ralf Baechle DL5RB
On Fri, Aug 19, 2005 at 02:55:42PM -0400, Scott Weis wrote:

 
 I have been working for weeks to try and get AX-25 working with the mkiss 
 module.  Best I can figure is that there is no working AX25 for SMP kernels 
 and core 4.  The ax25-utils package has not kept up with the updates made 
 in the kernel. This is all I can manage to get when I try to start an 
 interface..

All it takes is the minor tweak of recompiling - at least for the rpms
that I'm maintaining for my own use.

 + /sbin/modprobe mkiss
 + sleep 5
 + /usr/local/sbin/mkiss -s 9600 /dev/ttyS0 /dev/ptya1 /dev/ptya2
 + /usr/local/sbin/kissattach /dev/ttya1 ax0 172.16.198.1
 kissattach: SIOCSIFHWADDR: Invalid argument
 unregister_netdevice: device ax%d/ddc80400 never was registered
   

This sounds like you're using my previous broken mkiss patch?  I'm making
an attempt to rewrite mkiss but unfortunately without mkiss setup for
testing, so a very silly bug happened; find a version with that bug
fixed below.  All I can test it is to the point that kissattach succeeds,
however.

  Ralf

PS: Before anybody is scared, it did work that way for 6pack :-)

Signed-off-by: Ralf Baechle DL5RB [EMAIL PROTECTED]

 drivers/net/hamradio/mkiss.c | 1088 ---
 1 files changed, 525 insertions(+), 563 deletions(-)

Index: linux-cvs/drivers/net/hamradio/mkiss.c
===
--- linux-cvs.orig/drivers/net/hamradio/mkiss.c
+++ linux-cvs/drivers/net/hamradio/mkiss.c
@@ -1,30 +1,19 @@
 /*
- * MKISS Driver
+ *  This program is free software; you can distribute it and/or modify it
+ *  under the terms of the GNU General Public License (Version 2) as
+ *  published by the Free Software Foundation.
  *
- * This module:
- * This module 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 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.
  *
- * This module implements the AX.25 protocol for kernel-based
- * devices like TTYs. It interfaces between a raw TTY, and the
- * kernel's AX.25 protocol layers, just like slip.c.
- * AX.25 needs to be separated from slip.c while slip.c is no
- * longer a static kernel device since it is a module.
- * This method clears the way to implement other kiss protocols
- * like mkiss smack g8bpq . so far only mkiss is implemented.
+ *  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.
  *
- * Hans Alblas [EMAIL PROTECTED]
- *
- * History
- * Jonathan (G4KLX)Fixed to match Linux networking changes - 
2.1.15.
- * Matthias (DG2FEF)   Added support for FlexNet CRC (on special 
request)
- *  Fixed bug in ax25_close(): dev_lock_wait() was
- *  called twice, causing a deadlock.
- * Jeroen (PE1RXQ) Removed old MKISS_MAGIC stuff and calls to
- * MOD_*_USE_COUNT
- * Remove cli() and fix rtnl lock usage.
+ * Copyright (C) Hans Alblas PE1AYX [EMAIL PROTECTED]
+ * Copyright (C) 2004, 05 Ralf Baechle DL5RB [EMAIL PROTECTED]
  */
 
 #include linux/config.h
@@ -49,174 +38,302 @@
 
 #include net/ax25.h
 
-#include mkiss.h
-
 #ifdef CONFIG_INET
 #include linux/ip.h
 #include linux/tcp.h
 #endif
 
-static char banner[] __initdata = KERN_INFO mkiss: AX.25 Multikiss, Hans 
Albas PE1AYX\n;
-
-typedef struct ax25_ctrl {
-   struct ax_disp ctrl;/*  */
-   struct net_device  dev; /* the device   */
-} ax25_ctrl_t;
-
-static ax25_ctrl_t **ax25_ctrls;
+#define AX_MTU 236 
 
-int ax25_maxdev = AX25_MAXDEV; /* Can be overridden with insmod! */
+/* SLIP/KISS protocol characters. */
+#define END 0300   /* indicates end of frame   */
+#define ESC 0333   /* indicates byte stuffing  */
+#define ESC_END 0334   /* ESC ESC_END means END 'data' */
+#define ESC_ESC 0335   /* ESC ESC_ESC means ESC 'data' */
+
+struct mkiss {
+   struct tty_struct   *tty;   /* ptr to TTY structure */
+   struct net_device   *dev;   /* easy for intr handling   */
+
+   /* These are pointers to the malloc()ed frame buffers. */
+   spinlock_t  buflock

[PATCH 0/3] Eleminate HZ from AX.25 kernel interfaces

2005-08-18 Thread Ralf Baechle DL5RB
AX.25, NET/ROM and ROSE unfortunately still use jiffies as the unit of
time for all their timeouts that can be configured through sysctl and
it's procfs equivalents.  This did result in a change of these kernel
interfaces going from Linux 2.4 to 2.6 for anybody who was unlucky enough
to use an affected platform such as i386 and most MIPS but not Alpha.
Making matters worse, it required the sysadmin of the particular system
to know the timing value making it very, very broken inteface design.
The timer interrupt frequency recently becoming configurable made things
even worse, so this really needed to be fixed.  The following series
of patches contains three patches, one for each of the three packet radio
protocols to switch the unit used by the sysadmin to miliseconds thus
resulting in a deterministic interface.  I'd be happy about testers.
Patches are against 2.6.13-rc6.

73 de DL5RB op Ralf

--
Loc. JN47BS / CQ 14 / ITU 28 / DOK A21
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Ethereal ax25 monitoring

2005-08-15 Thread Ralf Baechle DL5RB
On Sun, Aug 14, 2005 at 10:54:41PM +0100, Richard Stearn wrote:

 Before I actually get down to design and coding I will make some enquiries
 on the Ethereal dev mailing list to see if anybody on that list is currently
 working on an AX.25 dissector and also to see if it would be accepted if 
 offered.
 
 So is there anybody on this list who has done/is doing/has abandoned an 
 AX.25
 dissector for Ethereal?

I looked at it and it was looking like it was going to sidetrack me more
than I wanted by that time.

 Is there anybody on the list who is up for testing?

Definately; this is going to be a highly valuable tool.

 My guess is that Netrom  Rose would also be on the followup list, any 
 others?.

Any protocols built on top of these, that would include, IP over AX.25,
ARP over AX.25, VJ compressed IP over AX.25, IP over NET/ROM, IP over ROSE,
routing protocols such as RSPF.

  Ralf
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: What happened to mkiss module

2005-07-25 Thread Ralf Baechle DL5RB
On Mon, Jul 25, 2005 at 04:05:46PM -0400, Scott Weis wrote:

 I grabbed the message directly off of the server with VI. I only had one 
 rej..

Okay.  That's more the expected behaviour due to the change in 2.6.12-rc4.

 I applied the last part of the patch by hand.. No problems..  I found 
 references to the SIOCSIFHWADDR: Invalid argument problem on the web and it 
 seems to be a problem with the ax25 module not being seen.  So I was 
 thinking that perhaps there is something missing from the /dev?
 
 Should  I have any udev config entries??

No.  That should result in a different error message.

73 de DL5RB op Ralf

--
Loc. JN47BS / CQ 14 / ITU 28 / DOK A21
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: What happened to mkiss module

2005-07-24 Thread Ralf Baechle DL5RB
On Sun, Jul 24, 2005 at 02:26:36AM -0400, Scott Weis wrote:

 I had to reload my server due to a hard drive failure.. So I upgraded my 
 SMP server to Fedora core 4. I went to add ax25 and mkiss and found that 
 mkiss was missing.   Where did it go??  Any idea how to get around this 
 problem?

The mkiss module is not SMP proof, so the kernel won't offer it when
configuring an SMP kernel.  Below is an untested rewrite of the driver
for 2.6.13-rc3 that should fix the SMP issues.  Please test it, lemme know.
Without successful testing this driver can't go into the kernel.

Btw, if your TNC supports 6pack you should try to switch to that instead.
It's clearly the superior protocol for TNC.

  Ralf

 Kconfig |2 
 mkiss.c | 1052 ++--
 2 files changed, 508 insertions(+), 546 deletions(-)

Index: linux-cvs/drivers/net/hamradio/mkiss.c
===
--- linux-cvs.orig/drivers/net/hamradio/mkiss.c 2005-07-15 10:04:51.0 
+0100
+++ linux-cvs/drivers/net/hamradio/mkiss.c  2005-07-15 10:04:57.0 
+0100
@@ -1,30 +1,19 @@
 /*
- * MKISS Driver
+ *  This program is free software; you can distribute it and/or modify it
+ *  under the terms of the GNU General Public License (Version 2) as
+ *  published by the Free Software Foundation.
  *
- * This module:
- * This module 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 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.
  *
- * This module implements the AX.25 protocol for kernel-based
- * devices like TTYs. It interfaces between a raw TTY, and the
- * kernel's AX.25 protocol layers, just like slip.c.
- * AX.25 needs to be separated from slip.c while slip.c is no
- * longer a static kernel device since it is a module.
- * This method clears the way to implement other kiss protocols
- * like mkiss smack g8bpq . so far only mkiss is implemented.
+ *  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.
  *
- * Hans Alblas [EMAIL PROTECTED]
- *
- * History
- * Jonathan (G4KLX)Fixed to match Linux networking changes - 
2.1.15.
- * Matthias (DG2FEF)   Added support for FlexNet CRC (on special 
request)
- *  Fixed bug in ax25_close(): dev_lock_wait() was
- *  called twice, causing a deadlock.
- * Jeroen (PE1RXQ) Removed old MKISS_MAGIC stuff and calls to
- * MOD_*_USE_COUNT
- * Remove cli() and fix rtnl lock usage.
+ * Copyright (C) Hans Alblas PE1AYX [EMAIL PROTECTED]
+ * Copyright (C) 2004, 05 Ralf Baechle DL5RB [EMAIL PROTECTED]
  */
 
 #include linux/config.h
@@ -50,174 +39,301 @@
 
 #include net/ax25.h
 
-#include mkiss.h
-
 #ifdef CONFIG_INET
 #include linux/ip.h
 #include linux/tcp.h
 #endif
 
-static char banner[] __initdata = KERN_INFO mkiss: AX.25 Multikiss, Hans 
Albas PE1AYX\n;
-
-typedef struct ax25_ctrl {
-   struct ax_disp ctrl;/*  */
-   struct net_device  dev; /* the device   */
-} ax25_ctrl_t;
-
-static ax25_ctrl_t **ax25_ctrls;
+#define AX_MTU 236 
 
-int ax25_maxdev = AX25_MAXDEV; /* Can be overridden with insmod! */
+/* SLIP/KISS protocol characters. */
+#define END 0300   /* indicates end of frame   */
+#define ESC 0333   /* indicates byte stuffing  */
+#define ESC_END 0334   /* ESC ESC_END means END 'data' */
+#define ESC_ESC 0335   /* ESC ESC_ESC means ESC 'data' */
+
+struct mkiss {
+   struct tty_struct   *tty;   /* ptr to TTY structure */
+   struct net_device   *dev;   /* easy for intr handling   */
+
+   /* These are pointers to the malloc()ed frame buffers. */
+   spinlock_t  buflock;/* lock for rbuf and xbuf */
+   unsigned char   *rbuff; /* receiver buffer  */
+   int rcount; /* received chars counter   */
+   unsigned char   *xbuff; /* transmitter buffer   */
+   unsigned char   *xhead; /* pointer to next byte to XMIT */
+   int xleft;  /* bytes left in XMIT queue

Re: [PATCH] SMP fix for 6pack driver

2005-07-07 Thread Ralf Baechle DL5RB
On Tue, Jul 05, 2005 at 05:39:44PM -0500, Bill Vodall wrote:

  It's a strategy that allows attaching the TNC to any UNIX machine,
  even without AX.25 support.  It's a hack but I was playing with it
  for a while when I ran out of interfaces.
 
 That could be VERY userful...   Any more details available?

6pack is implemented as a line discipline, so any tty, including a pseudo
tty can be turned into a 6pack interface.  So all it takes is a network
connection, let's say through ssh, an application on the remote side that
transfers data on the remote side between that connecton and the
/dev/tty... character device to which the TNC is connected.  Same thing
also on the local side, just between the pseudo-tty and the filedescriptor.
Pretty much a nobrainer to implement but latency could be a slight
problem.

(And if you don't truncate the cc list of email you even have a chance to
getting answers in time ...)

  Ralf
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] AX.25 patches for strace

2005-03-31 Thread Ralf Baechle DL5RB
So far strace is lacking support for AX.25 making debugging of AX.25
software harder for no good reason.  Below the first cut of a patch
to add AX.25 support.  The patch is against Sourceforge CVS.  Please test.

73 de DL5RB op Ralf

--
Loc. JN47BS / CQ 14 / ITU 28 / DOK A21

Index: configure.ac
===
RCS file: /cvsroot/strace/strace/configure.ac,v
retrieving revision 1.41
diff -u -r1.41 configure.ac
--- configure.ac22 Mar 2005 23:12:39 -  1.41
+++ configure.ac31 Mar 2005 12:56:25 -
@@ -193,8 +193,7 @@
 
 AC_CHECK_FUNCS(sigaction strerror strsignal pread sys_siglist _sys_siglist 
getdents mctl prctl sendmsg inet_ntop if_indextoname)
 AC_CHECK_HEADERS([sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h 
stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h 
ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h sys/uio.h 
sys/aio.h  poll.h sys/poll.h sys/vfs.h asm/sysmips.h linux/utsname.h 
sys/nscsys.h mqueue.h sys/epoll.h], [], [])
-AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
- [], [], [#include linux/socket.h])
+AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h 
netax25/ax25.h], [], [], [#include linux/socket.h])
 AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include signal.h])
 AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include netinet/in.h])
 
Index: defs.h
===
RCS file: /cvsroot/strace/strace/defs.h,v
retrieving revision 1.55
diff -u -r1.55 defs.h
--- defs.h  6 Feb 2005 01:16:32 -   1.55
+++ defs.h  31 Mar 2005 12:56:27 -
@@ -459,6 +459,7 @@
 extern void call_summary P((FILE *));
 extern void printtv32 P((struct tcb*, long));
 extern void tprint_iov P((struct tcb *, int, long));
+extern void tprint_ax25_address P((char *ax));
 
 #ifdef LINUX
 extern int internal_clone P((struct tcb *));
Index: net.c
===
RCS file: /cvsroot/strace/strace/net.c,v
retrieving revision 1.46
diff -u -r1.46 net.c
--- net.c   2 Feb 2005 03:11:32 -   1.46
+++ net.c   31 Mar 2005 12:56:29 -
@@ -98,6 +98,10 @@
 #include linux/icmp.h
 #endif
 
+#if defined(HAVE_NETAX25_AX25_H)
+#include netax25/ax25.h
+#endif
+
 #ifndef PF_UNSPEC
 #define PF_UNSPEC AF_UNSPEC
 #endif
@@ -436,6 +440,7 @@
 #endif
{ 0,NULL},
 };
+
 static const struct xlat msg_flags[] = {
{ MSG_OOB,  MSG_OOB   },
 #ifdef MSG_DONTROUTE
@@ -780,6 +785,24 @@
 };
 #endif /* SOL_IPX */
 
+#if defined(LINUX)  defined(AF_AX25)
+static const struct xlat sockax25options[] = {
+   { AX25_WINDOW,  AX25_WINDOW   },
+   { AX25_T1,  AX25_T1   },
+   { AX25_T2,  AX25_T2   },
+   { AX25_N2,  AX25_N2   },
+   { AX25_T3,  AX25_T3   },
+   { AX25_IDLE,AX25_IDLE },
+   { AX25_BACKOFF, AX25_BACKOFF  },
+   { AX25_EXTSEQ,  AX25_EXTSEQ   },
+   { AX25_PIDINCL, AX25_PIDINCL  },
+   { AX25_IAMDIGI, AX25_IAMDIGI  },
+   { AX25_PACLEN,  AX25_PACLEN   },
+   { SO_BINDTODEVICE,  SO_BINDTODEVICE   },
+   { 0,NULL}
+};
+#endif
+
 #ifdef SOL_RAW
 static const struct xlat sockrawoptions[] = {
 #if defined(ICMP_FILTER)
@@ -923,6 +946,22 @@
 };
 #endif /* defined(AF_PACKET) */
 
+#if defined(LINUX)  defined(AF_AX25)
+void tprint_ax25_address(char *ax)
+{
+   int len, i;
+
+   for (len = 5; len; len--)
+   if (ax[len] != (' '  1))
+   break;
+
+   for (i = 0; i = len; i++)
+   tprintf(%c, (ax[i]  1)  0x7f);
+
+   tprintf(-%d, ax[6]);
+}
+#endif
+
 
 void
 printsock(tcp, addr, addrlen)
@@ -934,6 +973,9 @@
char pad[128];
struct sockaddr sa;
struct sockaddr_in sin;
+#if defined(LINUX)  defined(AF_AX25)
+   struct full_sockaddr_ax25 sax25;
+#endif
struct sockaddr_un sau;
 #ifdef HAVE_INET_NTOP
struct sockaddr_in6 sa6;
@@ -984,6 +1026,28 @@
tprintf(sin_port=htons(%u), sin_addr=inet_addr(\%s\),
ntohs(addrbuf.sin.sin_port), 
inet_ntoa(addrbuf.sin.sin_addr));
break;
+#if defined(LINUX)  defined(AF_AX25)
+   case AF_AX25: {
+   int i;
+
+   tprintf(sax25_call=);
+   
tprint_ax25_address(addrbuf.sax25.fsa_ax25.sax25_call.ax25_call);
+   tprintf(, sax25_ndigis=%d, 
addrbuf.sax25.fsa_ax25.sax25_ndigis);
+
+   if (addrbuf.sax25.fsa_ax25.sax25_ndigis) {
+   tprintf( {);
+
+   

[PATCH] Get rid of sk_protinfo use in netrom

2005-03-21 Thread Ralf Baechle DL5RB
Below patch puts struct sock into nr_cb to get rid of the need for the
use of sk_protinfo in nr_sk().  While we're touching the data structure
convert it from a typedef into a struct.

Index: bk-afu/net/netrom/nr_timer.c
===
--- bk-afu.orig/net/netrom/nr_timer.c   2005-03-17 23:54:00.0 +
+++ bk-afu/net/netrom/nr_timer.c2005-03-20 10:40:08.0 +
@@ -38,7 +38,7 @@
 
 void nr_init_timers(struct sock *sk)
 {
-   nr_cb *nr = nr_sk(sk);
+   struct nr_sock *nr = nr_sk(sk);
 
init_timer(nr-t1timer);
nr-t1timer.data = (unsigned long)sk;
@@ -63,28 +63,28 @@
 
 void nr_start_t1timer(struct sock *sk)
 {
-   nr_cb *nr = nr_sk(sk);
+   struct nr_sock *nr = nr_sk(sk);
 
mod_timer(nr-t1timer, jiffies + nr-t1);
 }
 
 void nr_start_t2timer(struct sock *sk)
 {
-   nr_cb *nr = nr_sk(sk);
+   struct nr_sock *nr = nr_sk(sk);
 
mod_timer(nr-t2timer, jiffies + nr-t2);
 }
 
 void nr_start_t4timer(struct sock *sk)
 {
-   nr_cb *nr = nr_sk(sk);
+   struct nr_sock *nr = nr_sk(sk);
 
mod_timer(nr-t4timer, jiffies + nr-t4);
 }
 
 void nr_start_idletimer(struct sock *sk)
 {
-   nr_cb *nr = nr_sk(sk);
+   struct nr_sock *nr = nr_sk(sk);
 
if (nr-idle  0)
mod_timer(nr-idletimer, jiffies + nr-idle);
@@ -128,7 +128,7 @@
 static void nr_heartbeat_expiry(unsigned long param)
 {
struct sock *sk = (struct sock *)param;
-   nr_cb *nr = nr_sk(sk);
+   struct nr_sock *nr = nr_sk(sk);
 
bh_lock_sock(sk);
switch (nr-state) {
@@ -167,7 +167,7 @@
 static void nr_t2timer_expiry(unsigned long param)
 {
struct sock *sk = (struct sock *)param;
-   nr_cb *nr = nr_sk(sk);
+   struct nr_sock *nr = nr_sk(sk);
 
bh_lock_sock(sk);
if (nr-condition  NR_COND_ACK_PENDING) {
@@ -189,7 +189,7 @@
 static void nr_idletimer_expiry(unsigned long param)
 {
struct sock *sk = (struct sock *)param;
-   nr_cb *nr = nr_sk(sk);
+   struct nr_sock *nr = nr_sk(sk);
 
bh_lock_sock(sk);
 
@@ -217,7 +217,7 @@
 static void nr_t1timer_expiry(unsigned long param)
 {
struct sock *sk = (struct sock *)param;
-   nr_cb *nr = nr_sk(sk);
+   struct nr_sock *nr = nr_sk(sk);
 
bh_lock_sock(sk);
switch (nr-state) {
Index: bk-afu/include/net/netrom.h
===
--- bk-afu.orig/include/net/netrom.h2005-03-19 20:00:15.0 +
+++ bk-afu/include/net/netrom.h 2005-03-20 10:36:50.0 +
@@ -55,7 +55,8 @@
 #define NR_MAX_WINDOW_SIZE 127 /* Maximum 
Window Allowable - 127 */
 #defineNR_MAX_PACKET_SIZE  236 /* 
Maximum Packet Length - 236 */
 
-typedef struct {
+struct nr_sock {
+   struct sock sock;
ax25_addressuser_addr, source_addr, dest_addr;
struct net_device   *device;
unsigned char   my_index,   my_id;
@@ -72,10 +73,9 @@
struct sk_buff_head ack_queue;
struct sk_buff_head reseq_queue;
struct sk_buff_head frag_queue;
-   struct sock *sk;/* Backlink to socket */
-} nr_cb;
+};
 
-#define nr_sk(__sk) ((nr_cb *)(__sk)-sk_protinfo)
+#define nr_sk(sk) ((struct nr_sock *)(sk))
 
 struct nr_neigh {
struct hlist_node   neigh_node;
Index: bk-afu/net/netrom/af_netrom.c
===
--- bk-afu.orig/net/netrom/af_netrom.c  2005-03-19 20:00:13.0 +
+++ bk-afu/net/netrom/af_netrom.c   2005-03-20 10:44:54.0 +
@@ -66,24 +66,7 @@
 
 static struct sock *nr_alloc_sock(void)
 {
-   nr_cb *nr;
-   struct sock *sk = sk_alloc(PF_NETROM, GFP_ATOMIC, 1, NULL);
-
-   if (!sk)
-   goto out;
-
-   nr = sk-sk_protinfo = kmalloc(sizeof(*nr), GFP_ATOMIC);
-   if (!nr)
-   goto frees;
-
-   memset(nr, 0x00, sizeof(*nr));
-   nr-sk = sk;
-out:
-   return sk;
-frees:
-   sk_free(sk);
-   sk = NULL;
-   goto out;
+   return  sk_alloc(PF_NETROM, GFP_ATOMIC, sizeof(struct nr_sock), NULL);
 }
 
 /*
@@ -169,7 +152,7 @@
 
spin_lock_bh(nr_list_lock);
sk_for_each(s, node, nr_list) {
-   nr_cb *nr = nr_sk(s);
+   struct nr_sock *nr = nr_sk(s);

if (nr-my_index == index  nr-my_id == id) {
bh_lock_sock(s);
@@ -193,7 +176,7 @@
 
spin_lock_bh(nr_list_lock);
sk_for_each(s, node, nr_list) {
-   nr_cb *nr = nr_sk(s);
+   struct nr_sock *nr = nr_sk(s);

if (nr-your_index == index  nr-your_id == id 
!ax25cmp(nr-dest_addr, dest)) {
@@ -300,7 +283,7 @@
char __user *optval, int optlen)
 {

Re: [PATCH] Get rid of sk_protinfo use in rose

2005-03-21 Thread Ralf Baechle DL5RB
On Mon, Mar 21, 2005 at 09:50:37AM +, Ralf Baechle DL5RB wrote:

 Below patch puts struct sock into rose_cb to get rid of the need for the
 use of sk_protinfo in rose_sk().  While we're touching the data structure
 convert it from a typedef into a struct.

The previous two patches leave the same thing to do in ax25 also - where
it's a more complicated thing to do since currently an ax25_cb may exist
without a struct sock - which unfortunately messes up locking.

  Ralf
-
To unsubscribe from this list: send the line unsubscribe linux-hams in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html