Skip to content

Commit 58125d7

Browse files
committed
Make verbose a little more verbose.
1 parent 146282e commit 58125d7

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

expect-create-userspace.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int main(int argc, char* argv[])
4545
const char* dst = 0;
4646
int sport = 0;
4747
int dport = 0;
48-
int expect = 0;
48+
int expectport = 0;
4949
int timeout = 0;
5050
int flags = 0;
5151
int opt;
@@ -56,7 +56,7 @@ int main(int argc, char* argv[])
5656
case 'd': dst = optarg; break;
5757
case 'f': sport = atoi(optarg); break;
5858
case 't': dport = atoi(optarg); break;
59-
case 'e': expect = atoi(optarg); break;
59+
case 'e': expectport = atoi(optarg); break;
6060
case 'T': timeout = atoi(optarg); break;
6161
case 'P': flags = NF_CT_EXPECT_PERMANENT; break;
6262
case 'v': verbose = 1; break;
@@ -66,7 +66,12 @@ int main(int argc, char* argv[])
6666
}
6767
}
6868

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)) {
7075
fprintf(stderr, "not all mandatory args were specified\n");
7176
usage();
7277
}
@@ -86,6 +91,8 @@ int main(int argc, char* argv[])
8691
nfct_set_attr_u16(master, ATTR_PORT_SRC, htons(sport));
8792
nfct_set_attr_u16(master, ATTR_PORT_DST, htons(dport));
8893

94+
ctprint(master, "master");
95+
8996
struct nf_conntrack* expected = nfct_new();
9097

9198
if (!expected) {
@@ -99,7 +106,7 @@ int main(int argc, char* argv[])
99106

100107
nfct_set_attr_u8(expected, ATTR_L4PROTO, IPPROTO_TCP);
101108
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));
103110

104111
ctprint(expected, "expected");
105112

@@ -120,10 +127,6 @@ int main(int argc, char* argv[])
120127

121128
ctprint(mask, "mask");
122129

123-
/*
124-
* Step 2: Setup expectation
125-
*/
126-
127130
struct nf_expect* exp = nfexp_new();
128131

129132
if (!exp) {

0 commit comments

Comments
 (0)