View | Details | Raw Unified | Return to bug 228632
Collapse All | Expand All

(-)b/etc/rc.d/pf (+2 lines)
Lines 66-73 pf_status() Link Here
66
{
66
{
67
 if ! [ -c /dev/pf ] ; then
67
 if ! [ -c /dev/pf ] ; then
68
   echo "pf.ko is not loaded"
68
   echo "pf.ko is not loaded"
69
   return 1
69
 else
70
 else
70
   $pf_program -s info
71
   $pf_program -s info
72
   $pf_program -s Running >/dev/null
71
 fi
73
 fi
72
}
74
}
73
75
(-)b/sbin/pfctl/pfctl.8 (+2 lines)
Lines 412-417 Show filter information (statistics and counters). Link Here
412
When used together with
412
When used together with
413
.Fl v ,
413
.Fl v ,
414
source tracking statistics are also shown.
414
source tracking statistics are also shown.
415
.It Fl s Cm Running
416
Show the running status and provide a non-zero exit status when disabled.
415
.It Fl s Cm labels
417
.It Fl s Cm labels
416
Show per-rule statistics (label, evaluations, packets total, bytes total,
418
Show per-rule statistics (label, evaluations, packets total, bytes total,
417
packets in, bytes in, packets out, bytes out, state creations) of
419
packets in, bytes in, packets out, bytes out, state creations) of
(-)b/sbin/pfctl/pfctl.c (-2 / +19 lines)
Lines 96-101 int pfctl_show_nat(int, int, char *); Link Here
96
int   pfctl_show_src_nodes(int, int);
96
int   pfctl_show_src_nodes(int, int);
97
int   pfctl_show_states(int, const char *, int);
97
int   pfctl_show_states(int, const char *, int);
98
int   pfctl_show_status(int, int);
98
int   pfctl_show_status(int, int);
99
int   pfctl_show_running(int);
99
int   pfctl_show_timeouts(int, int);
100
int   pfctl_show_timeouts(int, int);
100
int   pfctl_show_limits(int, int);
101
int   pfctl_show_limits(int, int);
101
void  pfctl_debug(int, u_int32_t, int);
102
void  pfctl_debug(int, u_int32_t, int);
Lines 217-223 static const char * const clearopt_list[] = { Link Here
217
static const char * const showopt_list[] = {
218
static const char * const showopt_list[] = {
218
 "nat", "queue", "rules", "Anchors", "Sources", "states", "info",
219
 "nat", "queue", "rules", "Anchors", "Sources", "states", "info",
219
 "Interfaces", "labels", "timeouts", "memory", "Tables", "osfp",
220
 "Interfaces", "labels", "timeouts", "memory", "Tables", "osfp",
220
 "all", NULL
221
 "Running", "all", NULL
221
};
222
};
222
223
223
static const char * const tblcmdopt_list[] = {
224
static const char * const tblcmdopt_list[] = {
Lines 244-250 usage(void) Link Here
244
 "\t[-k host | network | label | id] [-o level] [-p device]\n"
245
 "\t[-k host | network | label | id] [-o level] [-p device]\n"
245
 "\t[-s modifier] [-t table -T command [address ...]] [-x level]\n",
246
 "\t[-s modifier] [-t table -T command [address ...]] [-x level]\n",
246
     __progname);
247
     __progname);
247
248
 exit(1);
248
 exit(1);
249
}
249
}
250
250
Lines 1154-1159 pfctl_show_status(int dev, int opts) Link Here
1154
 return (0);
1154
 return (0);
1155
}
1155
}
1156
1156
1157
int
1158
pfctl_show_running(int dev)
1159
{
1160
 struct pf_status status;
1161
1162
 if (ioctl(dev, DIOCGETSTATUS, &status)) {
1163
   warn("DIOCGETSTATUS");
1164
   return (-1);
1165
 }
1166
1167
 print_running(&status);
1168
 return (!status.running);
1169
}
1170
1157
int
1171
int
1158
pfctl_show_timeouts(int dev, int opts)
1172
pfctl_show_timeouts(int dev, int opts)
1159
{
1173
{
Lines 2268-2273 main(int argc, char *argv[]) Link Here
2268
   case 's':
2282
   case 's':
2269
     pfctl_show_states(dev, ifaceopt, opts);
2283
     pfctl_show_states(dev, ifaceopt, opts);
2270
     break;
2284
     break;
2285
   case 'R':
2286
     error = pfctl_show_running(dev);
2287
     break;
2271
   case 'S':
2288
   case 'S':
2272
     pfctl_show_src_nodes(dev, opts);
2289
     pfctl_show_src_nodes(dev, opts);
2273
     break;
2290
     break;
(-)b/sbin/pfctl/pfctl_parser.c (+6 lines)
Lines 614-619 print_status(struct pf_status *s, int opts) Link Here
614
 }
614
 }
615
}
615
}
616
616
617
void
618
print_running(struct pf_status *status)
619
{
620
 printf("%s\n", status->running ? "Enabled" : "Disabled");
621
}
622
617
void
623
void
618
print_src_node(struct pf_src_node *sn, int opts)
624
print_src_node(struct pf_src_node *sn, int opts)
619
{
625
{
(-)b/sbin/pfctl/pfctl_parser.h (+1 lines)
Lines 257-262 void print_src_node(struct pf_src_node *, int); Link Here
257
void print_rule(struct pf_rule *, const char *, int, int);
257
void print_rule(struct pf_rule *, const char *, int, int);
258
void print_tabledef(const char *, int, int, struct node_tinithead *);
258
void print_tabledef(const char *, int, int, struct node_tinithead *);
259
void print_status(struct pf_status *, int);
259
void print_status(struct pf_status *, int);
260
void print_running(struct pf_status *);
260
261
261
int  eval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *,
262
int  eval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *,
262
     struct node_queue_opt *);
263
     struct node_queue_opt *);

Return to bug 228632