Myra Canyon  v0.0.1-768
network control
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
myra-conntrack.cpp File Reference
#include "Logging.hpp"
#include <iostream>
#include <fstream>
#include <string>
#include <cstdio>
#include <unistd.h>
#include <sys/stat.h>
Include dependency graph for myra-conntrack.cpp:

Macros

#define RET_OK   0
 
#define RET_NO_OUTPUT   1
 
#define RET_INVALID_ARGS   2
 
#define RET_CERR_OUTPUT   3
 
#define RET_UNKNOWN_ERROR   4
 

Functions

int main (int argc, char *argv[])
 Wrapper for /usr/sbin/conntrack. More...
 

Macro Definition Documentation

#define RET_CERR_OUTPUT   3
#define RET_INVALID_ARGS   2
#define RET_NO_OUTPUT   1
#define RET_OK   0
#define RET_UNKNOWN_ERROR   4

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Wrapper for /usr/sbin/conntrack.

Since conntrack requires root to run, it cannot be called directly from PHP in Apache. This simple wrapper is installed SETUID (chmod u+s) by Myra Canyon so it can call the original conntrack without any problem.

Returns
RET_OK everything worked correctly
RET_NO_OUTPUT there is no output (possible problem?)
RET_INVALID_ARGS the arguments are invalid
RET_CERR_OUTPUT STDERR indicates an error
RET_UNKNOWN_ERROR unknown error

Possible options include:

  • output format (json, extended, xml, ...); for example:
    • –output json
    • –output extended
    • –output xml
  • proto (tcp, udp, unknown); for example:
    • –proto tcp
    • –proto udp
  • output filename

Here is the call graph for this function: