Hi,

Attached is a patch that allows users to specify which TAP device to use
for networking.

The patch adds support for an optional rpc.cfg entry called tap_device.
EG:
tap_device=rpcemu0

If this option is not specified, then the next available TAP device is
used, as in the current implementation.

James

Index: rpcemu.c
===================================================================
--- rpcemu.c	(revision 137)
+++ rpcemu.c	(working copy)
@@ -39,6 +39,7 @@
 int timetolive = 0;
 const char *username = NULL;
 const char *ipaddress = NULL;
+const char *tap_device = NULL;
 
 void loadconfig();
 void saveconfig();
@@ -188,6 +189,7 @@
         mousehackon=get_config_int(NULL,"mouse_following",1);
         username=get_config_string(NULL,"username",NULL);
         ipaddress=get_config_string(NULL,"ipaddress",NULL);
+        tap_device=get_config_string(NULL,"tap_device",NULL);
 }
 
 void saveconfig()
Index: network-linux.c
===================================================================
--- network-linux.c	(revision 137)
+++ network-linux.c	(working copy)
@@ -103,6 +103,10 @@
     
     memset(&ifr, 0, sizeof(ifr));
     ifr.ifr_flags = IFF_TAP; 
+    if (tap_device) {
+        strncpy(ifr.ifr_name, tap_device, IFNAMSIZ);
+    }
+
     
     if (ioctl(fd, TUNSETIFF, &ifr) < 0) {
         printf("Error setting TAP on tunnel device: %s\n", strerror(errno));
Index: rpcemu.h
===================================================================
--- rpcemu.h	(revision 137)
+++ rpcemu.h	(working copy)
@@ -111,6 +111,7 @@
 extern int stretchmode;
 extern const char *username;
 extern const char *ipaddress;
+extern const char *tap_device;
 
 extern uint32_t soundaddr[4];
 
_______________________________________________
Rpcemu mailing list
[email protected]
http://www.riscos.info/cgi-bin/mailman/listinfo/rpcemu

Reply via email to