Project

General

Profile

Submit #3126

Bring in BIOC{S,G}FEEDBACK

Added by tuxillo 26 days ago. Updated 8 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
net
Target version:
-
Start date:
03/31/2018
Due date:
% Done:

100%

Estimated time:

Description

Hi,

The port net/vde2 uses a ioctl command BIOCFEEDBACK for FreeBSD to allow host-guest communication in a vde switch. The attached patch is the initial attempt to bring that ioctl command from NetBSD.
It compiles but it's untested until I figure out how to test it.

I'd need some pointers though:

- Is it okay to use directly ifp->if_input directly? Isn't there a mechanism similar to the one used in bpfwrite() -> bpf_output_dispatch but for input?
- If it's okay to use ifp->if_input directly, wouldn't it need some locking?

Cheers,
Antonio Huete

bpf_biocfeedback.patch (3.37 KB) bpf_biocfeedback.patch tuxillo, 04/18/2018 01:39 AM

Associated revisions

Revision 25d01c1b (diff)
Added by tuxillo 8 days ago

bpf - Add BIOC{S,G}FEEDBACK ioctls

- When set it allows reinjecting packets that were written to the bpf device
as input to the interface when the output is successful.
- Add an alias to BIOCFEEDBACK which is the name of the
of the 'set' ioctl in FreeBSD.

Partially-taken-from: NetBSD
Reviewed-by: sephe

Closes: #3126

History

#1 Updated by sepherosa 24 days ago

This is wrong. You should move the change to bpf_output_dispatch().
And before calling if_input, make sure to clear the M_HASH on the
duplicated mbuf's m_flags.

On Sat, Mar 31, 2018 at 8:13 AM,
<> wrote:
> Issue #3126 has been reported by tuxillo.
>
> ----------------------------------------
> Submit #3126: Bring in BIOC{S,G}FEEDBACK
> http://bugs.dragonflybsd.org/issues/3126
>
> * Author: tuxillo
> * Status: New
> * Priority: Normal
> * Assignee:
> * Category:
> * Target version:
> ----------------------------------------
> Hi,
>
> The port net/vde2 uses a ioctl command BIOCFEEDBACK for FreeBSD to allow host-guest communication in a vde switch. The attached patch is the initial attempt to bring that ioctl command from NetBSD.
> It compiles but it's untested until I figure out how to test it.
>
> I'd need some pointers though:
>
> - Is it okay to use directly ifp->if_input directly? Isn't there a mechanism similar to the one used in bpfwrite() -> bpf_output_dispatch but for input?
> - If it's okay to use ifp->if_input directly, wouldn't it need some locking?
>
> Cheers,
> Antonio Huete
>
> ---Files--------------------------------
> bpf_biocfeedback.patch (3.28 KB)
>
>
> --
> You have received this notification because you have either subscribed to it, or are involved in it.
> To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account

--
Tomorrow Will Never Die

#2 Updated by tuxillo 22 days ago

  • File deleted (bpf_biocfeedback.patch)

#3 Updated by tuxillo 22 days ago

  • File bpf_biocfeedback.patch added
  • Category set to net
  • Status changed from New to In Progress
  • Assignee set to tuxillo

Hi Sephe,

See attached the new patch, I've deleted the previous one.

Regards,
Antonio Huete

#4 Updated by sepherosa 18 days ago

Line 607~608 are wrong, they probably should be:
if (mc != NULL) {
if (error == 0) {
/* the if_input part */
} else {
m_freem(mc);
}
}

Line 658~659 are wrong, you will have to unconditionally initialize nm_feedback.

Thanks,
sephe

On Wed, Apr 4, 2018 at 1:50 AM, <> wrote:
> Issue #3126 has been updated by tuxillo.
>
> File bpf_biocfeedback.patch added
> Category set to net
> Status changed from New to In Progress
> Assignee set to tuxillo
>
> Hi Sephe,
>
> See attached the new patch, I've deleted the previous one.
>
> Regards,
> Antonio Huete
>
> ----------------------------------------
> Submit #3126: Bring in BIOC{S,G}FEEDBACK
> http://bugs.dragonflybsd.org/issues/3126#change-13400
>
> * Author: tuxillo
> * Status: In Progress
> * Priority: Normal
> * Assignee: tuxillo
> * Category: net
> * Target version:
> ----------------------------------------
> Hi,
>
> The port net/vde2 uses a ioctl command BIOCFEEDBACK for FreeBSD to allow host-guest communication in a vde switch. The attached patch is the initial attempt to bring that ioctl command from NetBSD.
> It compiles but it's untested until I figure out how to test it.
>
> I'd need some pointers though:
>
> - Is it okay to use directly ifp->if_input directly? Isn't there a mechanism similar to the one used in bpfwrite() -> bpf_output_dispatch but for input?
> - If it's okay to use ifp->if_input directly, wouldn't it need some locking?
>
> Cheers,
> Antonio Huete
>
> ---Files--------------------------------
> bpf_biocfeedback.patch (3.33 KB)
>
>
> --
> You have received this notification because you have either subscribed to it, or are involved in it.
> To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account

--
Tomorrow Will Never Die

#5 Updated by tuxillo 8 days ago

  • File deleted (bpf_biocfeedback.patch)

#6 Updated by tuxillo 8 days ago

Attached the patch with the corrections. By the way, who frees the mc mbuf which is passed to ifp->if_input ?

#7 Updated by sepherosa 8 days ago

network stack :)

On Wed, Apr 18, 2018 at 4:40 PM,
<> wrote:
> Issue #3126 has been updated by tuxillo.
>
> File bpf_biocfeedback.patch added
>
> Attached the patch with the corrections. By the way, who frees the mc mbuf which is passed to ifp->if_input ?
>
> ----------------------------------------
> Submit #3126: Bring in BIOC{S,G}FEEDBACK
> http://bugs.dragonflybsd.org/issues/3126#change-13413
>
> * Author: tuxillo
> * Status: In Progress
> * Priority: Normal
> * Assignee: tuxillo
> * Category: net
> * Target version:
> ----------------------------------------
> Hi,
>
> The port net/vde2 uses a ioctl command BIOCFEEDBACK for FreeBSD to allow host-guest communication in a vde switch. The attached patch is the initial attempt to bring that ioctl command from NetBSD.
> It compiles but it's untested until I figure out how to test it.
>
> I'd need some pointers though:
>
> - Is it okay to use directly ifp->if_input directly? Isn't there a mechanism similar to the one used in bpfwrite() -> bpf_output_dispatch but for input?
> - If it's okay to use ifp->if_input directly, wouldn't it need some locking?
>
> Cheers,
> Antonio Huete
>
> ---Files--------------------------------
> bpf_biocfeedback.patch (3.37 KB)
>
>
> --
> You have received this notification because you have either subscribed to it, or are involved in it.
> To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account

--
Tomorrow Will Never Die

#8 Updated by sepherosa 8 days ago

Patch looks good. Commit it!

On Wed, Apr 18, 2018 at 4:45 PM, Sepherosa Ziehau <> wrote:
> network stack :)
>
> On Wed, Apr 18, 2018 at 4:40 PM,
> <> wrote:
>> Issue #3126 has been updated by tuxillo.
>>
>> File bpf_biocfeedback.patch added
>>
>> Attached the patch with the corrections. By the way, who frees the mc mbuf which is passed to ifp->if_input ?
>>
>> ----------------------------------------
>> Submit #3126: Bring in BIOC{S,G}FEEDBACK
>> http://bugs.dragonflybsd.org/issues/3126#change-13413
>>
>> * Author: tuxillo
>> * Status: In Progress
>> * Priority: Normal
>> * Assignee: tuxillo
>> * Category: net
>> * Target version:
>> ----------------------------------------
>> Hi,
>>
>> The port net/vde2 uses a ioctl command BIOCFEEDBACK for FreeBSD to allow host-guest communication in a vde switch. The attached patch is the initial attempt to bring that ioctl command from NetBSD.
>> It compiles but it's untested until I figure out how to test it.
>>
>> I'd need some pointers though:
>>
>> - Is it okay to use directly ifp->if_input directly? Isn't there a mechanism similar to the one used in bpfwrite() -> bpf_output_dispatch but for input?
>> - If it's okay to use ifp->if_input directly, wouldn't it need some locking?
>>
>> Cheers,
>> Antonio Huete
>>
>> ---Files--------------------------------
>> bpf_biocfeedback.patch (3.37 KB)
>>
>>
>> --
>> You have received this notification because you have either subscribed to it, or are involved in it.
>> To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
>
>
>
> --
> Tomorrow Will Never Die

--
Tomorrow Will Never Die

#9 Updated by tuxillo 8 days ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF