netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add vif using local interface index (was Re: multicast routing and multiple interfaces with same IP)
@ 2009-09-08  7:21 Ilia K.
  2009-09-08 13:03 ` Octavian Purdila
  0 siblings, 1 reply; 2+ messages in thread
From: Ilia K. @ 2009-09-08  7:21 UTC (permalink / raw)
  To: Octavian Purdila; +Cc: David Miller, netdev

[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]

On Mon, Sep 7, 2009 at 7:25 PM, Octavian Purdila<opurdila@ixiacom.com> wrote:
> On Monday 07 September 2009 18:35:41 you wrote:
>> Hi,
>> I'm attaching a new patch. The changes:
>> mroute.h:
>> - consistent name for interface index: vifc_lcl_ifindex
>> - union of vifc_lcl_addr and vifc_lcl_ifindex since either one of them
>> can be used
>> ipmr.c:
>> - case VIFF_USE_IFINDEX and case 0 had almost the same code, so using
>> fall through and if to eliminate code duplication
>>
>
> Hi Ilia,
>
> Looks good to me, but there are a couple of code style issues reported by
> ./scripts/checkpatch.pl.
>
> Also, here:
>
>>+               } else {
>>+                       dev = ip_dev_find(net, vifc->vifc_lcl_addr.s_addr);
>>+               }
>
> Usually no braces are used for single line statements in if/else.

Hi,
I'm just  used to place braces either on both if/else parts or none,
but since you think this breaks linux code style, I've removed braces.
Another coding style issues reported by checkpatch.pl are fixed too.

Regards,
Ilia.

[-- Attachment #2: vif_add.patch --]
[-- Type: text/x-diff, Size: 1634 bytes --]

=== modified file 'include/linux/mroute.h'
--- old/include/linux/mroute.h	2009-08-10 11:17:32 +0000
+++ new/include/linux/mroute.h	2009-09-08 06:58:46 +0000
@@ -59,13 +59,18 @@
 	unsigned char vifc_flags;	/* VIFF_ flags */
 	unsigned char vifc_threshold;	/* ttl limit */
 	unsigned int vifc_rate_limit;	/* Rate limiter values (NI) */
-	struct in_addr vifc_lcl_addr;	/* Our address */
+	union {
+		struct in_addr vifc_lcl_addr;     /* Local interface address */
+		int            vifc_lcl_ifindex;  /* Local interface index   */
+	};
 	struct in_addr vifc_rmt_addr;	/* IPIP tunnel addr */
 };
 
-#define VIFF_TUNNEL	0x1	/* IPIP tunnel */
-#define VIFF_SRCRT	0x2	/* NI */
-#define VIFF_REGISTER	0x4	/* register vif	*/
+#define VIFF_TUNNEL		0x1	/* IPIP tunnel */
+#define VIFF_SRCRT		0x2	/* NI */
+#define VIFF_REGISTER		0x4	/* register vif	*/
+#define VIFF_USE_IFINDEX	0x8	/* use vifc_lcl_ifindex instead of
+					   vifc_lcl_addr to find an interface */
 
 /*
  *	Cache manipulation structures for mrouted and PIMd

=== modified file 'net/ipv4/ipmr.c'
--- old/net/ipv4/ipmr.c	2009-08-10 11:17:32 +0000
+++ new/net/ipv4/ipmr.c	2009-09-08 06:34:21 +0000
@@ -470,8 +470,18 @@
 			return err;
 		}
 		break;
+
+	case VIFF_USE_IFINDEX:
 	case 0:
-		dev = ip_dev_find(net, vifc->vifc_lcl_addr.s_addr);
+		if (vifc->vifc_flags == VIFF_USE_IFINDEX) {
+			dev = dev_get_by_index(net, vifc->vifc_lcl_ifindex);
+			if (dev && dev->ip_ptr == NULL) {
+				dev_put(dev);
+				return -EADDRNOTAVAIL;
+			}
+		} else
+			dev = ip_dev_find(net, vifc->vifc_lcl_addr.s_addr);
+
 		if (!dev)
 			return -EADDRNOTAVAIL;
 		err = dev_set_allmulti(dev, 1);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] add vif using local interface index (was Re: multicast routing and multiple interfaces with same IP)
  2009-09-08  7:21 [PATCH] add vif using local interface index (was Re: multicast routing and multiple interfaces with same IP) Ilia K.
@ 2009-09-08 13:03 ` Octavian Purdila
  0 siblings, 0 replies; 2+ messages in thread
From: Octavian Purdila @ 2009-09-08 13:03 UTC (permalink / raw)
  To: Ilia K.; +Cc: David Miller, netdev

On Tuesday 08 September 2009 10:21:18 you wrote:

> I'm just  used to place braces either on both if/else parts or none,
> but since you think this breaks linux code style, I've removed braces.
> Another coding style issues reported by checkpatch.pl are fixed too.
> 

One more thing :)

Can you please re-send the mail in "submission ready" format:
- subject line with [PATCH] and short summary of the change
- description of the change in the mail message 
- Signed-off-by line at the end of the description message

Here is an example: http://patchwork.ozlabs.org/patch/32684/

Thanks!
tavi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-08 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-08  7:21 [PATCH] add vif using local interface index (was Re: multicast routing and multiple interfaces with same IP) Ilia K.
2009-09-08 13:03 ` Octavian Purdila

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).