From: Richard Palethorpe <rpalethorpe@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3] setsockopt08: Handle ENOPROTOOPT even with compatible config
Date: Thu, 12 Aug 2021 11:58:19 +0100 [thread overview]
Message-ID: <87y297kjzo.fsf@suse.de> (raw)
In-Reply-To: <20d55401-e0f4-0d68-74eb-d931134ba52c@suse.cz>
Hello,
Martin Doucha <mdoucha@suse.cz> writes:
> Hi,
> small nit below but otherwise it looks good.
>
> Reviewed-by: Martin Doucha <mdoucha@suse.cz>
Cheers.
>
> On 12. 08. 21 8:47, Richard Palethorpe wrote:
>> One or more necessary modules can be missing even if they are present
>> in the config.
>>
>> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
>> Suggested-by: Martin Doucha <mdoucha@suse.cz>
>> ---
>>
>> V3:
>> * Use code suggested by Martin. Functionally it is the same as V2.
>>
>> I'm not sure which is easier to read, but usually more indentation
>> makes things worse. So this is better in that regard.
>>
>> .../kernel/syscalls/setsockopt/setsockopt08.c | 14 ++++++++++----
>> 1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt08.c b/testcases/kernel/syscalls/setsockopt/setsockopt08.c
>> index 33892f9b1..20abe85b4 100644
>> --- a/testcases/kernel/syscalls/setsockopt/setsockopt08.c
>> +++ b/testcases/kernel/syscalls/setsockopt/setsockopt08.c
>> @@ -101,6 +101,8 @@ void setup(void)
>>
>> void run(void)
>> {
>> + const char *const res_fmt_str =
>> + "setsockopt(%d, IPPROTO_IP, IPT_SO_SET_REPLACE, %p, 1)";
>> struct ipt_replace *ipt_replace = buffer;
>> struct ipt_entry *ipt_entry = &ipt_replace->entries[0];
>> struct xt_entry_match *xt_entry_match =
>> @@ -110,6 +112,7 @@ void run(void)
>> struct xt_entry_target *xt_entry_tgt =
>> ((struct xt_entry_target *) (&ipt_entry->elems[0] + match_size));
>> int fd = SAFE_SOCKET(AF_INET, SOCK_DGRAM, 0);
>> + int result;
>
> Unused variable ^
It is used
>
>>
>> xt_entry_match->u.user.match_size = (u_int16_t)match_size;
>> strcpy(xt_entry_match->u.user.name, "state");
>> @@ -126,10 +129,13 @@ void run(void)
>> ipt_replace->num_counters = 1;
>> ipt_replace->size = ipt_entry->next_offset;
>>
>> - TST_EXP_FAIL(setsockopt(fd, IPPROTO_IP, IPT_SO_SET_REPLACE, buffer, 1),
>> - EINVAL,
>> - "setsockopt(%d, IPPROTO_IP, IPT_SO_SET_REPLACE, %p, 1)",
>> - fd, buffer);
>> + TEST(setsockopt(fd, IPPROTO_IP, IPT_SO_SET_REPLACE, buffer, 1));
>> +
>> + if (TST_RET == -1 && TST_ERR == ENOPROTOOPT)
>> + tst_brk(TCONF | TTERRNO, res_fmt_str, fd, buffer);
>> +
>> + result = (TST_RET == -1 && TST_ERR == EINVAL) ? TPASS : TFAIL;
^^^^^^
>> + tst_res(result | TTERRNO, res_fmt_str, fd, buffer);
>>
>> SAFE_CLOSE(fd);
>> }
>>
--
Thank you,
Richard.
next prev parent reply other threads:[~2021-08-12 10:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210811142438.2C8D3A3CBF@relay2.suse.de>
2021-08-12 6:47 ` [LTP] [PATCH v3] setsockopt08: Handle ENOPROTOOPT even with compatible config Richard Palethorpe
2021-08-12 10:06 ` Martin Doucha
2021-08-12 10:58 ` Richard Palethorpe [this message]
2021-08-16 11:16 ` [LTP] [PATCH v4 1/2] " Richard Palethorpe
2021-08-16 11:16 ` [LTP] [PATCH v4 2/2] setsockopt08: Avoid confusion by removing TCONF Richard Palethorpe
2021-08-16 13:35 ` Martin Doucha
2021-08-19 9:29 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y297kjzo.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox