Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 150674 Details for
Bug 232838
iptstate doesn't work on kernel 2.6.20-1.2925.fc6
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Compatibility mode extension
iptstate-2.2.1-compat-mode-extension.diff (text/plain), 4.81 KB, created by
Tomas Hoger
on 2007-03-22 16:49:13 UTC
(
hide
)
Description:
Compatibility mode extension
Filename:
MIME Type:
Creator:
Tomas Hoger
Created:
2007-03-22 16:49:13 UTC
Size:
4.81 KB
patch
obsolete
>diff -ruN iptstate-2.2.1/iptstate.cc iptstate-2.2.1-new/iptstate.cc >--- iptstate-2.2.1/iptstate.cc 2007-03-19 07:43:49.000000000 +0100 >+++ iptstate-2.2.1-new/iptstate.cc 2007-03-22 17:37:31.000000000 +0100 >@@ -55,13 +55,19 @@ > #include <netdb.h> > #include <arpa/inet.h> > #include <math.h> >+#include <sys/types.h> >+#include <sys/stat.h> > #ifndef IPTSTATE_USE_PROC > extern "C" { > #include <libnetfilter_conntrack/libnetfilter_conntrack.h> > }; > #else > #warning "Compiling in backwards compatability proc mode. This is DEPRECATED and support for this will be removed in the future!" >- #define CONNTRACK "/proc/net/ip_conntrack" >+ #define CONNTRACK_IP "/proc/net/ip_conntrack" >+ #define CONNTRACK_NF "/proc/net/nf_conntrack" >+ >+ #define IP_CONNTRACK_FMT 0 >+ #define NF_CONNTRACK_FMT 1 > #endif > using namespace std; > >@@ -137,6 +143,9 @@ > "CLOSE", > "LISTEN" > }; >+#else >+const char *CONNTRACK= NULL; >+unsigned short int conntrack_format; > #endif > > /* >@@ -474,6 +483,29 @@ > rate = 1; > } > >+ >+#ifdef IPTSTATE_USE_PROC >+// ip_conntrack vs. nf_conntrack detection >+{ >+ struct stat ignored_filestat; >+ >+ if (stat(CONNTRACK_IP, &ignored_filestat) == 0) { >+ CONNTRACK= CONNTRACK_IP; >+ conntrack_format= IP_CONNTRACK_FMT; >+ } >+ else if (stat(CONNTRACK_NF, &ignored_filestat) == 0) { >+ CONNTRACK= CONNTRACK_NF; >+ conntrack_format= NF_CONNTRACK_FMT; >+ } >+ else { >+ cerr << "ERROR: " << CONNTRACK_IP >+ << " nor " << CONNTRACK_NF >+ << " found!" << endl; >+ exit(1); >+ } >+} >+#endif >+ > // Initialize Curses Stuff > static WINDOW *mainwin = NULL; > if (!flags.single) { >@@ -1252,12 +1284,19 @@ > struct protoent* pe = NULL; > table_t entry; > >+ unsigned short base_idx= 0; >+ > /* > * Initialization > */ > stable.clear(); > counts.tcp = counts.udp = counts.icmp = counts.other = counts.skipped > = 0; >+ >+ // In nf_conntrack file, skip first two fields on each line. >+ if (conntrack_format == NF_CONNTRACK_FMT) { >+ base_idx= 2; >+ } > > // Open the file > ifstream input(CONNTRACK); >@@ -1293,19 +1332,26 @@ > */ > > /* >+ * If using nf_conntrack file, only parse ipv4 lines. >+ */ >+ if (conntrack_format == NF_CONNTRACK_FMT && fields[0] != "ipv4") { >+ continue; >+ } >+ >+ /* > * Get the protocol number from field[1] > * We don't want to get it from field[0] because > * ip_conntrack doesn't seem to support this field > * for anything other than tcp, udp, and icmp > */ >- if ((pe = getprotobynumber(atoi(fields[1].c_str()))) == NULL) { >+ if ((pe = getprotobynumber(atoi(fields[base_idx + 1].c_str()))) == NULL) { > entry.proto = "unknown"; > } else { > entry.proto = pe->p_name; > } > > // ttl >- seconds = atoi(fields[2].c_str()); >+ seconds = atoi(fields[base_idx + 2].c_str()); > minutes = seconds/60; > hours = minutes/60; > minutes = minutes%60; >@@ -1320,11 +1366,11 @@ > * Split each field into the part we don't care about > * (tmpstring), and the part we do (src,dst, etc...) > */ >- split('=',fields[4],tmpstring,src); >- split('=',fields[5],tmpstring,dst); >- split('=',fields[6],tmpstring,srcpt); >- split('=',fields[7],tmpstring,dstpt); >- split('=',fields[3],tmpstring,state); >+ split('=',fields[base_idx + 4],tmpstring,src); >+ split('=',fields[base_idx + 5],tmpstring,dst); >+ split('=',fields[base_idx + 6],tmpstring,srcpt); >+ split('=',fields[base_idx + 7],tmpstring,dstpt); >+ split('=',fields[base_idx + 3],tmpstring,state); > > // Do some conversions... > inet_aton(src.c_str(), &(entry.src)); >@@ -1336,10 +1382,10 @@ > counts.tcp++; > > } else if (entry.proto == "udp") { >- split('=',fields[3],tmpstring,src); >- split('=',fields[4],tmpstring,dst); >- split('=',fields[5],tmpstring,srcpt); >- split('=',fields[6],tmpstring,dstpt); >+ split('=',fields[base_idx + 3],tmpstring,src); >+ split('=',fields[base_idx + 4],tmpstring,dst); >+ split('=',fields[base_idx + 5],tmpstring,srcpt); >+ split('=',fields[base_idx + 6],tmpstring,dstpt); > > inet_aton(src.c_str(), &(entry.src)); > inet_aton(dst.c_str(), &(entry.dst)); >@@ -1350,10 +1396,10 @@ > counts.udp++; > > } else if (entry.proto == "icmp") { >- split('=',fields[3],tmpstring,src); >- split('=',fields[4],tmpstring,dst); >- split('=',fields[5],tmpstring,type); >- split('=',fields[6],tmpstring,code); >+ split('=',fields[base_idx + 3],tmpstring,src); >+ split('=',fields[base_idx + 4],tmpstring,dst); >+ split('=',fields[base_idx + 5],tmpstring,type); >+ split('=',fields[base_idx + 6],tmpstring,code); > > inet_aton(src.c_str(), &entry.src); > inet_aton(dst.c_str(), &entry.dst); >@@ -1364,8 +1410,8 @@ > } else { > // If we're not TCP, or UDP > // There's no ports involved >- split('=',fields[3],tmpstring,src); >- split('=',fields[4],tmpstring,dst); >+ split('=',fields[base_idx + 3],tmpstring,src); >+ split('=',fields[base_idx + 4],tmpstring,dst); > > inet_aton(src.c_str(), &entry.src); > inet_aton(dst.c_str(), &entry.dst);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 232838
: 150674