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

(-)sbin/ipfw/ipfw.8 (-1 / +3 lines)
Lines 50-56 Link Here
50
.Nm
50
.Nm
51
.Oo Cm set Ar N Oc Cm table Ar name Cm create Ar create-options
51
.Oo Cm set Ar N Oc Cm table Ar name Cm create Ar create-options
52
.Nm
52
.Nm
53
.Oo Cm set Ar N Oc Cm table Ar name Cm destroy
53
.Oo Cm set Ar N Oc Cm table
54
.Brq Ar name | all
55
.Cm destroy
54
.Nm
56
.Nm
55
.Oo Cm set Ar N Oc Cm table Ar name Cm modify Ar modify-options
57
.Oo Cm set Ar N Oc Cm table Ar name Cm modify Ar modify-options
56
.Nm
58
.Nm
(-)sbin/ipfw/tables.c (-8 / +28 lines)
Lines 57-62 Link Here
57
    uint32_t set, uint16_t uidx);
57
    uint32_t set, uint16_t uidx);
58
58
59
static int table_flush_one(ipfw_xtable_info *i, void *arg);
59
static int table_flush_one(ipfw_xtable_info *i, void *arg);
60
static int table_destroy_one(ipfw_xtable_info *i, void *arg);
60
static int table_show_one(ipfw_xtable_info *i, void *arg);
61
static int table_show_one(ipfw_xtable_info *i, void *arg);
61
static int table_do_get_list(ipfw_xtable_info *i, ipfw_obj_header **poh);
62
static int table_do_get_list(ipfw_xtable_info *i, ipfw_obj_header **poh);
62
static void table_show_list(ipfw_obj_header *oh, int need_header);
63
static void table_show_list(ipfw_obj_header *oh, int need_header);
Lines 134-140 Link Here
134
 * This one handles all table-related commands
135
 * This one handles all table-related commands
135
 * 	ipfw table NAME create ...
136
 * 	ipfw table NAME create ...
136
 * 	ipfw table NAME modify ...
137
 * 	ipfw table NAME modify ...
137
 * 	ipfw table NAME destroy
138
 * 	ipfw table (NAME | all) destroy
138
 * 	ipfw table NAME swap NAME
139
 * 	ipfw table NAME swap NAME
139
 * 	ipfw table NAME lock
140
 * 	ipfw table NAME lock
140
 * 	ipfw table NAME unlock
141
 * 	ipfw table NAME unlock
Lines 201-206 Link Here
201
	case TOK_LIST:
202
	case TOK_LIST:
202
	case TOK_INFO:
203
	case TOK_INFO:
203
	case TOK_DETAIL:
204
	case TOK_DETAIL:
205
	case TOK_DESTROY:
204
	case TOK_FLUSH:
206
	case TOK_FLUSH:
205
		break;
207
		break;
206
	default:
208
	default:
Lines 225-237 Link Here
225
		table_modify(&oh, ac, av);
227
		table_modify(&oh, ac, av);
226
		break;
228
		break;
227
	case TOK_DESTROY:
229
	case TOK_DESTROY:
228
		if (table_destroy(&oh) == 0)
230
		if (is_all == 0) {
229
			break;
231
			if (table_destroy(&oh) == 0)
230
		if (errno != ESRCH)
232
				break;
231
			err(EX_OSERR, "failed to destroy table %s", tablename);
233
			if (errno != ESRCH)
232
		/* ESRCH isn't fatal, warn if not quiet mode */
234
				err(EX_OSERR, "failed to destroy table %s", tablename);
233
		if (co.do_quiet == 0)
235
			/* ESRCH isn't fatal, warn if not quiet mode */
234
			warn("failed to destroy table %s", tablename);
236
			if (co.do_quiet == 0)
237
				warn("failed to destroy table %s", tablename);
238
		} else {
239
			error = tables_foreach(table_destroy_one, &oh, 1);
240
			if (error != 0)
241
				err(EX_OSERR, "failed to destroy tables list");
242
		}
235
		break;
243
		break;
236
	case TOK_FLUSH:
244
	case TOK_FLUSH:
237
		if (is_all == 0) {
245
		if (is_all == 0) {
Lines 822-827 Link Here
822
}
830
}
823
831
824
static int
832
static int
833
table_destroy_one(ipfw_xtable_info *i, void *arg)
834
{
835
	ipfw_obj_header *oh;
836
837
	oh = (ipfw_obj_header *)arg;
838
839
	table_fill_ntlv(&oh->ntlv, i->tablename, i->set, 1);
840
841
	return (table_destroy(oh));
842
}
843
844
static int
825
table_do_modify_record(int cmd, ipfw_obj_header *oh,
845
table_do_modify_record(int cmd, ipfw_obj_header *oh,
826
    ipfw_obj_tentry *tent, int count, int atomic)
846
    ipfw_obj_tentry *tent, int count, int atomic)
827
{
847
{

Return to bug 212669