2.6.23-rc8-mm2 BUG: register_netdevice() issue as (ab)used by ISDN
Subsystems (2)
[not necessarily a very recent regression, used 2.6.19 kernels before...]
Hi all,
wondered why my main internet server (headless!) didn't come up properly on a new 2.6.23-rc8-mm2
(connections almost completely refused: firewalling not executed due to earlier OOPS?).
Upon LILO emergency fallback into an older version (2.6.16...) saw this in /var/log/messages:
Oct 7 13:07:34 gate kernel: e100: Intel(R) PRO/100 Network Driver, 3.5.23-k4-NAPI Oct 7 13:07:34 gate kernel: e100: Copyright(c) 1999-2006 Intel Corporation Oct 7 13:07:34 gate kernel: Atmel at76x USB Wireless LAN Driver 0.16 loading Oct 7 13:07:34 gate kernel: eth2: MAC address 00:05:5d:95:ab:f0 Oct 7 13:07:34 gate kernel: eth2: firmware version 1.101.5-84 Oct 7 13:07:34 gate kernel: eth2: regulatory domain 0x30: ETSI (most of Europe) Oct 7 13:07:34 gate kernel: usbcore: registered new interface driver at76_usb Oct 7 13:07:34 gate kernel: Netfilter messages via NETLINK v0.30. Oct 7 13:07:34 gate kernel: nf_conntrack version 0.5.0 (2048 buckets, 8192 max) Oct 7 13:07:34 gate kernel: nf_conntrack_ipv4: Unknown parameter `hashsize' Oct 7 13:07:34 gate kernel: ip_tables: (C) 2000-2006 Netfilter Core Team Oct 7 13:07:34 gate kernel: process `syslogd' is using obsolete setsockopt SO_BSD COMPAT Oct 7 13:07:40 gate kernel: ------------[ cut here ]------------ Oct 7 13:07:40 gate kernel: kernel BUG at net/core/dev.c:3485! Oct 7 13:07:40 gate kernel: invalid opcode: 0000 [#1] Oct 7 13:07:40 gate kernel: last sysfs file: /devices/platform/sis5595.656/temp1_ max Oct 7 13:07:40 gate kernel: Modules linked in: xt_state xt_limit xt_tcpudp xt_mul
tiport iptable_mangle iptable_nat nf_conntrack_ipv4 iptable_filter ip_tables nf_na t_tftp nf_conntrack_tftp nf_nat_h323 nf_conntrack_h323 nf_nat_irc nf_nat_ftp nf_co nntrack_irc nf_conntrack_ftp ipt_MASQUERADE nf_nat nf_conntrack nfnetlink ipt_REJE CT ipt_LOG x_tables at76_usb firmware_class e100 ohci_hcd usbcore i2c_sis630 i2c_s is5595 i2c_core sis5595 hisax isdn eepro100
Oct 7 13:07:40 gate kernel: Oct 7 13:07:40 gate kernel: Pid: 2235, comm: isdnctrl Not tainted (2.6.23-rc8-mm2 -gate #1) Oct 7 13:07:40 gate kernel: EIP: 0060:[<c029ad8a>] EFLAGS: 00010246 CPU: 0 Oct 7 13:07:40 gate kernel: EIP is at register_netdevice+0x6d/0x2c1 Oct 7 13:07:40 gate kernel: EAX: 00000000 EBX: c786501c ECX: 00000000 EDX: 00000d 99 Oct 7 13:07:40 gate kernel: ESI: c786501c EDI: 00000000 EBP: c1657d08 ESP: c1657c ec Oct 7 13:07:40 gate kernel: DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068 Oct 7 13:07:40 gate kernel: Process isdnctrl (pid: 2235, ti=c1656000 task=c14c306 0 task.ti=c1656000) Oct 7 13:07:40 gate kernel: Stack: c786501c 00000000 c1657d00 c0309ec6 c1657d68 c 786501c 00000000 c1657d18 Oct 7 13:07:40 gate kernel: c029b010 c1657d68 c7865000 c1657d38 c885a0fa c 884e39c c8864598 c786501c Oct 7 13:07:40 gate kernel: c1657d68 00000000 bfbf779d c1657f60 c886484d c 212ef80 c1561980 c1805ab0 Oct 7 13:07:40 gate kernel: Call Trace: Oct 7 13:07:40 gate kernel: [<c029b010>] register_netdev+0x32/0x3f Oct 7 13:07:40 gate kernel: [<c885a0fa>] isdn_net_new+0x111/0x2ca [isdn] Oct 7 13:07:40 gate kernel: [<c886484d>] isdn_ioctl+0x2b5/0xb46 [isdn] Oct 7 13:07:40 gate kernel: [<c015f53c>] do_ioctl+0x40/0x50 Oct 7 13:07:40 gate kernel: [<c015f738>] vfs_ioctl+0x1ec/0x203 Oct 7 13:07:40 gate kernel: [<c015f780>] sys_ioctl+0x31/0x49 Oct 7 13:07:40 gate kernel: [<c0103e12>] syscall_call+0x7/0xb Oct 7 13:07:40 gate kernel: [<b7f54de4>] 0xb7f54de4 Oct 7 13:07:40 gate kernel: ======================= Oct 7 13:07:40 gate kernel: Code: e8 3f a5 e6 ff ba 99 0d 00 00 b8 b4 3c 38 c0 e8 96 82 e7 ff 83 bb 20 02 00 00 00 74 04 0f 0b eb fe 8b 83 80 02 00 00 85 c0 75 04 <0f> 0b eb fe 89 45 f0 b9 4c 2e 48 c0 ba 8e 3e 38 c0 8d 83 78 01 Oct 7 13:07:40 gate kernel: EIP: [<c029ad8a>] register_netdevice+0x6d/0x2c1 SS:ES P 0068:c1657cec Oct 7 13:18:17 gate syslogd 1.4.1#20: restart. Oct 7 13:18:17 gate kernel: klogd 1.4.1#20, log source = /proc/kmsg started. Oct 7 13:18:17 gate kernel: Linux version 2.6.16-cks11-gate (root@gate) (gcc vers
ion 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)) #1 Sat May 27 14:45:18 CEST 2006
[logging was then back into 2.6.16 above]
2.6.23-rc8-mm2/net/core/dev.c/register_netdevice():
int register_netdevice(struct net_device *dev)
{
struct hlist_head *head;
struct hlist_node *p;
int ret;
struct net *net;
BUG_ON(dev_boot_phase);
ASSERT_RTNL();
might_sleep();
/* When net_device's are persistent, this will be fatal. */
BUG_ON(dev->reg_state != NETREG_UNINITIALIZED);
BUG_ON(!dev->nd_net);
net = dev->nd_net;
spin_lock_init(&dev->queue_lock);
spin_lock_init(&dev->_xmit_lock);
netdev_set_lockdep_class(&dev->_xmit_lock, dev->type);
dev->xmit_lock_owner = -1;
spin_lock_init(&dev->ingress_lock);
dev->iflink = -1;
/* Init, if this function is available */
if (dev->init) {
ret = dev->init(dev);
if (ret) {
if (ret > 0)
ret = -EIO;
goto out;
}
}objdump -D linux-2.6.23-rc8-mm2/vmlinux|less :
c029ad1d <register_netdevice>:
c029ad1d: 55 push %ebp c029ad1e: 89 e5 mov %esp,%ebp c029ad20: 57 push %edi c029ad21: 56 push %esi c029ad22: 53 push %ebx c029ad23: 89 c3 mov %eax,%ebx c029ad25: 83 ec 10 sub $0x10,%esp c029ad28: 83 3d 4c fa 41 c0 00 cmpl $0x0,0xc041fa4c c029ad2f: 74 04 je c029ad35 <register_netdevice+0x18> c029ad31: 0f 0b ud2a c029ad33: eb fe jmp c029ad33 <register_netdevice+0x16> c029ad35: e8 7e 7f 00 00 call c02a2cb8 <rtnl_trylock> c029ad3a: 85 c0 test %eax,%eax c029ad3c: 74 26 je c029ad64 <register_netdevice+0x47> c029ad3e: e8 79 78 00 00 call c02a25bc <rtnl_unlock> c029ad43: c7 44 24 08 97 0d 00 movl $0xd97,0x8(%esp) c029ad4a: 00 c029ad4b: c7 44 24 04 b4 3c 38 movl $0xc0383cb4,0x4(%esp) c029ad52: c0 c029ad53: c7 04 24 c3 3c 38 c0 movl $0xc0383cc3,(%esp) c029ad5a: e8 13 e3 e7 ff call c0119072 <printk> c029ad5f: e8 3f a5 e6 ff call c01052a3 <dump_stack> c029ad64: ba 99 0d 00 00 mov $0xd99,%edx c029ad69: b8 b4 3c 38 c0 mov $0xc0383cb4,%eax c029ad6e: e8 96 82 e7 ff call c0113009 <__might_sleep> c029ad73: 83 bb 20 02 00 00 00 cmpl $0x0,0x220(%ebx) c029ad7a: 74 04 je c029ad80 <register_netdevice+0x63> c029ad7c: 0f 0b ud2a c029ad7e: eb fe jmp c029ad7e <register_netdevice+0x61> c029ad80: 8b 83 80 02 00 00 mov 0x280(%ebx),%eax c029ad86: 85 c0 test %eax,%eax c029ad88: 75 04 jne c029ad8e <register_netdevice+0x71> c029ad8a: 0f 0b ud2a c029ad8c: eb fe jmp c029ad8c <register_netdevice+0x6f> c029ad8e: 89 45 f0 mov %eax,0xfffffff0(%ebp) c029ad91: b9 4c 2e 48 c0 mov $0xc0482e4c,%ecx c029ad96: ba 8e 3e 38 c0 mov $0xc0383e8e,%edx c029ad9b: 8d 83 78 01 00 00 lea 0x178(%ebx),%eax c029ada1: e8 8e d9 f7 ff call c0218734 <__spin_lock_init> c029ada6: 8d 83 b4 01 00 00 lea 0x1b4(%ebx),%eax c029adac: b9 4c 2e 48 c0 mov $0xc0482e4c,%ecx c029adb1: ba 9f 3e 38 c0 mov $0xc0383e9f,%edx c029adb6: e8 79 d9 f7 ff call c0218734 <__spin_lock_init> c029adbb: ba b0 3e 38 c0 mov $0xc0383eb0,%edx c029adc0: b9 4c 2e 48 c0 mov $0xc0482e4c,%ecx c029adc5: c7 83 c4 01 00 00 ff movl $0xffffffff,0x1c4(%ebx) c029adcc: ff ff ff c029adcf: 8d 83 a0 01 00 00 lea 0x1a0(%ebx),%eax c029add5: e8 5a d9 f7 ff call c0218734 <__spin_lock_init> c029adda: 8b 53 40 mov 0x40(%ebx),%edx c029addd: c7 43 50 ff ff ff ff movl $0xffffffff,0x50(%ebx) c029ade4: 85 d2 test %edx,%edx c029ade6: 74 1b je c029ae03 <register_netdevice+0xe6>
Since EIP is c029ad8a, following the code flow it clearly looks to me as if it's the
BUG_ON(!dev->nd_net);
check which caused the BUG message.
This is a K6-3/450@150 running Debian stable.
lsmod (NOTE: this is on 2.6.16!!):
Module Size Used by sch_ingress 4356 1 cls_u32 7044 5 sch_tbf 6272 1 sch_sfq 5632 4 sch_htb 15616 1 ppp_async 11648 1 crc_ccitt 2176 1 ppp_async ipt_ULOG 7712 1 xt_state 2176 4 xt_limit 2688 11 xt_tcpudp 3328 48 ipt_multiport 2560 10 iptable_mangle 2816 0 iptable_nat 7684 1 iptable_filter 3072 1 ip_tables 11736 3 iptable_mangle,iptable_nat,iptable_filter ip_nat_tftp 1920 0 ip_conntrack_tftp 4244 1 ip_nat_tftp ip_nat_irc 2688 0 ip_nat_ftp 3200 0 ip_conntrack_irc 6680 1 ip_nat_irc ip_conntrack_ftp 7324 1 ip_nat_ftp ipt_MASQUERADE 3712 1 ip_nat 15764 5 iptable_nat,ip_nat_tftp,ip_nat_irc,ip_nat_ftp,ipt_MASQUERADE ip_conntrack 44196 10 xt_state,iptable_nat,ip_nat_tftp,ip_conntrack_tftp,ip_nat_irc,ip_nat_ftp,ip_conntrack_irc,ip_conntrack_ftp,ipt_MASQUERADE,ip_nat ipt_REJECT 5248 0 ipt_LOG 6144 11 x_tables 12292 10 ipt_ULOG,xt_state,xt_limit,xt_tcpudp,ipt_multiport,iptable_nat,ip_tables,ipt_MASQUERADE,ipt_REJECT,ipt_LOG e100 33284 0 at76c503_rfmd 5260 0 firmware_class 10112 1 at76c503_rfmd at76c503 79840 1 at76c503_rfmd at76_usbdfu 4996 1 at76c503 ohci_hcd 29700 0 usbcore 126240 5 at76c503_rfmd,at76c503,at76_usbdfu,ohci_hcd i2c_sis630 8844 0 i2c_sis5595 7940 0 sis5595 14216 0 i2c_isa 5888 1 sis5595 i2c_core 22144 4 i2c_sis630,i2c_sis5595,sis5595,i2c_isa hisax 175100 2 isdn 108864 5 hisax eepro100 29456 0
root@gate:/usr/src/linux-2.6.23-rc8-mm2/net# dpkg -l|grep isdn ii isdnlog 3.9.20060704-3 ISDN connection logger ii isdnlog-data 3.9.20060704-3 data for isdnlog users ii isdnutils 3.9.20060704-3 Most important ISDN-related packages and uti ii isdnutils-base 3.9.20060704-3 ISDN utilities, the basic (minimal) set ii isdnutils-xtools 3.9.20060704-3 ISDN utilities that use X ii isdnvboxclient 3.9.20060704-3 ISDN answering machine, client ii isdnvboxserver 3.9.20060704-3 ISDN answering machine, server
CONFIG_ISDN=mCONFIG_ISDN_I4L=mCONFIG_ISDN_PPP=yCONFIG_ISDN_PPP_VJ=yCONFIG_ISDN_MPP=y
# CONFIG_IPPP_FILTER is not setCONFIG_ISDN_PPP_BSDCOMP=mCONFIG_ISDN_AUDIO=y
# CONFIG_ISDN_TTY_FAX is not set
#
# ISDN feature submodules
#CONFIG_ISDN_DRV_LOOP=m
# CONFIG_ISDN_DIVERSION is not set
#
# ISDN4Linux hardware drivers
#
#
# Passive cards
#CONFIG_ISDN_DRV_HISAX=m
#
# D-channel protocol features
#CONFIG_HISAX_EURO=yCONFIG_DE_AOC=y
# CONFIG_HISAX_NO_SENDCOMPLETE is not set
# CONFIG_HISAX_NO_LLC is not set
# CONFIG_HISAX_NO_KEYPAD is not set
# CONFIG_HISAX_1TR6 is not set
# CONFIG_HISAX_NI1 is not setCONFIG_HISAX_MAX_CARDS=8
#
# HiSax supported cards
#
# CONFIG_HISAX_16_0 is not setCONFIG_HISAX_16_3=yCONFIG_HISAX_TELESPCI=y
# CONFIG_HISAX_S0BOX is not set
# CONFIG_HISAX_AVM_A1 is not setCONFIG_HISAX_FRITZPCI=y
# CONFIG_HISAX_AVM_A1_PCMCIA is not set
# CONFIG_HISAX_ELSA is not set
# CONFIG_HISAX_IX1MICROR2 is not set
# CONFIG_HISAX_DIEHLDIVA is not set
# CONFIG_HISAX_ASUSCOM is not set
# CONFIG_HISAX_TELEINT is not set
# CONFIG_HISAX_HFCS is not set
# CONFIG_HISAX_SEDLBAUER is not setCONFIG_HISAX_SPORTSTER=y
# CONFIG_HISAX_MIC is not set
# CONFIG_HISAX_NETJET is not set
# CONFIG_HISAX_NETJET_U is not set
# CONFIG_HISAX_NICCY is not set
# CONFIG_HISAX_ISURF is not set
# CONFIG_HISAX_HSTSAPHIR is not set
# CONFIG_HISAX_BKM_A4T is not set
# CONFIG_HISAX_SCT_QUADRO is not set
# CONFIG_HISAX_GAZEL is not setCONFIG_HISAX_HFC_PCI=yCONFIG_HISAX_W6692=y
# CONFIG_HISAX_HFC_SX is not set
# CONFIG_HISAX_DEBUG is not set
#
# HiSax PCMCIA card service modules
#
#
# HiSax sub driver modules
#
# CONFIG_HISAX_ST5481 is not set
# CONFIG_HISAX_HFCUSB is not set
# CONFIG_HISAX_HFC4S8S is not setCONFIG_HISAX_FRITZ_PCIPNP=m
#
# Active cards
#
# CONFIG_ISDN_DRV_ICN is not set
# CONFIG_ISDN_DRV_PCBIT is not set
# CONFIG_ISDN_DRV_SC is not set
# CONFIG_ISDN_DRV_ACT2000 is not set
# CONFIG_HYSDN is not set
# CONFIG_ISDN_DRV_GIGASET is not set
# CONFIG_ISDN_CAPI is not set
# CONFIG_PHONE is not set
lspci (NOTE: on 2.6.16!!):
00:09.0 Network controller: Cologne Chip Designs GmbH ISDN network controller [HFC-PCI] (rev 02)
I used to have an ISA-based card (Teles?) in there, replaced by the PCI one about 2 years ago.
grep isdnctrl /etc/isdn/*:
/etc/isdn/device.ippp0:# Read the isdnctrl manpage for more info. /etc/isdn/device.ippp0: isdnctrl addif ${device} /etc/isdn/device.ippp0: isdnctrl eaz ${device} $LOCALMSN /etc/isdn/device.ippp0: # "name". More than one number can be set by calling isdnc trl addphone/etc/isdn/device.ippp0: isdnctrl addphone ${device} out $LEADINGZE
RO$MSN/etc/isdn/device.ippp0: # disabled. More than one number can be set by calling isd nctrl addphone/etc/isdn/device.ippp0: # isdnctrl addphone ${device} in $MSN/etc/isdn/device.ippp0: # been added to the access list with isdnctrl addphone nam e in./etc/isdn/device.ippp0: isdnctrl secure ${device} on/etc/isdn/device.ippp0: isdnctrl huptimeout ${device} 180 # XXX_/etc/isdn/device.ippp0: #isdnctrl dialmax ${device} 3 /etc/isdn/device.ippp0: #isdnctrl ihup ${device} on /etc/isdn/device.ippp0: isdnctrl encap ${device} $ENCAP /etc/isdn/device.ippp0: isdnctrl l2_prot ${device} hdlc /etc/isdn/device.ippp0: isdnctrl l3_prot ${device} trans /etc/isdn/device.ippp0: isdnctrl verbose 2/etc/isdn/device.ippp0: #isdnctrl chargehup ${device} on /etc/isdn/device.ippp0: #isdnctrl chargeint ${device} NUM /etc/isdn/device.ippp0: #isdnctrl callback ${device} MODE /etc/isdn/device.ippp0: #isdnctrl cbdelay ${device} SECONDS /etc/isdn/device.ippp0: #isdnctrl cbhup ${device} MODE /etc/isdn/device.ippp0: # See also : isdnctrl(8), isdnctrl help text/etc/isdn/device.ippp0: isdnctrl pppbind ${device} $bindnum/etc/isdn/device.ippp0: isdnctrl dialmode $device $DIALMODE >/dev/null 2>&1 /etc/isdn/device.ippp0: isdnctrl dialmode $device off >/dev/null 2>&1 /etc/isdn/device.ippp0: isdnctrl delif $device 2> /dev/null/etc/isdn/init.d.functions: # can't count on "isdnctrl status all" working yet,
unfortunately.../etc/isdn/init.d.functions: DEVS=`/usr/sbin/isdnctrl list all | grep 'Current
setup' | cut -f2 -d"'" | sort`/etc/isdn/init.d.functions: if [ ! -e /dev/isdnctrl ]; then/etc/isdn/init.d.functions: cd /dev && ln -s isdnctrl0 isdnctrl/etc/isdn/init.d.functions: cardnum=0 # counts in channels, just like /dev/is
dnctrlX/etc/isdn/init.d.functions: for optionfile in /etc/isdn/isdnlog.isdnctrl[02468]
; do/etc/isdn/init.d.functions: devicenum=${device#isdnctrl}/etc/isdn/init.d.functions: # test for isdnctrl dualmode. With dualmode, on
e isdnlog listens to/etc/isdn/init.d.functions: for optionfile in /etc/isdn/isdnlog.isdnctrl?; do/etc/isdn/init.d.functions: for optionfile in /etc/isdn/isdnlog.isdnctrl?; do/etc/isdn/init.d.functions: /usr/sbin/isdnctrl delif $device >/
dev/null 2>&1 || true/etc/isdn/init.d.functions: /usr/sbin/isdnctrl delif $device >/dev/null
2>&1 || true
/etc/isdn/netdown.old:eval `grep '^ isdnctrl addphone' /etc/isdn/device.ippp0
| sed 's,addphone,delphone,'`
/etc/isdn/netdown.old:/sbin/isdnctrl hangup ippp0
/etc/isdn/netup.old:eval grep '^ isdnctrl addphone' /etc/isdn/device.ippp0/etc/isdn/stop: /usr/sbin/isdnctrl system off
/etc/isdn/xisdnload-netdown:# script again). So, putting "isdnctrl dialmode all of f" here is not that
/etc/isdn/xisdnload-netdown:# useful, as you have to do "isdnctrl dialmode all aut o" manually...
/etc/isdn/xisdnload-netdown:/usr/sbin/isdnctrl hangup ippp0 > /dev/null /etc/isdn/xmonisdn-netdown:/usr/sbin/isdnctrl dialmode all off /etc/isdn/xmonisdn-netup:/usr/sbin/isdnctrl dialmode all auto
I intend to still try to get it up and running with 2.6.23-rc8-mm2 today (with some workarounds hopefully, maybe even disabling ISDN completely)...
The last running kernel (I didn't have newer ones in between), up for some 110 days was 2.6.19-cks2 (IOW, I cannot quite say that
"this is an important regression, it has been broken very recently").
Thanks,
Andreas Mohr
Quoted 6 lines · Andreas Mohr
I intend to still try to get it up and running with 2.6.23-rc8-mm2 today (with some workarounds hopefully, maybe even disabling ISDN completely)...
The last running kernel (I didn't have newer ones in between), up for some 110 days was 2.6.19-cks2 (IOW, I cannot quite say that
"this is an important regression, it has been broken very recently").
It definitely looks like ISDN is somehow to blame. Any chance you could try git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.24.git ?
That would help narrow down the problem to a very-large set of networking changes pending for 2.6.24.
If you can isolate it to net-2.6.24, it should be easily bisect-able from there, if you have the patience :)
Jeff
Quoted 2 lines · Jeff Garzik
It definitely looks like ISDN is somehow to blame. Any chance you could try
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.24.git?
I'm afraid I won't make it, since this server is not at my home location, is a ""production"" server and takes only exactly 200 minutes for a kernel build (K6-3/150).
I thus decided to now try plain 2.6.23-rc8 whether it's "corrupted", too.
Quoted 2 lines
That would help narrow down the problem to a very-large set of networking changes pending for 2.6.24.
...only if I have a known-working very recent version, which is exactly the problem now.
Andreas Mohr
Hi,
Quoted 1 line · Andreas Mohr
I thus decided to now try plain 2.6.23-rc8 whether it's "corrupted", too.
OK, after 3 hours of compilation the ONLY datapoint I can give right now is:
1 (one) boot on 2.6.23-rc8-mm2 had the BUG in /var/log/messages, 1 (one) boot on 2.6.23-rc8 did NOT have it.
The two .config:s (I did a make oldconfig when going back to non-mm2) don't seem to have any relevant differences.
I could offer to do more testing on this machine,
but this carries a slight risk for me since I (personally) won't have physical access to it for a couple days and some people will kill me if the main internet gateway happened to go down unfixably. ;)
Thanks,
Andreas Mohr
Quoted 6 lines · Andreas Mohr
[not necessarily a very recent regression, used 2.6.19 kernels before...]
Hi all,
wondered why my main internet server (headless!) didn't come up properly on a new 2.6.23-rc8-mm2
...
Quoted 3 lines
as if it's the
BUG_ON(!dev->nd_net);check which caused the BUG message.
The regression comes from the net namespace patches.
Up to now in ISDN the struct netdevice is contained in struct isdn_net_dev and so it's not allocated using alloc_netdev(), which would set the missing dev->nd_net pointer.
Signature · 4 lines
Karsten Keil SuSE Labs ISDN and VOIP development SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Quoted 9 lines · Andreas Mohr
Hi,
Quoted 1 line · Andreas Mohr
I thus decided to now try plain 2.6.23-rc8 whether it's "corrupted", too.
OK, after 3 hours of compilation the ONLY datapoint I can give right now is:
1 (one) boot on 2.6.23-rc8-mm2 had the BUG in/var/log/messages, 1 (one) boot on 2.6.23-rc8 did NOT have it.
Quoted 8 lines
The two .config:s (I did a make oldconfig when going back to non-mm2) don't seem to have any relevant differences.
I could offer to do more testing on this machine,
but this carries a slight risk for me since I (personally) won't have physical access to it for a couple days and some people will kill me if the main internet gateway happened to go down unfixably. ;)
You could try following patch with 2.6.23-rc8-mm2, it change I4L to use alloc_netdev().
drivers/isdn/i4l/isdn_net.c +96 -89
@@ -77,7 +77,7 @@if (lp->master) dev = lp->master;else - dev = &n->dev; + dev = n->dev;return netif_running (dev); }
@@ -90,7 +90,7 @@if (lp->master)netif_wake_queue (lp->master);else -netif_wake_queue (&lp->netdev->dev); +netif_wake_queue (lp->netdev->dev); }/*
@@ -102,7 +102,7 @@if (lp->master)netif_stop_queue (lp->master);else -netif_stop_queue (&lp->netdev->dev); +netif_stop_queue (lp->netdev->dev); }/*
@@ -287,7 +287,7 @@BEWARE! This chunk of code cannot be called from hardware interrupt handler. I hope it is true. --ANK */ -qdisc_reset (lp->netdev->dev.qdisc); +qdisc_reset (lp->netdev->dev->qdisc); } lp->dialstate =0 ; dev->rx_netdev[isdn_dc2minor (lp->isdn_device, lp->isdn_channel)] =NULL ;
@@ -345,27 +345,27 @@ l->chargetime += l->chargeint;if (time_after (jiffies, l->chargetime + l->chargeint -2 *HZ ))if (l->outgoing || l->hupflags &ISDN_INHUP ) -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev); }else if (l->outgoing) {if (l->hupflags &ISDN_CHARGEHUP ) {if (l->hupflags &ISDN_WAITCHARGE ) {printk (KERN_DEBUG "isdn_net: Hupflags of %s are %X\n" , l->name, l->hupflags); -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev); }else if (time_after (jiffies, l->chargetime + l->chargeint)) {printk (KERN_DEBUG "isdn_net: %s: chtime = %lu, chint = %d\n" , l->name, l->chargetime, l->chargeint); -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev); } }else -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev); }else if (l->hupflags &ISDN_INHUP ) -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev); }if (dev->global_flags &ISDN_GLOBAL_STOPPED || (ISDN_NET_DIALMODE (*l) ==ISDN_NET_DM_OFF )) { -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev);break ; } }
@@ -579,7 +579,7 @@if (!lp->dial) {printk (KERN_WARNING "%s: phone number deleted?\n" , lp->name); -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev);break ; } anymore =1 ;
@@ -616,8 +616,8 @@ s ="dial suppressed: isdn system stopped" ; else s ="dial suppressed: dialmode `off'" ; -isdn_net_unreachable (&p->dev,NULL , s); -isdn_net_hangup (&p->dev); +isdn_net_unreachable (p->dev,NULL , s); +isdn_net_hangup (p->dev);break ; } cmd.driver = lp->isdn_device;
@@ -633,7 +633,7 @@if (!lp->dial) {printk (KERN_WARNING "%s: phone number deleted?\n" , lp->name); -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev);break ; }if (!strncmp (lp->dial->num,"LEASED" ,strlen ("LEASED" ))) {
@@ -644,8 +644,8 @@if (time_after (jiffies, lp->dialstarted + lp->dialtimeout)) { lp->dialwait_timer = jiffies + lp->dialwait; lp->dialstarted =0 ; -isdn_net_unreachable (&p->dev,NULL ,"dial: timed out" ); -isdn_net_hangup (&p->dev); +isdn_net_unreachable (p->dev,NULL ,"dial: timed out" ); +isdn_net_hangup (p->dev);break ; }
@@ -674,9 +674,9 @@if (lp->dialtimeout ==0 ) { lp->dialwait_timer = jiffies + lp->dialwait; lp->dialstarted =0 ; -isdn_net_unreachable (&p->dev,NULL ,"dial: tried all numbers dialmax times" ); +isdn_net_unreachable (p->dev,NULL ,"dial: tried all numbers dialmax times" ); } -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev);break ; } }
@@ -758,7 +758,7 @@ cmd.arg = lp->isdn_channel + (lp->l3_proto <<8 );isdn_command (&cmd);if (lp->dtimer++ >ISDN_TIMER_DTIMEOUT15 ) -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev);else { anymore =1 ; lp->dialstate++;
@@ -781,7 +781,7 @@printk (KERN_DEBUG "dialtimer4: %d\n" , lp->dtimer);#endif if (lp->dtimer++ >ISDN_TIMER_DTIMEOUT10 ) -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev);else anymore =1 ;break ;
@@ -1618,7 +1618,7 @@__be32 addr =0 ;/* local ipv4 address */ __be32 mask =0 ;/* local netmask */ -if ((in_dev = lp->netdev->dev.ip_ptr) !=NULL ) { +if ((in_dev = lp->netdev->dev->ip_ptr) !=NULL ) {/* take primary(first) address of interface */ struct in_ifaddr *ifa = in_dev->ifa_list;if (ifa !=NULL ) {
@@ -1866,7 +1866,7 @@isdn_net_local *lp = p->local;if ((lp->flags &ISDN_NET_CONNECTED ) && (!lp->dialstate)) { -isdn_net_receive (&p->dev, skb); +isdn_net_receive (p->dev, skb);return 1 ; } }
@@ -2531,6 +2531,42 @@ }/* +* Helper for alloc_netdev() +*/ +static void _isdn_setup (struct net_device *dev) +{ +isdn_net_local *lp = dev->priv; + + dev->flags =IFF_NOARP |IFF_POINTOPOINT ; + lp->p_encap =ISDN_NET_ENCAP_RAWIP ; + lp->magic =ISDN_NET_MAGIC ; + lp->last = lp; + lp->next = lp; + lp->isdn_device =-1 ; + lp->isdn_channel =-1 ; + lp->pre_device =-1 ; + lp->pre_channel =-1 ; + lp->exclusive =-1 ; + lp->ppp_slot =-1 ; + lp->pppbind =-1 ; +skb_queue_head_init (&lp->super_tx_queue); + lp->l2_proto =ISDN_PROTO_L2_X75I ; + lp->l3_proto =ISDN_PROTO_L3_TRANS ; + lp->triggercps =6000 ; + lp->slavedelay =10 *HZ ; + lp->hupflags =ISDN_INHUP ;/* Do hangup even on incoming calls */ + lp->onhtime =10 ;/* Default hangup-time for saving costs */ + lp->dialmax =1 ; +/* Hangup before Callback, manual dial */ + lp->flags =ISDN_NET_CBHUP |ISDN_NET_DM_MANUAL ; + lp->cbdelay =25 ;/* Wait 5 secs before Callback */ + lp->dialtimeout =-1 ;/* Infinite Dial-Timeout */ + lp->dialwait =5 *HZ ;/* Wait 5 sec. after failed dial */ + lp->dialstarted =0 ;/* Jiffies of last dial-start */ + lp->dialwait_timer =0 ;/* Jiffies of earliest next dial-start */ +} + +/* * Allocate a new network-interface and initialize its data structures. */ char *
@@ -2543,23 +2579,21 @@printk (KERN_WARNING "isdn_net: interface %s already exists\n" , name);return NULL ; } +if (name ==NULL ) + name =" " ;if (!(netdev =kzalloc (sizeof (isdn_net_dev),GFP_KERNEL ))) {printk (KERN_WARNING "isdn_net: Could not allocate net-device\n" );return NULL ; } -if (!(netdev->local =kzalloc (sizeof (isdn_net_local),GFP_KERNEL ))) { -printk (KERN_WARNING "isdn_net: Could not allocate device locals\n" ); + netdev->dev =alloc_netdev (sizeof (isdn_net_local), name, _isdn_setup); +if (!netdev->dev) { +printk (KERN_WARNING "isdn_net: Could not allocate network device\n" );kfree (netdev);return NULL ; } -if (name ==NULL ) -strcpy (netdev->local->name," " ); -else -strcpy (netdev->local->name, name); -strcpy (netdev->dev.name, netdev->local->name); - netdev->dev.priv = netdev->local; - netdev->dev.init = isdn_net_init; - netdev->local->p_encap =ISDN_NET_ENCAP_RAWIP ; + netdev->local = netdev->dev->priv; +strcpy (netdev->local->name, netdev->dev->name); + netdev->dev->init = isdn_net_init;if (master) {/* Device shall be a slave */ struct net_device *p = (((isdn_net_local *) master->priv)->slave);
@@ -2571,60 +2605,33 @@ q = p; p = (((isdn_net_local *) p->priv)->slave); } - ((isdn_net_local *) q->priv)->slave = &(netdev->dev); + ((isdn_net_local *) q->priv)->slave = netdev->dev; }else {/* Device shall be a master */ /* * Watchdog timer (currently) for master only. */ - netdev->dev.tx_timeout = isdn_net_tx_timeout; - netdev->dev.watchdog_timeo =ISDN_NET_TX_TIMEOUT ; -if (register_netdev (&netdev->dev) !=0 ) { + netdev->dev->tx_timeout = isdn_net_tx_timeout; + netdev->dev->watchdog_timeo =ISDN_NET_TX_TIMEOUT ; +if (register_netdev (netdev->dev) !=0 ) {printk (KERN_WARNING "isdn_net: Could not register net-device\n" ); -kfree (netdev->local); +free_netdev (netdev->dev);kfree (netdev);return NULL ; } } - netdev->local->magic =ISDN_NET_MAGIC ; - netdev->queue = netdev->local;spin_lock_init (&netdev->queue_lock); - netdev->local->last = netdev->local; netdev->local->netdev = netdev; - netdev->local->next = netdev->local;INIT_WORK (&netdev->local->tqueue, isdn_net_softint);spin_lock_init (&netdev->local->xmit_lock); - netdev->local->isdn_device =-1 ; - netdev->local->isdn_channel =-1 ; - netdev->local->pre_device =-1 ; - netdev->local->pre_channel =-1 ; - netdev->local->exclusive =-1 ; - netdev->local->ppp_slot =-1 ; - netdev->local->pppbind =-1 ; -skb_queue_head_init (&netdev->local->super_tx_queue); - netdev->local->l2_proto =ISDN_PROTO_L2_X75I ; - netdev->local->l3_proto =ISDN_PROTO_L3_TRANS ; - netdev->local->triggercps =6000 ; - netdev->local->slavedelay =10 *HZ ; - netdev->local->hupflags =ISDN_INHUP ;/* Do hangup even on incoming calls */ - netdev->local->onhtime =10 ;/* Default hangup-time for saving costs -of those who forget configuring this */ - netdev->local->dialmax =1 ; - netdev->local->flags =ISDN_NET_CBHUP |ISDN_NET_DM_MANUAL ;/* Hangup before Callback, manual dial */ - netdev->local->cbdelay =25 ;/* Wait 5 secs before Callback */ - netdev->local->dialtimeout =-1 ;/* Infinite Dial-Timeout */ - netdev->local->dialwait =5 *HZ ;/* Wait 5 sec. after failed dial */ - netdev->local->dialstarted =0 ;/* Jiffies of last dial-start */ - netdev->local->dialwait_timer =0 ;/* Jiffies of earliest next dial-start */ -/* Put into to netdev-chain */ netdev->next = (void *) dev->netdev; dev->netdev = netdev; -return netdev->dev.name; +return netdev->dev->name; } char *
@@ -2649,7 +2656,7 @@/* Master must not be started yet */ if (isdn_net_device_started (n))return NULL ; -return (isdn_net_new (newname, &(n->dev))); +return (isdn_net_new (newname, n->dev)); }return NULL ; }
@@ -2718,9 +2725,9 @@ lp->name);return -EINVAL ;#else - p->dev.type =ARPHRD_PPP ;/* change ARP type */ - p->dev.addr_len =0 ; - p->dev.do_ioctl = isdn_ppp_dev_ioctl; + p->dev->type =ARPHRD_PPP ;/* change ARP type */ + p->dev->addr_len =0 ; + p->dev->do_ioctl = isdn_ppp_dev_ioctl;#endif break ;case ISDN_NET_ENCAP_X25IFACE :
@@ -2729,12 +2736,12 @@ p->local->name);return -EINVAL ;#else - p->dev.type =ARPHRD_X25 ;/* change ARP type */ - p->dev.addr_len =0 ; + p->dev->type =ARPHRD_X25 ;/* change ARP type */ + p->dev->addr_len =0 ;#endif break ;case ISDN_NET_ENCAP_CISCOHDLCK : - p->dev.do_ioctl = isdn_ciscohdlck_dev_ioctl; + p->dev->do_ioctl = isdn_ciscohdlck_dev_ioctl;break ;default : if( cfg->p_encap >= 0 &&
@@ -2861,20 +2868,20 @@ }if (cfg->p_encap != lp->p_encap) {if (cfg->p_encap ==ISDN_NET_ENCAP_RAWIP ) { - p->dev.hard_header =NULL ; - p->dev.hard_header_cache =NULL ; - p->dev.header_cache_update =NULL ; - p->dev.flags =IFF_NOARP |IFF_POINTOPOINT ; + p->dev->hard_header =NULL ; + p->dev->hard_header_cache =NULL ; + p->dev->header_cache_update =NULL ; + p->dev->flags =IFF_NOARP |IFF_POINTOPOINT ; }else { - p->dev.hard_header = isdn_net_header; + p->dev->hard_header = isdn_net_header;if (cfg->p_encap ==ISDN_NET_ENCAP_ETHER ) { - p->dev.hard_header_cache = lp->org_hhc; - p->dev.header_cache_update = lp->org_hcu; - p->dev.flags =IFF_BROADCAST |IFF_MULTICAST ; + p->dev->hard_header_cache = lp->org_hhc; + p->dev->header_cache_update = lp->org_hcu; + p->dev->flags =IFF_BROADCAST |IFF_MULTICAST ; }else { - p->dev.hard_header_cache =NULL ; - p->dev.header_cache_update =NULL ; - p->dev.flags =IFF_NOARP |IFF_POINTOPOINT ; + p->dev->hard_header_cache =NULL ; + p->dev->header_cache_update =NULL ; + p->dev->flags =IFF_NOARP |IFF_POINTOPOINT ; } } }
@@ -3095,7 +3102,7 @@isdn_net_hangup (q); q = (((isdn_net_local *) q->priv)->slave); } -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev);return 0 ; }return -ENODEV ;
@@ -3123,13 +3130,13 @@isdn_unexclusive_channel (p->local->pre_device, p->local->pre_channel);if (p->local->master) {/* It's a slave-device, so update master's slave-pointer if necessary */ -if (((isdn_net_local *) (p->local->master->priv))->slave == &p->dev) +if (((isdn_net_local *) (p->local->master->priv))->slave == p->dev) ((isdn_net_local *) (p->local->master->priv))->slave = p->local->slave; }else {/* Unregister only if it's a master-device */ - p->dev.hard_header_cache = p->local->org_hhc; - p->dev.header_cache_update = p->local->org_hcu; -unregister_netdev (&p->dev); + p->dev->hard_header_cache = p->local->org_hhc; + p->dev->header_cache_update = p->local->org_hcu; +unregister_netdev (p->dev); }/* Unlink device from chain */ spin_lock_irqsave (&dev->lock, flags);
@@ -3157,7 +3164,7 @@/* If no more net-devices remain, disable auto-hangup timer */ if (dev->netdev ==NULL )isdn_timer_ctrl (ISDN_TIMER_NETHANGUP ,0 ); -kfree (p->local); +free_netdev (p->dev);kfree (p);return 0 ;
drivers/isdn/i4l/isdn_ppp.c +3 -3
@@ -360,7 +360,7 @@* isdn_ppp_free() sets is->lp to NULL and lp->ppp_slot to -1 * removing the IPPP_CONNECT flag omits calling of isdn_ppp_wakeup_daemon() */ -isdn_net_hangup (&p->dev); +isdn_net_hangup (p->dev); }for (i =0 ; i <NUM_RCV_BUFFS ; i++) {kfree (is->rq[i].buf);
@@ -531,7 +531,7 @@if (lp) {/* OK .. we are ready to send buffers */ is->pppcfg = val;/* isdn_ppp_xmit test for SC_ENABLE_IP !!! */ -netif_wake_queue (&lp->netdev->dev); +netif_wake_queue (lp->netdev->dev);break ; } }
@@ -1023,7 +1023,7 @@static void isdn_ppp_push_higher (isdn_net_dev * net_dev,isdn_net_local * lp,struct sk_buff *skb,int proto) { -struct net_device *dev = &net_dev->dev; +struct net_device *dev = net_dev->dev;struct ippp_struct *is, *mis;isdn_net_local *mlp =NULL ;int slot;
include/linux/isdn.h +1 -1
@@ -389,7 +389,7 @@online */ spinlock_t queue_lock;/* lock to protect queue */ void *next;/* Pointer to next isdn-interface */ -struct net_device dev;/* interface to upper levels */ +struct net_device *dev;/* interface to upper levels */ #ifdef CONFIG_ISDN_PPP ippp_bundle * pb;/* pointer to the common bundle structure * with the per-bundle data */
Signature · 4 lines
Karsten Keil SuSE Labs ISDN and VOIP development SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Quoted 8 lines · On Mon, 8 Oct 2007 13:48:44 +0200 Karsten Keil <[email protected]> wrote:
Quoted 6 lines · Andreas Mohr
[not necessarily a very recent regression, used 2.6.19 kernels before...]
Hi all,
wondered why my main internet server (headless!) didn't come up properly on a new 2.6.23-rc8-mm2
...
Quoted 10 lines
Quoted 3 lines
as if it's the
BUG_ON(!dev->nd_net);check which caused the BUG message.
The regression comes from the net namespace patches.
Up to now in ISDN the struct netdevice is contained in structisdn_net_devand so it's not allocated usingalloc_netdev(), which would set the missingdev->nd_netpointer.
Then ISDN is BROKEN in existing code. ALL network devices must be allocated by alloc_netdev() not the device driver otherwise there is no way to prevent oopsing through sysfs. RTFM Documentation/networking/netdevices.txt
Please fix for 2.6.23 and 2.6.22 stable.
Signature · 1 line
Stephen Hemminger <[email protected]>
David Miller
maintainerFrom: Karsten Keil <[email protected]>
Date: Mon, 8 Oct 2007 17:58:36 +0200
Quoted 19 lines · Andreas Mohr
Quoted 9 lines
Hi,
Quoted 1 line · Andreas Mohr
I thus decided to now try plain 2.6.23-rc8 whether it's "corrupted", too.
OK, after 3 hours of compilation the ONLY datapoint I can give right now is:
1 (one) boot on 2.6.23-rc8-mm2 had the BUG in/var/log/messages, 1 (one) boot on 2.6.23-rc8 did NOT have it.Quoted 8 lines
The two .config:s (I did a make oldconfig when going back to non-mm2) don't seem to have any relevant differences.
I could offer to do more testing on this machine,
but this carries a slight risk for me since I (personally) won't have physical access to it for a couple days and some people will kill me if the main internet gateway happened to go down unfixably. ;)
Quoted 4 lines
You could try following patch with 2.6.23-rc8-mm2, it change I4L to use
alloc_netdev().Signed-off-by Karsten Keil <[email protected]>
I've added this patch to net-2.6.24, thanks Karsten!
Hi,
Quoted 2 lines · Karsten Keil
You could try following patch with 2.6.23-rc8-mm2, it change I4L to use
alloc_netdev().
I just did the horribly unthinkable:
I rebooted the production internet gateway *remotely*, and:
root@gate:/home/andi# uname -a Linux gate 2.6.23-rc8-mm2-gate #1 Mon Oct 8 22:14:00 CEST 2007 i586 GNU/Linux root@gate:/home/andi# dmesg|grep BUG root@gate:/home/andi# grep BUG /var/log/messages Oct 7 13:07:40 gate kernel: kernel BUG at net/core/dev.c:3485! ^^^^^^^
This 2.6.23-rc8-mm2-gate was ISDN-patched, obviously. Oh, and isdnlog *is* indeed running, so this is a first check that ISDN functionality seems to be up and running...
IOW, thanks!!
Andreas Mohr
Signature · 2 lines
Want to provide valuable development feedback about your kernel version? Install http://klive.cpushare.com/ !
Hi Dave,
a follow up to the previous patch for net-2.6.24.
Quoted 7 lines · David Miller
Quoted 5 lines
You could try following patch with 2.6.23-rc8-mm2, it change I4L to use
alloc_netdev().Signed-off-by Karsten Keil <[email protected]>I've added this patch to net-2.6.24, thanks Karsten!
This is a followup to the previous ISDN alloc_netdev() patch. It removes the local copy of the device name to make sure that device renames work.
drivers/isdn/i4l/isdn_net.c +79 -65
@@ -328,7 +328,7 @@ isdn_net_autohup(void) l->cps = (l->transcount *HZ ) / (jiffies - last_jiffies); l->transcount =0 ;if (dev->net_verbose >3 ) -printk (KERN_DEBUG "%s: %d bogocps\n" , l->name, l->cps); +printk (KERN_DEBUG "%s: %d bogocps\n" , p->dev->name, l->cps);if ((l->flags &ISDN_NET_CONNECTED ) && (!l->dialstate)) { anymore =1 ; l->huptimer++;
@@ -350,12 +350,12 @@ isdn_net_autohup(void)if (l->hupflags &ISDN_CHARGEHUP ) {if (l->hupflags &ISDN_WAITCHARGE ) {printk (KERN_DEBUG "isdn_net: Hupflags of %s are %X\n" , - l->name, l->hupflags); + p->dev->name, l->hupflags);isdn_net_hangup (p->dev); }else if (time_after (jiffies, l->chargetime + l->chargeint)) {printk (KERN_DEBUG "isdn_net: %s: chtime = %lu, chint = %d\n" , - l->name, l->chargetime, l->chargeint); + p->dev->name, l->chargetime, l->chargeint);isdn_net_hangup (p->dev); } }else
@@ -442,8 +442,8 @@ isdn_net_stat_callback(int idx, isdn_ctr#endif isdn_net_lp_disconnected (lp);isdn_all_eaz (lp->isdn_device, lp->isdn_channel); -printk (KERN_INFO "%s: remote hangup\n" , lp->name); -printk (KERN_INFO "%s: Chargesum is %d\n" , lp->name, +printk (KERN_INFO "%s: remote hangup\n" , p->dev->name); +printk (KERN_INFO "%s: Chargesum is %d\n" , p->dev->name, lp->charge);isdn_net_unbind_channel (lp);return 1 ;
@@ -487,7 +487,7 @@ isdn_net_stat_callback(int idx, isdn_ctrisdn_net_add_to_bundle (nd, lp); } } -printk (KERN_INFO "isdn_net: %s connected\n" , lp->name); +printk (KERN_INFO "isdn_net: %s connected\n" , p->dev->name);/* If first Chargeinfo comes before B-Channel connect, * we correct the timestamp here. */
@@ -534,7 +534,7 @@ isdn_net_stat_callback(int idx, isdn_ctr lp->hupflags |=ISDN_HAVECHARGE ; lp->chargetime = jiffies;printk (KERN_DEBUG "isdn_net: Got CINF chargetime of %s now %lu\n" , - lp->name, lp->chargetime); + p->dev->name, lp->chargetime);return 1 ; } }
@@ -565,7 +565,7 @@ isdn_net_dial(void)#ifdef ISDN_DEBUG_NET_DIAL if (lp->dialstate) -printk (KERN_DEBUG "%s: dialstate=%d\n" , lp->name, lp->dialstate); +printk (KERN_DEBUG "%s: dialstate=%d\n" , p->dev->name, lp->dialstate);#endif switch (lp->dialstate) {case 0 :
@@ -578,7 +578,7 @@ isdn_net_dial(void) lp->dial = lp->phone[1 ];if (!lp->dial) {printk (KERN_WARNING "%s: phone number deleted?\n" , - lp->name); + p->dev->name);isdn_net_hangup (p->dev);break ; }
@@ -632,13 +632,13 @@ isdn_net_dial(void) cmd.arg = lp->isdn_channel;if (!lp->dial) {printk (KERN_WARNING "%s: phone number deleted?\n" , - lp->name); + p->dev->name);isdn_net_hangup (p->dev);break ; }if (!strncmp (lp->dial->num,"LEASED" ,strlen ("LEASED" ))) { lp->dialstate =4 ; -printk (KERN_INFO "%s: Open leased line ...\n" , lp->name); +printk (KERN_INFO "%s: Open leased line ...\n" , p->dev->name); }else {if (lp->dialtimeout >0 )if (time_after (jiffies, lp->dialstarted + lp->dialtimeout)) {
@@ -688,7 +688,7 @@ isdn_net_dial(void) dev->usage[i] |=ISDN_USAGE_OUTGOING ;isdn_info_update (); } -printk (KERN_INFO "%s: dialing %d %s... %s\n" , lp->name, +printk (KERN_INFO "%s: dialing %d %s... %s\n" , p->dev->name, lp->dialretry, cmd.parm.setup.phone, (cmd.parm.setup.si1 ==1 ) ?"DOV" :"" ); lp->dtimer =0 ;
@@ -797,7 +797,7 @@ isdn_net_dial(void)*/ if (lp->dtimer++ > lp->cbdelay) { -printk (KERN_INFO "%s: hangup waiting for callback ...\n" , lp->name); +printk (KERN_INFO "%s: hangup waiting for callback ...\n" , p->dev->name); lp->dtimer =0 ; lp->dialstate =4 ; cmd.driver = lp->isdn_device;
@@ -810,7 +810,7 @@ isdn_net_dial(void)break ;default :printk (KERN_WARNING "isdn_net: Illegal dialstate %d for device %s\n" , - lp->dialstate, lp->name); + lp->dialstate, p->dev->name); } p = (isdn_net_dev *) p->next; }
@@ -836,11 +836,11 @@ isdn_net_hangup(struct net_device *d)if (slp->flags &ISDN_NET_CONNECTED ) {printk (KERN_INFO "isdn_net: hang up slave %s before %s\n" , - slp->name, lp->name); + lp->slave->name, d->name);isdn_net_hangup (lp->slave); } } -printk (KERN_INFO "isdn_net: local hangup %s\n" , lp->name); +printk (KERN_INFO "isdn_net: local hangup %s\n" , d->name);#ifdef CONFIG_ISDN_PPP if (lp->p_encap ==ISDN_NET_ENCAP_SYNCPPP )isdn_ppp_free (lp);
@@ -858,7 +858,7 @@ isdn_net_hangup(struct net_device *d) cmd.command =ISDN_CMD_HANGUP ; cmd.arg = lp->isdn_channel;isdn_command (&cmd); -printk (KERN_INFO "%s: Chargesum is %d\n" , lp->name, lp->charge); +printk (KERN_INFO "%s: Chargesum is %d\n" , d->name, lp->charge);isdn_all_eaz (lp->isdn_device, lp->isdn_channel); }isdn_net_unbind_channel (lp);
@@ -885,7 +885,7 @@ isdn_net_log_skb(struct sk_buff * skb, i/* fall back to old isdn_net_log_packet method() */ char * buf = skb->data; -printk (KERN_DEBUG "isdn_net: protocol %04x is buggy, dev %s\n" , skb->protocol, lp->name); +printk (KERN_DEBUG "isdn_net: protocol %04x is buggy, dev %s\n" , skb->protocol, lp->netdev->dev->name); p = buf; proto =ETH_P_IP ;switch (lp->p_encap) {
@@ -1023,7 +1023,7 @@ void isdn_net_writebuf_skb(isdn_net_loca ret =isdn_writebuf_skb_stub (lp->isdn_device, lp->isdn_channel,1 , skb);if (ret != len) {/* we should never get here */ -printk (KERN_WARNING "%s: HL driver queue full\n" , lp->name); +printk (KERN_WARNING "%s: HL driver queue full\n" , lp->netdev->dev->name); goto error; }
@@ -1461,7 +1461,7 @@ isdn_ciscohdlck_dev_ioctl(struct net_devmod_timer (&lp->cisco_timer, expires);printk (KERN_INFO "%s: Keepalive period set " "to %d seconds.\n" , - lp->name, lp->cisco_keepalive_period); + dev->name, lp->cisco_keepalive_period); }break ;
@@ -1512,7 +1512,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive lp->cisco_line_state =0 ;printk (KERN_WARNING "UPDOWN: Line protocol on Interface %s," -" changed state to down\n" , lp->name); +" changed state to down\n" , lp->netdev->dev->name);/* should stop routing higher-level data accross */ }else if ((!lp->cisco_line_state) && (myseq_diff >=0 ) && (myseq_diff <=2 )) {
@@ -1520,14 +1520,14 @@ isdn_net_ciscohdlck_slarp_send_keepalive lp->cisco_line_state =1 ;printk (KERN_WARNING "UPDOWN: Line protocol on Interface %s," -" changed state to up\n" , lp->name); +" changed state to up\n" , lp->netdev->dev->name);/* restart routing higher-level data accross */ }if (lp->cisco_debserint)printk (KERN_DEBUG "%s: HDLC " "myseq %lu, mineseen %lu%c, yourseen %lu, %s\n" , - lp->name, last_cisco_myseq, lp->cisco_mineseen, + lp->netdev->dev->name, last_cisco_myseq, lp->cisco_mineseen, ((last_cisco_myseq == lp->cisco_mineseen) ?'*' :040 ), lp->cisco_yourseq, ((lp->cisco_line_state) ?"line up" :"line down" ));
@@ -1682,7 +1682,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_lo"remote ip: %d.%d.%d.%d, " "local ip: %d.%d.%d.%d " "mask: %d.%d.%d.%d\n" , - lp->name, + lp->netdev->dev->name,HIPQUAD (addr),HIPQUAD (local), HIPQUAD(mask));
@@ -1690,7 +1690,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_lo slarp_reply_out:printk (KERN_INFO "%s: got invalid slarp " "reply (%d.%d.%d.%d/%d.%d.%d.%d) " -"- ignored\n" , lp->name, +"- ignored\n" , lp->netdev->dev->name,HIPQUAD (addr),HIPQUAD (mask));break ;case CISCO_SLARP_KEEPALIVE :
@@ -1701,7 +1701,8 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_lo lp->cisco_last_slarp_in) {printk (KERN_DEBUG "%s: Keepalive period mismatch - " "is %d but should be %d.\n" , - lp->name, period, lp->cisco_keepalive_period); + lp->netdev->dev->name, period, + lp->cisco_keepalive_period); } lp->cisco_last_slarp_in = jiffies; p +=get_u32 (p, &my_seq);
@@ -1732,12 +1733,12 @@ isdn_net_ciscohdlck_receive(isdn_net_locif (addr !=CISCO_ADDR_UNICAST && addr !=CISCO_ADDR_BROADCAST ) {printk (KERN_WARNING "%s: Unknown Cisco addr 0x%02x\n" , - lp->name, addr); + lp->netdev->dev->name, addr); goto out_free; }if (ctrl !=CISCO_CTRL ) {printk (KERN_WARNING "%s: Unknown Cisco ctrl 0x%02x\n" , - lp->name, ctrl); + lp->netdev->dev->name, ctrl); goto out_free; }
@@ -1748,7 +1749,8 @@ isdn_net_ciscohdlck_receive(isdn_net_loccase CISCO_TYPE_CDP :if (lp->cisco_debserint)printk (KERN_DEBUG "%s: Received CDP packet. use " -"\"no cdp enable\" on cisco.\n" , lp->name); +"\"no cdp enable\" on cisco.\n" , + lp->netdev->dev->name); goto out_free;default :/* no special cisco protocol */
@@ -1843,7 +1845,7 @@ isdn_net_receive(struct net_device *ndev };#endif /* CONFIG_ISDN_X25 */ printk (KERN_WARNING "%s: unknown encapsulation, dropping\n" , - lp->name); + lp->netdev->dev->name);kfree_skb (skb);return ; }
@@ -2198,7 +2200,7 @@ isdn_net_find_icall(int di, int ch, int wret = matchret;#ifdef ISDN_DEBUG_NET_ICALL printk (KERN_DEBUG "n_fi: if='%s', l.msn=%s, l.flags=%d, l.dstate=%d\n" , - lp->name, lp->msn, lp->flags, lp->dialstate); + p->dev->name, lp->msn, lp->flags, lp->dialstate);#endif if ((!matchret) && /* EAZ is matching */ (((!(lp->flags & ISDN_NET_CONNECTED)) && /* but not connected */
@@ -2301,7 +2303,7 @@ isdn_net_find_icall(int di, int ch, int* */ if (ISDN_NET_DIALMODE (*lp) ==ISDN_NET_DM_OFF ) {printk (KERN_INFO "incoming call, interface %s `stopped' -> rejected\n" , - lp->name); + p->dev->name);return 3 ; }/*
@@ -2310,7 +2312,7 @@ isdn_net_find_icall(int di, int ch, int*/ if (!isdn_net_device_started (p)) {printk (KERN_INFO "%s: incoming call, interface down -> rejected\n" , - lp->name); + p->dev->name);return 3 ; }/* Interface is up, now see if it's a slave. If so, see if
@@ -2318,8 +2320,8 @@ isdn_net_find_icall(int di, int ch, int*/ if (lp->master) {isdn_net_local *mlp = (isdn_net_local *) lp->master->priv; -printk (KERN_DEBUG "ICALLslv: %s\n" , lp->name); -printk (KERN_DEBUG "master=%s\n" , mlp->name); +printk (KERN_DEBUG "ICALLslv: %s\n" , p->dev->name); +printk (KERN_DEBUG "master=%s\n" , lp->master->name);if (mlp->flags &ISDN_NET_CONNECTED ) {printk (KERN_DEBUG "master online\n" );/* Master is online, find parent-slave (master if first slave) */
@@ -2346,11 +2348,11 @@ isdn_net_find_icall(int di, int ch, int* */ if (ISDN_NET_DIALMODE (*lp) ==ISDN_NET_DM_OFF ) {printk (KERN_INFO "incoming call for callback, interface %s `off' -> rejected\n" , - lp->name); + p->dev->name);return 3 ; }printk (KERN_DEBUG "%s: call from %s -> %s, start callback\n" , - lp->name, nr, eaz); + p->dev->name, nr, eaz);if (lp->phone[1 ]) {/* Grab a free ISDN-Channel */ spin_lock_irqsave (&dev->lock, flags);
@@ -2364,7 +2366,8 @@ isdn_net_find_icall(int di, int ch, int lp->msn) ) < 0) { -printk (KERN_WARNING "isdn_net_find_icall: No channel for %s\n" , lp->name); +printk (KERN_WARNING "isdn_net_find_icall: No channel for %s\n" , + p->dev->name);spin_unlock_irqrestore (&dev->lock, flags);return 0 ; }
@@ -2385,11 +2388,12 @@ isdn_net_find_icall(int di, int ch, int/* Initiate dialing by returning 2 or 4 */ return (lp->flags &ISDN_NET_CBHUP ) ?2 :4 ; }else -printk (KERN_WARNING "isdn_net: %s: No phone number\n" , lp->name); +printk (KERN_WARNING "isdn_net: %s: No phone number\n" , + p->dev->name);return 0 ; }else { -printk (KERN_DEBUG "%s: call from %s -> %s accepted\n" , lp->name, nr, - eaz); +printk (KERN_DEBUG "%s: call from %s -> %s accepted\n" , + p->dev->name, nr, eaz);/* if this interface is dialing, it does it probably on a different device, so free this device */ if ((lp->dialstate ==4 ) || (lp->dialstate ==12 )) {
@@ -2448,7 +2452,7 @@ isdn_net_findif(char *name)isdn_net_dev *p = dev->netdev;while (p) { -if (!strcmp (p->local->name, name)) +if (!strcmp (p->dev->name, name))return p; p = (isdn_net_dev *) p->next; }
@@ -2477,7 +2481,8 @@ isdn_net_force_dial_lp(isdn_net_local * lp->pre_device, lp->pre_channel, lp->msn)) < 0) { -printk (KERN_WARNING "isdn_net_force_dial: No channel for %s\n" , lp->name); +printk (KERN_WARNING "isdn_net_force_dial: No channel for %s\n" , + lp->netdev->dev->name);spin_unlock_irqrestore (&dev->lock, flags);return -EAGAIN ; }
@@ -2580,7 +2585,7 @@ isdn_net_new(char *name, struct net_devireturn NULL ; }if (name ==NULL ) - name =" " ; +return NULL ;if (!(netdev =kzalloc (sizeof (isdn_net_dev),GFP_KERNEL ))) {printk (KERN_WARNING "isdn_net: Could not allocate net-device\n" );return NULL ;
@@ -2592,7 +2597,6 @@ isdn_net_new(char *name, struct net_devireturn NULL ; } netdev->local = netdev->dev->priv; -strcpy (netdev->local->name, netdev->dev->name); netdev->dev->init = isdn_net_init;if (master) {/* Device shall be a slave */
@@ -2697,7 +2701,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg#endif if (isdn_net_device_started (p)) {printk (KERN_WARNING "%s: cannot change encap when if is up\n" , - lp->name); + p->dev->name);return -EBUSY ; }#ifdef CONFIG_ISDN_X25
@@ -2722,7 +2726,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfgcase ISDN_NET_ENCAP_SYNCPPP :#ifndef CONFIG_ISDN_PPP printk (KERN_WARNING "%s: SyncPPP support not configured\n" , - lp->name); + p->dev->name);return -EINVAL ;#else p->dev->type =ARPHRD_PPP ;/* change ARP type */
@@ -2749,7 +2753,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfgbreak ;printk (KERN_WARNING "%s: encapsulation protocol %d not supported\n" , - p->local->name, cfg->p_encap); + p->dev->name, cfg->p_encap);return -EINVAL ; }if (strlen (cfg->drvid)) {
@@ -2933,13 +2937,18 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg cfg->pppbind = lp->pppbind; cfg->dialtimeout = lp->dialtimeout >=0 ? lp->dialtimeout /HZ :-1 ; cfg->dialwait = lp->dialwait /HZ ; -if (lp->slave) -strcpy (cfg->slave, ((isdn_net_local *) lp->slave->priv)->name); -else +if (lp->slave) { +if (strlen (lp->slave->name) >8 ) +strcpy (cfg->slave,"too-long" ); +else +strcpy (cfg->slave, lp->slave->name); + }else cfg->slave[0 ] ='\0' ; -if (lp->master) -strcpy (cfg->master, ((isdn_net_local *) lp->master->priv)->name); -else +if (lp->master) { +if (strlen (lp->master->name) >8 ) +strcpy (cfg->master,"too-long" ); +strcpy (cfg->master, lp->master->name); + }else cfg->master[0 ] ='\0' ;return 0 ; }
@@ -3009,7 +3018,8 @@ isdn_net_getpeer(isdn_net_ioctl_phone *pisdn_net_dev *p =isdn_net_findif (phone->name);int ch, dv, idx; -if (!p)return -ENODEV ; +if (!p) +return -ENODEV ;/* * Theoretical race: while this executes, the remote number might * become invalid (hang up) or change (new connection), resulting
@@ -3018,14 +3028,18 @@ isdn_net_getpeer(isdn_net_ioctl_phone *p*/ ch = p->local->isdn_channel; dv = p->local->isdn_device; -if (ch<0 && dv<0 )return -ENOTCONN ; +if (ch <0 && dv <0 ) +return -ENOTCONN ; idx =isdn_dc2minor (dv, ch); -if (idx<0 )return -ENODEV ; +if (idx <0 ) +return -ENODEV ;/* for pre-bound channels, we need this extra check */ -if (strncmp (dev->num[idx],"???" ,3 ) ==0 )return -ENOTCONN ; -strncpy (phone->phone,dev->num[idx],ISDN_MSNLEN ); - phone->outgoing=USG_OUTGOING (dev->usage[idx]); -if (copy_to_user (peer,phone,sizeof (*peer)) )return -EFAULT ; +if (strncmp (dev->num[idx],"???" ,3 ) ==0 ) +return -ENOTCONN ; +strncpy (phone->phone, dev->num[idx],ISDN_MSNLEN ); + phone->outgoing =USG_OUTGOING (dev->usage[idx]); +if (copy_to_user (peer, phone,sizeof (*peer))) +return -EFAULT ;return 0 ; }/*
@@ -3146,18 +3160,18 @@ isdn_net_realrm(isdn_net_dev * p, isdn_n dev->netdev = p->next;if (p->local->slave) {/* If this interface has a slave, remove it also */ -char *slavename = ((isdn_net_local *) (p->local->slave->priv))->name; +char *slavename = p->local->slave->name;isdn_net_dev *n = dev->netdev; q =NULL ;while (n) { -if (!strcmp (n->local->name, slavename)) { +if (!strcmp (n->dev->name, slavename)) {spin_unlock_irqrestore (&dev->lock, flags);isdn_net_realrm (n, q);spin_lock_irqsave (&dev->lock, flags);break ; } q = n; - n = (isdn_net_dev *) n->next; + n = (isdn_net_dev *)n->next; } }spin_unlock_irqrestore (&dev->lock, flags);
@@ -3185,7 +3199,7 @@ isdn_net_rm(char *name) p = dev->netdev; q =NULL ;while (p) { -if (!strcmp (p->local->name, name)) { +if (!strcmp (p->dev->name, name)) {spin_unlock_irqrestore (&dev->lock, flags);return (isdn_net_realrm (p, q)); }
drivers/isdn/i4l/isdn_ppp.c +6 -3
@@ -190,9 +190,11 @@ isdn_ppp_bind(isdn_net_local * lp) retval =-1 ; goto out; } - unit =isdn_ppp_if_get_unit (lp->name);/* get unit number from interface name .. ugly! */ +/* get unit number from interface name .. ugly! */ + unit =isdn_ppp_if_get_unit (lp->netdev->dev->name);if (unit <0 ) { -printk (KERN_ERR "isdn_ppp_bind: illegal interface name %s.\n" , lp->name); +printk (KERN_ERR "isdn_ppp_bind: illegal interface name %s.\n" , + lp->netdev->dev->name); retval =-1 ; goto out; }
@@ -507,7 +509,8 @@ isdn_ppp_ioctl(int min, struct file *filcase PPPIOCGIFNAME :if (!lp)return -EINVAL ; -if ((r =set_arg (argp, lp->name,strlen (lp->name)))) +if ((r =set_arg (argp, lp->netdev->dev->name, +strlen (lp->netdev->dev->name))))return r;break ;case PPPIOCGMPFLAGS :/* get configuration flags */
include/linux/isdn.h +0 -1
@@ -286,7 +286,6 @@ typedef struct {/* Local interface-data */ typedef struct isdn_net_local_s { ulong magic; - char name[10]; /* Name of device */ struct net_device_stats stats; /* Ethernet Statistics */ int isdn_device; /* Index to isdn-device */ int isdn_channel; /* Index to isdn-channel */
Signature · 4 lines
Karsten Keil SuSE Labs ISDN and VOIP development SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)
From: Karsten Keil <[email protected]>
Date: Fri, 12 Oct 2007 16:05:22 +0200
Quoted 5 lines
This is a followup to the previous ISDN
alloc_netdev()patch. It removes the local copy of the device name to make sure that device renames work.Signed-off-by Karsten Keil <[email protected]>
Applied, thanks!