Re: Interfacing mac802154 stack with userspace applications

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hi,
> 
> On Mon, Mar 09, 2020 at 09:25:08PM -0300, Victhor Foster wrote:
>> I have resumed work on this project, and I decided to implement a few
>> changes. I abandoned the socat approach and came up with a different
>> implementation, modifying the linux-wpan example programs.
>> 
> 
> aha, which one?
> 
I based my programs off the af_packet_rx and af_packet_tx examples.

>> I made two programs, one that receives packets from a wpan interface
>> and outputs them to a UDP port, while the other program receives
>> packets from a UDP port and sends them to a wpan interface. It seems
>> to work well enough, but there's a problem with my approach.
>> 
> 
> You telling me something about UDP to a wpan interface. This makes no
> sense except you also building some IP layer in user space.
> 

Sorry for the misunderstanding, I'll try to explain it better.
This is the data flow currently:

[GNU Radio]--UDP socket-->[program 1]--raw wpan socket-->[wpan0]
[GNU Radio]<--UDP socket--[program 2]<--raw wpan socket--[wpan0]
(wpan0 is a hwsim interface)

So the UDP socket is used only to transfer L2 packets to and from
GNU Radio, which is where the PHY is implemented.
This is like a SoftMAC-type radio, except the PHY is a userspace
application, and not a piece of hardware.
I'm trying to move L2 packets between my application and the wpan
interface.

>> I need to get outgoing packets from the wpan interface. Is there a way
>> to filter packets coming through a raw socket, such that only outgoing
>> packets come out of the socket?
>> 
> 
> Now you saying something about RAW sockets, what kind of raw sockets?
> 
Raw wpan sockets. Although I'm using ETH_P_ALL as the protocol, as the
ETH_P_IEEE802154 protocol type does not output outgoing packets.

>> Right now, I'm not filtering for outgoing packets, so when packets are
>> received through my program and sent to the wpan interface, the same
>> packets come out of the interface, as there's no filtering being done,
>> causing a loop.
>> 
>> I tried using the sll_pkttype field in the raw socket structure, but
>> all packets received by the socket have the same value, so it's not
>> useful, unfortunately.
>> 
> 
> No, it smells for me you want to do something with traffic control and
> egress path.

True. In the meantime, I have been working on a possible solution for my
problem, having the program that sends packets from the wpan interface
to my GNU Radio application do the following checks:

- Source MAC or short address is equal to the wpan interface's
- Destination MAC or short address is not equal to that of the wpan
interface
- Destination MAC or short address is equal to the broadcast address

I think this should avoid causing a loop. I haven't finished
implementing these features yet, so I don't know if they will be
effective.
It's not the same as having proper flow control, though. I would need
to implement a flow control mechanism to avoid this problem, I think.
> - Alex



[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux