Ilia K
ee5e81f000
add vif using local interface index instead of IP
...
When routing daemon wants to enable forwarding of multicast traffic it
performs something like:
struct vifctl vc = {
.vifc_vifi = 1,
.vifc_flags = 0,
.vifc_threshold = 1,
.vifc_rate_limit = 0,
.vifc_lcl_addr = ip, /* <--- ip address of physical
interface, e.g. eth0 */
.vifc_rmt_addr.s_addr = htonl(INADDR_ANY),
};
setsockopt(fd, IPPROTO_IP, MRT_ADD_VIF, &vc, sizeof(vc));
This leads (in the kernel) to calling vif_add() function call which
search the (physical) device using assigned IP address:
dev = ip_dev_find(net, vifc->vifc_lcl_addr.s_addr);
The current API (struct vifctl) does not allow to specify an
interface other way than using it's IP, and if there are more than a
single interface with specified IP only the first one will be found.
The attached patch (against 2.6.30.4) allows to specify an interface
by its index, instead of IP address:
struct vifctl vc = {
.vifc_vifi = 1,
.vifc_flags = VIFF_USE_IFINDEX, /* NEW */
.vifc_threshold = 1,
.vifc_rate_limit = 0,
.vifc_lcl_ifindex = if_nametoindex("eth0"), /* NEW */
.vifc_rmt_addr.s_addr = htonl(INADDR_ANY),
};
setsockopt(fd, IPPROTO_IP, MRT_ADD_VIF, &vc, sizeof(vc));
Signed-off-by: Ilia K. <mail4ilia@gmail.com >
=== modified file 'include/linux/mroute.h'
Signed-off-by: David S. Miller <davem@davemloft.net >
2009-10-07 00:48:41 -07:00
..
2009-09-22 20:49:04 +01:00
2009-09-19 00:51:34 -03:00
2009-09-23 15:39:36 -07:00
2009-09-22 07:54:33 -07:00
2009-09-26 10:50:47 -07:00
2009-09-23 07:39:38 -07:00
2009-09-20 05:55:36 -07:00
2009-09-23 07:39:29 -07:00
2009-09-22 13:32:45 +01:00
2009-09-26 10:49:42 -07:00
2009-09-23 14:36:38 -04:00
2009-09-24 07:21:05 -07:00
2009-10-05 00:43:33 -07:00
2009-09-19 02:14:45 -04:00
2009-09-27 11:39:25 -07:00
2009-09-20 16:09:20 +05:30
2009-09-23 07:39:29 -07:00
2009-09-30 16:12:20 -07:00
2009-09-26 00:10:40 +02:00
2009-09-21 21:03:58 +01:00
2009-09-24 07:21:01 -07:00
2009-10-03 20:52:01 +02:00
2009-10-01 21:19:34 +02:00
2009-09-22 07:17:38 -07:00
2009-09-21 15:14:51 +02:00
2009-10-01 16:11:11 -07:00
2009-09-23 07:39:29 -07:00
2009-09-24 07:20:57 -07:00
2009-10-02 10:54:05 -07:00
2009-09-24 09:34:53 +09:30
2009-09-23 11:01:25 -07:00
2009-09-19 13:13:31 -07:00
2009-09-24 07:20:57 -07:00
2009-09-18 09:48:52 -07:00
2009-09-19 12:50:38 -07:00
2009-10-05 00:10:11 -07:00
2009-09-23 07:39:29 -07:00
2009-09-22 07:17:47 -07:00
2009-10-04 12:39:14 -07:00
2009-09-18 07:25:44 +02:00
2009-09-24 07:21:04 -07:00
2009-09-24 07:21:04 -07:00
2009-10-04 21:04:38 +02:00
2009-09-23 07:39:29 -07:00
2009-09-23 07:39:46 -07:00
2009-09-19 13:13:31 -07:00
2009-09-27 11:39:25 -07:00
2009-09-19 00:16:14 -03:00
2009-09-18 22:45:43 +02:00
2009-09-17 23:23:45 -07:00
2009-10-05 00:21:55 -07:00
2009-09-26 20:28:07 -07:00
2009-09-21 14:28:04 +02:00
2009-09-17 23:23:58 -07:00
2009-09-24 09:34:38 +09:30
2009-09-23 07:39:41 -07:00
2009-09-26 10:17:19 -07:00
2009-09-30 00:32:06 -04:00
2009-09-23 07:39:58 -07:00
2009-09-23 07:39:30 -07:00
2009-09-19 13:13:17 -07:00
2009-09-23 07:39:29 -07:00
2009-09-26 10:17:19 -07:00
2009-09-22 07:17:33 -07:00
2009-09-18 21:22:08 +02:00
2009-09-17 23:23:45 -07:00
2009-09-21 06:27:08 +02:00
2009-09-22 07:17:48 -07:00
2009-09-23 07:39:42 -07:00
2009-09-24 07:20:59 -07:00
2009-09-23 07:39:41 -07:00
2009-09-22 07:17:35 -07:00
2009-09-19 12:50:38 -07:00
2009-09-21 15:14:56 +02:00
2009-09-22 07:17:37 -07:00
2009-09-27 11:39:25 -07:00
2009-09-24 17:20:20 -07:00
2009-09-22 07:17:42 -07:00
2009-09-22 07:17:31 -07:00
2009-09-24 07:21:04 -07:00
2009-09-23 07:39:43 -07:00
2009-09-25 00:32:58 +09:30
2009-09-30 16:12:20 -07:00
2009-10-07 00:48:41 -07:00
2009-09-21 15:14:51 +02:00
2009-09-30 16:12:20 -07:00
2009-09-30 16:12:20 -07:00
2009-09-24 15:44:05 -07:00
2009-09-22 07:54:33 -07:00
2009-09-26 10:17:19 -07:00
2009-10-05 00:43:34 -07:00
2009-09-22 07:17:38 -07:00
2009-09-24 07:20:58 -07:00
2009-09-24 07:53:22 -07:00
2009-09-24 07:55:29 -07:00
2009-09-22 15:42:01 +02:00
2009-09-22 15:42:01 +02:00
2009-09-24 15:38:57 -07:00
2009-09-22 07:17:49 -07:00
2009-09-22 07:17:47 -07:00
2009-10-04 15:05:10 -07:00
2009-09-24 07:53:22 -07:00
2009-09-23 07:39:41 -07:00
2009-09-22 07:17:24 -07:00
2009-09-27 11:39:25 -07:00
2009-09-19 08:53:22 +02:00
2009-09-19 08:53:22 +02:00
2009-09-19 08:53:22 +02:00
2009-09-24 07:20:57 -07:00
2009-10-01 16:11:13 -07:00
2009-09-24 07:53:22 -07:00
2009-09-24 07:53:22 -07:00
2009-09-24 07:21:04 -07:00
2009-09-24 07:47:35 -04:00
2009-09-19 13:13:19 -07:00
2009-09-30 21:46:59 +02:00
2009-09-19 13:13:30 -07:00
2009-09-24 07:21:01 -07:00
2009-09-24 09:34:40 +09:30
2009-10-05 00:24:36 -07:00
2009-09-24 07:53:22 -07:00
2009-09-23 09:21:05 -07:00
2009-09-24 07:21:04 -07:00
2009-09-18 09:48:52 -07:00
2009-09-24 07:20:56 -07:00
2009-09-24 09:34:41 +09:30
2009-09-24 07:21:00 -07:00
2009-09-24 07:20:57 -07:00
2009-09-27 13:35:16 -07:00
2009-09-19 13:13:35 -07:00
2009-09-23 07:39:48 -07:00
2009-09-23 06:46:23 -07:00
2009-09-23 06:46:39 -07:00
2009-09-23 18:13:10 -07:00
2009-09-24 09:57:08 -07:00
2009-09-19 00:18:36 -03:00
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:36 +09:30
2009-09-23 07:39:29 -07:00
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:32 +09:30
2009-09-23 22:26:31 +09:30
2009-09-22 07:17:30 -07:00
2009-09-19 13:13:25 -07:00
2009-09-19 13:13:26 -07:00
2009-09-23 03:49:27 +04:00
2009-09-21 15:14:53 +02:00
2009-09-24 07:21:04 -07:00