@@ -45,7 +45,7 @@ int main(int argc, char* argv[])
45
45
const char * dst = 0 ;
46
46
int sport = 0 ;
47
47
int dport = 0 ;
48
- int expect = 0 ;
48
+ int expectport = 0 ;
49
49
int timeout = 0 ;
50
50
int flags = 0 ;
51
51
int opt ;
@@ -56,7 +56,7 @@ int main(int argc, char* argv[])
56
56
case 'd' : dst = optarg ; break ;
57
57
case 'f' : sport = atoi (optarg ); break ;
58
58
case 't' : dport = atoi (optarg ); break ;
59
- case 'e' : expect = atoi (optarg ); break ;
59
+ case 'e' : expectport = atoi (optarg ); break ;
60
60
case 'T' : timeout = atoi (optarg ); break ;
61
61
case 'P' : flags = NF_CT_EXPECT_PERMANENT ; break ;
62
62
case 'v' : verbose = 1 ; break ;
@@ -66,7 +66,12 @@ int main(int argc, char* argv[])
66
66
}
67
67
}
68
68
69
- if (!(src && dst && sport && dport && expect && timeout )) {
69
+ if (verbose ) {
70
+ printf ("%s %s:%d - %s:%d expect %d timeout %d flags %#x\n" ,
71
+ argv [0 ], src , sport , dst , dport , expectport , timeout , flags );
72
+ }
73
+
74
+ if (!(src && dst && sport && dport && expectport && timeout )) {
70
75
fprintf (stderr , "not all mandatory args were specified\n" );
71
76
usage ();
72
77
}
@@ -86,6 +91,8 @@ int main(int argc, char* argv[])
86
91
nfct_set_attr_u16 (master , ATTR_PORT_SRC , htons (sport ));
87
92
nfct_set_attr_u16 (master , ATTR_PORT_DST , htons (dport ));
88
93
94
+ ctprint (master , "master" );
95
+
89
96
struct nf_conntrack * expected = nfct_new ();
90
97
91
98
if (!expected ) {
@@ -99,7 +106,7 @@ int main(int argc, char* argv[])
99
106
100
107
nfct_set_attr_u8 (expected , ATTR_L4PROTO , IPPROTO_TCP );
101
108
nfct_set_attr_u16 (expected , ATTR_PORT_SRC , 0 );
102
- nfct_set_attr_u16 (expected , ATTR_PORT_DST , htons (expect ));
109
+ nfct_set_attr_u16 (expected , ATTR_PORT_DST , htons (expectport ));
103
110
104
111
ctprint (expected , "expected" );
105
112
@@ -120,10 +127,6 @@ int main(int argc, char* argv[])
120
127
121
128
ctprint (mask , "mask" );
122
129
123
- /*
124
- * Step 2: Setup expectation
125
- */
126
-
127
130
struct nf_expect * exp = nfexp_new ();
128
131
129
132
if (!exp ) {
0 commit comments