View | Details | Raw Unified | Return to bug 283970 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/netinet/ip_fw.h (-1 lines)
Lines 107-113 typedef struct _ip_fw3_opheader { Link Here
107
#define	IP_FW_NAT44_LIST_NAT	114	/* List all NAT44 instances */
107
#define	IP_FW_NAT44_LIST_NAT	114	/* List all NAT44 instances */
108
#define	IP_FW_NAT44_XGETLOG	115	/* Get log from NAT44 instance */
108
#define	IP_FW_NAT44_XGETLOG	115	/* Get log from NAT44 instance */
109
109
110
#define	IP_FW_DUMP_SOPTCODES	116	/* Dump available sopts/versions */
111
#define	IP_FW_DUMP_SRVOBJECTS	117	/* Dump existing named objects */
110
#define	IP_FW_DUMP_SRVOBJECTS	117	/* Dump existing named objects */
112
111
113
#define	IP_FW_NAT64STL_CREATE	130	/* Create stateless NAT64 instance */
112
#define	IP_FW_NAT64STL_CREATE	130	/* Create stateless NAT64 instance */
(-)b/sys/netpfil/ipfw/ip_fw_sockopt.c (-54 lines)
Lines 120-127 static int move_rules(struct ip_fw_chain *chain, ip_fw3_opheader *op3, Link Here
120
    struct sockopt_data *sd);
120
    struct sockopt_data *sd);
121
static int manage_sets(struct ip_fw_chain *chain, ip_fw3_opheader *op3,
121
static int manage_sets(struct ip_fw_chain *chain, ip_fw3_opheader *op3,
122
    struct sockopt_data *sd);
122
    struct sockopt_data *sd);
123
static int dump_soptcodes(struct ip_fw_chain *chain, ip_fw3_opheader *op3,
124
    struct sockopt_data *sd);
125
static int dump_srvobjects(struct ip_fw_chain *chain, ip_fw3_opheader *op3,
123
static int dump_srvobjects(struct ip_fw_chain *chain, ip_fw3_opheader *op3,
126
    struct sockopt_data *sd);
124
    struct sockopt_data *sd);
127
125
Lines 150-156 static struct ipfw_sopt_handler scodes[] = { Link Here
150
	{ IP_FW_SET_SWAP,	0,	HDIR_SET,	manage_sets },
148
	{ IP_FW_SET_SWAP,	0,	HDIR_SET,	manage_sets },
151
	{ IP_FW_SET_MOVE,	0,	HDIR_SET,	manage_sets },
149
	{ IP_FW_SET_MOVE,	0,	HDIR_SET,	manage_sets },
152
	{ IP_FW_SET_ENABLE,	0,	HDIR_SET,	manage_sets },
150
	{ IP_FW_SET_ENABLE,	0,	HDIR_SET,	manage_sets },
153
	{ IP_FW_DUMP_SOPTCODES,	0,	HDIR_GET,	dump_soptcodes },
154
	{ IP_FW_DUMP_SRVOBJECTS,0,	HDIR_GET,	dump_srvobjects },
151
	{ IP_FW_DUMP_SRVOBJECTS,0,	HDIR_GET,	dump_srvobjects },
155
};
152
};
156
153
Lines 3096-3152 add_rules(struct ip_fw_chain *chain, ip_fw3_opheader *op3, Link Here
3096
	return (error);
3093
	return (error);
3097
}
3094
}
3098
3095
3099
/*
3100
 * Lists all sopts currently registered.
3101
 * Data layout (v0)(current):
3102
 * Request: [ ipfw_obj_lheader ], size = ipfw_obj_lheader.size
3103
 * Reply: [ ipfw_obj_lheader ipfw_sopt_info x N ]
3104
 *
3105
 * Returns 0 on success
3106
 */
3107
static int
3108
dump_soptcodes(struct ip_fw_chain *chain, ip_fw3_opheader *op3,
3109
    struct sockopt_data *sd)
3110
{
3111
	struct _ipfw_obj_lheader *olh;
3112
	ipfw_sopt_info *i;
3113
	struct ipfw_sopt_handler *sh;
3114
	uint32_t count, n, size;
3115
3116
	olh = (struct _ipfw_obj_lheader *)ipfw_get_sopt_header(sd,sizeof(*olh));
3117
	if (olh == NULL)
3118
		return (EINVAL);
3119
	if (sd->valsize < olh->size)
3120
		return (EINVAL);
3121
3122
	CTL3_LOCK();
3123
	count = ctl3_hsize;
3124
	size = count * sizeof(ipfw_sopt_info) + sizeof(ipfw_obj_lheader);
3125
3126
	/* Fill in header regadless of buffer size */
3127
	olh->count = count;
3128
	olh->objsize = sizeof(ipfw_sopt_info);
3129
3130
	if (size > olh->size) {
3131
		olh->size = size;
3132
		CTL3_UNLOCK();
3133
		return (ENOMEM);
3134
	}
3135
	olh->size = size;
3136
3137
	for (n = 1; n <= count; n++) {
3138
		i = (ipfw_sopt_info *)ipfw_get_sopt_space(sd, sizeof(*i));
3139
		KASSERT(i != NULL, ("previously checked buffer is not enough"));
3140
		sh = &ctl3_handlers[n];
3141
		i->opcode = sh->opcode;
3142
		i->version = sh->version;
3143
		i->refcnt = sh->refcnt;
3144
	}
3145
	CTL3_UNLOCK();
3146
3147
	return (0);
3148
}
3149
3150
/*
3096
/*
3151
 * Compares two opcodes.
3097
 * Compares two opcodes.
3152
 * Used both in qsort() and bsearch().
3098
 * Used both in qsort() and bsearch().
(-)b/tests/atf_python/sys/netpfil/ipfw/insn_headers.py (-1 lines)
Lines 134-140 class Op3CmdType(Enum): Link Here
134
    IP_FW_NAT44_XGETCONFIG = 113
134
    IP_FW_NAT44_XGETCONFIG = 113
135
    IP_FW_NAT44_LIST_NAT = 114
135
    IP_FW_NAT44_LIST_NAT = 114
136
    IP_FW_NAT44_XGETLOG = 115
136
    IP_FW_NAT44_XGETLOG = 115
137
    IP_FW_DUMP_SOPTCODES = 116
138
    IP_FW_DUMP_SRVOBJECTS = 117
137
    IP_FW_DUMP_SRVOBJECTS = 117
139
    IP_FW_NAT64STL_CREATE = 130
138
    IP_FW_NAT64STL_CREATE = 130
140
    IP_FW_NAT64STL_DESTROY = 131
139
    IP_FW_NAT64STL_DESTROY = 131
(-)b/tests/atf_python/sys/netpfil/ipfw/ioctl_headers.py (-1 lines)
Lines 31-37 class Op3CmdType(Enum): Link Here
31
    IP_FW_NAT44_XGETCONFIG = 113
31
    IP_FW_NAT44_XGETCONFIG = 113
32
    IP_FW_NAT44_LIST_NAT = 114
32
    IP_FW_NAT44_LIST_NAT = 114
33
    IP_FW_NAT44_XGETLOG = 115
33
    IP_FW_NAT44_XGETLOG = 115
34
    IP_FW_DUMP_SOPTCODES = 116
35
    IP_FW_DUMP_SRVOBJECTS = 117
34
    IP_FW_DUMP_SRVOBJECTS = 117
36
    IP_FW_NAT64STL_CREATE = 130
35
    IP_FW_NAT64STL_CREATE = 130
37
    IP_FW_NAT64STL_DESTROY = 131
36
    IP_FW_NAT64STL_DESTROY = 131

Return to bug 283970