Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1643642 > unrolled thread

[PATCH net-next 3/6] net: bridge: break if __br_mdb_del fails

Started byVivien Didelot <vivien.didelot@savoirfairelinux.com>
First post2017-05-17 23:40 +0200
Last post2017-05-18 17:50 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH net-next 3/6] net: bridge: break if __br_mdb_del fails Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-17 23:40 +0200
    Re: [PATCH net-next 3/6] net: bridge: break if __br_mdb_del fails Nikolay Aleksandrov <nikolay@cumulusnetworks.com> - 2017-05-18 15:50 +0200
      Re: [PATCH net-next 3/6] net: bridge: break if __br_mdb_del    fails Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-18 17:20 +0200
        Re: [PATCH net-next 3/6] net: bridge: break if __br_mdb_del fails Nikolay Aleksandrov <nikolay@cumulusnetworks.com> - 2017-05-18 17:30 +0200
          Re: [PATCH net-next 3/6] net: bridge: break if __br_mdb_del    fails Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-18 17:50 +0200

#1643642 — [PATCH net-next 3/6] net: bridge: break if __br_mdb_del fails

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2017-05-17 23:40 +0200
Subject[PATCH net-next 3/6] net: bridge: break if __br_mdb_del fails
Message-ID<tIePL-8wt-9@gated-at.bofh.it>
Be symmetric with br_mdb_add and break if __br_mdb_del returns an error.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 net/bridge/br_mdb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index d20a01622b20..24eeeefb4179 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -688,8 +688,9 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
 		list_for_each_entry(v, &vg->vlan_list, vlist) {
 			entry->vid = v->vid;
 			err = __br_mdb_del(br, entry);
-			if (!err)
-				__br_mdb_notify(dev, p, entry, RTM_DELMDB);
+			if (err)
+				break;
+			__br_mdb_notify(dev, p, entry, RTM_DELMDB);
 		}
 	} else {
 		err = __br_mdb_del(br, entry);
-- 
2.13.0

[toc] | [next] | [standalone]


#1644559

FromNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date2017-05-18 15:50 +0200
Message-ID<tItYu-3le-5@gated-at.bofh.it>
In reply to#1643642
On 5/18/17 12:27 AM, Vivien Didelot wrote:
> Be symmetric with br_mdb_add and break if __br_mdb_del returns an error.
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
>   net/bridge/br_mdb.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
> index d20a01622b20..24eeeefb4179 100644
> --- a/net/bridge/br_mdb.c
> +++ b/net/bridge/br_mdb.c
> @@ -688,8 +688,9 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
>   		list_for_each_entry(v, &vg->vlan_list, vlist) {
>   			entry->vid = v->vid;
>   			err = __br_mdb_del(br, entry);
> -			if (!err)
> -				__br_mdb_notify(dev, p, entry, RTM_DELMDB);
> +			if (err)
> +				break;
> +			__br_mdb_notify(dev, p, entry, RTM_DELMDB);
>   		}
>   	} else {
>   		err = __br_mdb_del(br, entry);
> 

This can potentially break user-space scripts that rely on the best-effort
behaviour, this is the normal "delete without vid & enabled vlan filtering".
You can check the fdb delete code which does the same, this was intentional.

You can add an mdb entry without a vid to all vlans, add a vlan and then try
to remove it from all vlans where it is present - with this patch obviously
that will fail at the new vlan.

[toc] | [prev] | [next] | [standalone]


#1644670 — Re: [PATCH net-next 3/6] net: bridge: break if __br_mdb_del fails

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2017-05-18 17:20 +0200
SubjectRe: [PATCH net-next 3/6] net: bridge: break if __br_mdb_del fails
Message-ID<tIvnz-4vr-11@gated-at.bofh.it>
In reply to#1644559
Hi Nikolay,

Nikolay Aleksandrov <nikolay@cumulusnetworks.com> writes:

>>   			err = __br_mdb_del(br, entry);
>> -			if (!err)
>> -				__br_mdb_notify(dev, p, entry, RTM_DELMDB);
>> +			if (err)
>> +				break;
>> +			__br_mdb_notify(dev, p, entry, RTM_DELMDB);
>>   		}
>>   	} else {
>>   		err = __br_mdb_del(br, entry);
>> 
>
> This can potentially break user-space scripts that rely on the best-effort
> behaviour, this is the normal "delete without vid & enabled vlan filtering".
> You can check the fdb delete code which does the same, this was intentional.
>
> You can add an mdb entry without a vid to all vlans, add a vlan and then try
> to remove it from all vlans where it is present - with this patch obviously
> that will fail at the new vlan.

OK good to know. That intention wasn't obvious. I can make __br_mdb_del
return void instead? What about the rest of the patchset if I do so?

Thanks,

        Vivien

[toc] | [prev] | [next] | [standalone]


#1644685

FromNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date2017-05-18 17:30 +0200
Message-ID<tIvxh-4z7-41@gated-at.bofh.it>
In reply to#1644670
On 5/18/17 6:08 PM, Vivien Didelot wrote:
> Hi Nikolay,
> 
> Nikolay Aleksandrov <nikolay@cumulusnetworks.com> writes:
> 
>>>    			err = __br_mdb_del(br, entry);
>>> -			if (!err)
>>> -				__br_mdb_notify(dev, p, entry, RTM_DELMDB);
>>> +			if (err)
>>> +				break;
>>> +			__br_mdb_notify(dev, p, entry, RTM_DELMDB);
>>>    		}
>>>    	} else {
>>>    		err = __br_mdb_del(br, entry);
>>>
>>
>> This can potentially break user-space scripts that rely on the best-effort
>> behaviour, this is the normal "delete without vid & enabled vlan filtering".
>> You can check the fdb delete code which does the same, this was intentional.
>>
>> You can add an mdb entry without a vid to all vlans, add a vlan and then try
>> to remove it from all vlans where it is present - with this patch obviously
>> that will fail at the new vlan.
> 
> OK good to know. That intention wasn't obvious. I can make __br_mdb_del
> return void instead? What about the rest of the patchset if I do so?
> 
> Thanks,
> 
>          Vivien
> 

If you make it return void we will not be able to return proper error value
when doing a single operation (the else case). About the rest I see only some
minor style issues, I'll comment on the respective patches. Another minor nit is 
using switch() instead of if/else for the message types but that is really up to 
you, I don't mind either way. :-)

Cheers,
  Nik

[toc] | [prev] | [next] | [standalone]


#1644696 — Re: [PATCH net-next 3/6] net: bridge: break if __br_mdb_del fails

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2017-05-18 17:50 +0200
SubjectRe: [PATCH net-next 3/6] net: bridge: break if __br_mdb_del fails
Message-ID<tIvQB-4Ia-5@gated-at.bofh.it>
In reply to#1644685
Hi Nikolay,

Nikolay Aleksandrov <nikolay@cumulusnetworks.com> writes:

>> OK good to know. That intention wasn't obvious. I can make __br_mdb_del
>> return void instead? What about the rest of the patchset if I do so?
>
> If you make it return void we will not be able to return proper error value
> when doing a single operation (the else case). About the rest I see only some
> minor style issues, I'll comment on the respective patches. Another minor nit is 
> using switch() instead of if/else for the message types but that is really up to 
> you, I don't mind either way. :-)

Ho OK I understand better the batch vs single delete operation now.
__br_mdb_do hardly makes sense now, because we don't know which case we
are handling... But factorizing br_mdb_do still makes sense. I'll come
up with something.

Thanks,

        Vivien

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web