flat assembler
Message board for the users of flat assembler.

Index > Linux > How to block Layer2 network traffic?

Author
Thread Post new topic Reply to topic
asmdev



Joined: 21 Dec 2006
Posts: 18
asmdev 01 Apr 2018, 20:28
Hello

Its been a while when I visited you guys.

Is there any way to block connections at as soon as Layer2? programming related.
Do I HAVE to study tc (traffic control) INSTEAD ?
I am able to create AF_PACKET+SOCK_RAW sockets but I can only listen... or not?

I require a guaranteed block, unless my program makes decision - traffic goes nowhere.
Post 01 Apr 2018, 20:28
View user's profile Send private message Reply with quote
Melissa



Joined: 12 Apr 2012
Posts: 125
Melissa 04 Apr 2018, 16:25
If you want to block connections that means TCP protocol? For same effect simply block remote address via iptables Wink
Post 04 Apr 2018, 16:25
View user's profile Send private message Reply with quote
asmdev



Joined: 21 Dec 2006
Posts: 18
asmdev 05 Apr 2018, 04:18
I never wrote a firewall before. Can somebody throw at a few IOCTLs or a set to functions with correct params.
Unfortunately use iptables or install pfsense on separate computer is typical response.
Post 05 Apr 2018, 04:18
View user's profile Send private message Reply with quote
donn



Joined: 05 Mar 2010
Posts: 321
donn 05 Apr 2018, 15:53
There's this article on "How to create a micro-firewall with kernel modules and packet filtering". There's also this related packet filtering diagram from Wikipedia which can provide a visual.

Hacking iptables is also possible, which may be what Melissa meant.

I only have a 'barely-working' OpenSUSE on Windows 10 from the Windows Store at the moment, so I can't really test anything out, but converting the LinuxJournal C functions to fasm should be possible. If that example still works (a better, newer approach may have replaced this), it could at least provide a quick running example so you can see if that's what you're looking for. May not be low-enough level for you, however..
Post 05 Apr 2018, 15:53
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.