@@ -257,26 +257,34 @@ static void fw3_ubus_rules_add(struct blob_buf *b, const char *service,
257
257
void * k = blobmsg_open_table (b , "" );
258
258
struct blob_attr * ropt ;
259
259
unsigned orem ;
260
- char * type = NULL ;
260
+ char * type = NULL , * name = NULL ;
261
261
char comment [256 ];
262
262
263
263
blobmsg_for_each_attr (ropt , rule , orem ) {
264
264
if (!strcmp (blobmsg_name (ropt ), "type" ))
265
265
type = blobmsg_data (ropt );
266
+ else if (!strcmp (blobmsg_name (ropt ), "name" ))
267
+ name = blobmsg_data (ropt );
268
+
266
269
if (device && !strcmp (blobmsg_name (ropt ), "device" ))
267
270
device = blobmsg_get_string (ropt );
268
271
else if (strcmp (blobmsg_name (ropt ), "name" ))
269
272
blobmsg_add_blob (b , ropt );
270
273
}
271
274
272
- if (instance )
273
- snprintf (comment , sizeof (comment ), "ubus:%s[%s] %s %d" ,
274
- service , instance , type ? type : "rule" , n );
275
- else
276
- snprintf (comment , sizeof (comment ), "ubus:%s %s %d" ,
277
- service , type ? type : "rule" , n );
275
+ if (!type || strcmp (type , "ipset" )) {
276
+ if (instance )
277
+ snprintf (comment , sizeof (comment ), "ubus:%s[%s] %s %d" ,
278
+ service , instance , type ? type : "rule" , n );
279
+ else
280
+ snprintf (comment , sizeof (comment ), "ubus:%s %s %d" ,
281
+ service , type ? type : "rule" , n );
278
282
279
- blobmsg_add_string (b , "name" , comment );
283
+ blobmsg_add_string (b , "name" , comment );
284
+ }
285
+ else if (name ) {
286
+ blobmsg_add_string (b , "name" , name );
287
+ }
280
288
281
289
if (device )
282
290
blobmsg_add_string (b , "device" , device );
0 commit comments