LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-18-2018, 04:13 AM   #1
YannickB
LQ Newbie
 
Registered: Jul 2018
Location: Belgium
Distribution: Debian, Ubuntu
Posts: 2

Rep: Reputation: Disabled
Lightbulb Launch application when traffic detected on given port


Hello all,
I would like to trigger a given application (ffmpeg video encoder) when network traffic (streaming) is detected on a given port (for example: UDP/4001).
I don't mind if some packets are lost before the application is triggered.
I would also like to stop/kill the application when the traffic ends.
Does anyone know how this could be achieved?

My hints for the moment:
- Using port-knocking (knockd) but the devices that generates the traffic are hardware encoders so they cannot knock pre-defined ports before sending traffic. One solution could be to use the trigger sequence=4001:udp,4001:udp,4001:udp
- Monitor syslog (as fail2ban does) and detect iptables log on the given port

In both cases, my log files might get huge if all my UDP streaming traffic is logged.

Not easy as it seems... Any clue is welcome.

Thanks
 
Old 07-18-2018, 06:44 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,722

Rep: Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038Reputation: 1038
inetd is your friend.
 
Old 07-18-2018, 11:33 AM   #3
YannickB
LQ Newbie
 
Registered: Jul 2018
Location: Belgium
Distribution: Debian, Ubuntu
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you for the quick reply. That is exactly what I was looking for.
Yet, I face a problem when xinetd triggers the ffmpeg encoder that tries to read traffic from the given UDP port (UDP/3000 in my case), ffmpeg cannot start and gives the following error:

[udp @ 0x1de60a0] bind failed: Address already in use
udp://localhost:3000: Input/output error

and indeed, when xinetd is running, the port 3000 appears in netstat:

# netstat -tuan | grep 3000
udp 0 0 0.0.0.0:3000 0.0.0.0:*

If I stop xinetd and launch my ffmpeg script manually, it works fine. Is that the normal behaviour of xinetd?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use VPN tunnel for all traffic except SMTP (port 25) traffic? maven12 Linux - Networking 2 11-09-2010 06:00 AM
Unable to launch application from workstation but able to launch from vnc chaitanya1982 Linux - Desktop 2 04-30-2010 03:52 AM
[HELP] redirect traffic to spesific port based on Traffic Content using iptables summersgone Linux - Server 2 06-22-2009 11:26 AM
How do you find an application using launch application pnoise Linux - Newbie 1 01-11-2009 10:44 PM
SNMP MRTG RRDTOOL Configu of CPU memory Disk Port data traffic doc traffic manish_2479 Linux - Networking 1 06-19-2007 07:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration