[svn-commits] trunk r1053 - in /trunk: zaptel.c zaptel.conf.sample zaptel.h ztcfg.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu May 11 15:50:08 MST 2006


Author: tilghman
Date: Thu May 11 17:50:08 2006
New Revision: 1053

URL: http://svn.digium.com/view/zaptel?rev=1053&view=rev
Log:
Bug 6816 - Allow nethdlc device to take optional alternative name

Modified:
    trunk/zaptel.c
    trunk/zaptel.conf.sample
    trunk/zaptel.h
    trunk/ztcfg.c

Modified: trunk/zaptel.c
URL: http://svn.digium.com/view/zaptel/trunk/zaptel.c?rev=1053&r1=1052&r2=1053&view=diff
==============================================================================
--- trunk/zaptel.c (original)
+++ trunk/zaptel.c Thu May 11 17:50:08 2006
@@ -1320,6 +1320,26 @@
 #endif
 	return 0;
 }
+
+#ifdef LINUX26
+static int zt_register_hdlc_device(struct net_device *dev, const char *dev_name)
+{
+	int result;
+
+	if (dev_name && *dev_name) {
+		if ((result = dev_alloc_name(dev, dev_name)) < 0)
+			return result;
+	}
+	result = register_netdev(dev);
+	if (result != 0)
+		return -EIO;
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,14)
+	if (netif_carrier_ok(dev))
+		netif_carrier_off(dev); /* no carrier until DCD goes up */
+#endif
+	return 0;
+}
+#endif
 
 #ifdef NEW_HDLC_INTERFACE
 static int zt_net_stop(struct net_device *dev)
@@ -3345,7 +3365,7 @@
 					dev_to_hdlc(chans[ch.chan]->hdlcnetdev->netdev)->xmit = zt_xmit;
 					spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
 					/* Briefly restore interrupts while we register the device */
-					res = register_hdlc_device(chans[ch.chan]->hdlcnetdev->netdev);
+					res = zt_register_hdlc_device(chans[ch.chan]->hdlcnetdev->netdev, ch.netdev_name);
 					spin_lock_irqsave(&chans[ch.chan]->lock, flags);
 				} else {
 					printk("Unable to allocate hdlc: *shrug*\n");

Modified: trunk/zaptel.conf.sample
URL: http://svn.digium.com/view/zaptel/trunk/zaptel.conf.sample?rev=1053&r1=1052&r2=1053&view=diff
==============================================================================
--- trunk/zaptel.conf.sample (original)
+++ trunk/zaptel.conf.sample Thu May 11 17:50:08 2006
@@ -105,7 +105,13 @@
 #             hardware.
 # "nethdlc" : The zaptel driver bundles the channels together into an
 #             hdlc network device, which in turn can be configured with
-#             sethdlc (available separately).
+#             sethdlc (available separately). In 2.6.x kernels you can also optionally
+#             pass the name for the network interface after the channel list.
+#             Syntax:
+#               nethdlc=<channel list>[:interface name]
+#             Use original names, don't use the names which have been already registered 
+#             in system e.g eth.
+#
 # "dacs"    : The zaptel driver cross connects the channels starting at
 #             the channel number listed at the end, after a colon
 # "dacsrbs" : The zaptel driver cross connects the channels starting at

Modified: trunk/zaptel.h
URL: http://svn.digium.com/view/zaptel/trunk/zaptel.h?rev=1053&r1=1052&r2=1053&view=diff
==============================================================================
--- trunk/zaptel.h (original)
+++ trunk/zaptel.h Thu May 11 17:50:08 2006
@@ -239,6 +239,7 @@
 int	master;		/* Master channel if sigtype is ZT_SLAVE */
 int	idlebits;	/* Idle bits (if this is a CAS channel) or
 			   channel to monitor (if this is DACS channel) */
+char netdev_name[16]; /*name for the hdlc network device*/
 } ZT_CHANCONFIG;
 
 typedef struct zt_sfconfig

Modified: trunk/ztcfg.c
URL: http://svn.digium.com/view/zaptel/trunk/ztcfg.c?rev=1053&r1=1052&r2=1053&view=diff
==============================================================================
--- trunk/ztcfg.c (original)
+++ trunk/ztcfg.c Thu May 11 17:50:08 2006
@@ -552,11 +552,15 @@
 				}
 			} else if (!strcasecmp(keyword, "nethdlc")) {
 				sig[x] = sigtype_to_str(ZT_SIG_HDLCNET);
+				memset(cc[x].netdev_name, 0, sizeof(cc[x].netdev_name));
 				if (master) {
 					cc[x].sigtype = ZT_SIG_SLAVE;
 					cc[x].master = master;
 				} else {
 					cc[x].sigtype = ZT_SIG_HDLCNET;
+					if (idle) {
+					    strncpy(cc[x].netdev_name, idle, sizeof(cc[x].netdev_name) - 1);
+					}
 					master = x;
 				}
 			} else if (!strcasecmp(keyword, "fcshdlc")) {



More information about the svn-commits mailing list