// Family current is hardcoded to IPv4.
int family = NFPROTO_IPV4;
+ // The range for bitmap:port based sets currently is hardcoded.
+ const uint16_t range_start = 0;
+ const uint16_t range_stop = 65535;
CODE:
// Load everything
ipset_load_types();
goto ERROR;
}
- r = ipset_session_data_set(session, IPSET_OPT_FAMILY, &family);
- if (r < 0) {
- goto ERROR;
- }
-
- r = ipset_session_data_set(session, IPSET_OPT_HASHSIZE, &hashsize);
- if (r < 0) {
- goto ERROR;
- }
-
- r = ipset_session_data_set(session, IPSET_OPT_MAXELEM, &maxelem);
- if (r < 0) {
- goto ERROR;
+ if (strcmp(typename, "bitmap:port") == 0) {
+ r = ipset_session_data_set(session, IPSET_OPT_PORT_FROM, &range_start);
+ if (r < 0) {
+ goto ERROR;
+ }
+
+ r = ipset_session_data_set(session, IPSET_OPT_PORT_TO, &range_stop);
+ if (r < 0) {
+ goto ERROR;
+ }
+ } else {
+ r = ipset_session_data_set(session, IPSET_OPT_FAMILY, &family);
+ if (r < 0) {
+ goto ERROR;
+ }
+
+ r = ipset_session_data_set(session, IPSET_OPT_HASHSIZE, &hashsize);
+ if (r < 0) {
+ goto ERROR;
+ }
+
+ r = ipset_session_data_set(session, IPSET_OPT_MAXELEM, &maxelem);
+ if (r < 0) {
+ goto ERROR;
+ }
}
r = ipset_cmd(session, IPSET_CMD_CREATE, 0);