Package: ser2net
Version: 2.9.1-1
Severity: wishlist
Tags: patch

Hi,

ser2net uses : as field separator in ser2net.conf. Udev creates by-path and
by-id paths to identify unique serial ports. These paths are highly
useful as ttyUSB* might end up shuffling around.

But the by-path symlink has always a : in the filename, and by-id might:

# arndale
7001:telnet:0:'/dev/serial/by-path/pci-0000:00:1d.0-usb-0:1.8.4.2:1.0-port0':115200
8DATABITS NONE 1STOPBIT

In this case the by-id doesn't, but it illustrates that the name comes
from the device and can have anything in the name. 

The attached patch adds quoting to ser2net device name:

--- x/ser2net-2.9.1/readconfig.c        2013-07-24 19:04:39.000000000 +0300
+++ ser2net-2.9.1/readconfig.c  2015-10-26 09:55:53.973462321 +0200
@@ -379,7 +379,14 @@
        return;
     }
 
-    devname = strtok_r(NULL, ":", &strtok_data);
+    if (strtok_data[0] == '\'') {
+        /* device name may contains character ':'
+         eg. 
2003:raw:5:'/dev/serial/by-path/pci-0000:00:1d.1-usb-0:2.1:1.0-port0':9600 */
+        devname = strtok_r(NULL, "'", &strtok_data);
+    }
+    else {
+        devname = strtok_r(NULL, ":", &strtok_data);
+    }
     if (devname == NULL) {
        syslog(LOG_ERR, "No device name given on line %d", lineno);
        return;


origin of patch:

https://github.com/Lingku/mser2net/commit/e36aa4b12d896e056c13759105ee9380c1f20fbe

Github seems to carry severaly useful forks of ser2net, all in having
useful features yet not beeing very actively maintained :(

https://github.com/longshine/ser2nets
https://github.com/Lingku/mser2net

Riku

Reply via email to