Re: [PATCH nft 3/3] rule: fix use of intervals in set declarations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  static int do_add_setelems(struct netlink_ctx *ctx, const struct handle *h,
> -			   const struct expr *expr)
> +			   const struct location *loc, struct expr *expr)
>  {
> -	if (netlink_add_setelems(ctx, h, expr) < 0)
> +	struct set *set;
> +
> +	if (netlink_get_set(ctx, h, loc) < 0)

I think we should get it from the internal list and not from the
kernel. We can't add intervals to existing sets so far anyways,
and this would allow it, but it wouldn't work.

>  		return -1;
> +
> +	list_for_each_entry(set, &ctx->list, list) {
> +		if (set->flags & SET_F_INTERVAL &&
> +		    set_to_intervals(ctx->msgs, set, expr) < 0)
> +			return -1;
> +
> +		if (netlink_add_setelems(ctx, h, expr) < 0)
> +			return -1;
> +	}
>  	return 0;
>  }
>  
> @@ -756,7 +767,8 @@ static int do_command_add(struct netlink_ctx *ctx, struct cmd *cmd, bool excl)
>  	case CMD_OBJ_SET:
>  		return do_add_set(ctx, &cmd->handle, cmd->set);
>  	case CMD_OBJ_SETELEM:
> -		return do_add_setelems(ctx, &cmd->handle, cmd->expr);
> +		return do_add_setelems(ctx, &cmd->handle, &cmd->location,
> +				       cmd->expr);
>  	default:
>  		BUG("invalid command object type %u\n", cmd->obj);
>  	}
> -- 
> 1.7.10.4
> 
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux