Linux-WPAN Archive on lore.kernel.org
 help / color / Atom feed
From: Victhor Foster <victhor.foster@ufpe.br>
To: linux-wpan <linux-wpan@vger.kernel.org>
Subject: Re: Interfacing mac802154 stack with userspace applications
Date: Fri, 13 Mar 2020 19:21:33 -0300 (BRT)
Message-ID: <1193614528.1907358.1584138093678.JavaMail.zimbra@ufpe.br> (raw)
In-Reply-To: <20200313135423.zwimsw5u2o7dnanc@ryzen>

> 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

      reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 22:20 Victhor Foster
2019-11-06 14:02 ` Alexander Aring
2019-11-12  9:03   ` Victhor Foster
2020-03-10  0:25     ` Victhor Foster
2020-03-13 13:54       ` Alexander Aring
2020-03-13 22:21         ` Victhor Foster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1193614528.1907358.1584138093678.JavaMail.zimbra@ufpe.br \
    --to=victhor.foster@ufpe.br \
    --cc=linux-wpan@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-WPAN Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wpan/0 linux-wpan/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wpan linux-wpan/ https://lore.kernel.org/linux-wpan \
		linux-wpan@vger.kernel.org
	public-inbox-index linux-wpan

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wpan


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git