mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-07 21:25:12 +02:00
psd: style: remove braces for single statements in ifs
This commit is contained in:
@@ -70,53 +70,45 @@ static int psd_mt_parse(int c, char **argv, int invert, unsigned int *flags,
|
|||||||
switch (c) {
|
switch (c) {
|
||||||
/* PSD-weight-threshold */
|
/* PSD-weight-threshold */
|
||||||
case '1':
|
case '1':
|
||||||
if(*flags & XT_PSD_OPT_CTRESH) {
|
if (*flags & XT_PSD_OPT_CTRESH)
|
||||||
xtables_error(PARAMETER_PROBLEM,"Can't specify --psd-weight-threshold twice");
|
xtables_error(PARAMETER_PROBLEM,"Can't specify --psd-weight-threshold twice");
|
||||||
}
|
if (!xtables_strtoui(optarg, NULL, &num, 0, PSD_MAX_RATE))
|
||||||
if(!xtables_strtoui(optarg, NULL,&num,0,PSD_MAX_RATE)) {
|
|
||||||
xtables_error(PARAMETER_PROBLEM, "bad --psd-weight-threshold '%s'", optarg);
|
xtables_error(PARAMETER_PROBLEM, "bad --psd-weight-threshold '%s'", optarg);
|
||||||
}
|
|
||||||
psdinfo->weight_threshold = num;
|
psdinfo->weight_threshold = num;
|
||||||
*flags |= XT_PSD_OPT_CTRESH;
|
*flags |= XT_PSD_OPT_CTRESH;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* PSD-delay-threshold */
|
/* PSD-delay-threshold */
|
||||||
case '2':
|
case '2':
|
||||||
if(*flags & XT_PSD_OPT_DTRESH) {
|
if (*flags & XT_PSD_OPT_DTRESH)
|
||||||
xtables_error(PARAMETER_PROBLEM, "Can't specify --psd-delay-threshold twice");
|
xtables_error(PARAMETER_PROBLEM, "Can't specify --psd-delay-threshold twice");
|
||||||
}
|
if (!xtables_strtoui(optarg, NULL, &num, 0, PSD_MAX_RATE))
|
||||||
if(!xtables_strtoui(optarg, NULL,&num,0,PSD_MAX_RATE)) {
|
xtables_error(PARAMETER_PROBLEM, "bad --psd-delay-threshold '%s'", optarg);
|
||||||
xtables_error(PARAMETER_PROBLEM,"bad --psd-delay-threshold '%s'", optarg);
|
|
||||||
}
|
|
||||||
psdinfo->delay_threshold = num;
|
psdinfo->delay_threshold = num;
|
||||||
*flags |= XT_PSD_OPT_DTRESH;
|
*flags |= XT_PSD_OPT_DTRESH;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* PSD-lo-ports-weight */
|
/* PSD-lo-ports-weight */
|
||||||
case '3':
|
case '3':
|
||||||
if(*flags & XT_PSD_OPT_LPWEIGHT) {
|
if (*flags & XT_PSD_OPT_LPWEIGHT)
|
||||||
xtables_error(PARAMETER_PROBLEM, "Can't specify --psd-lo-ports-weight twice");
|
xtables_error(PARAMETER_PROBLEM, "Can't specify --psd-lo-ports-weight twice");
|
||||||
}
|
if (!xtables_strtoui(optarg, NULL, &num, 0, PSD_MAX_RATE))
|
||||||
if(!xtables_strtoui(optarg, NULL,&num,0,PSD_MAX_RATE)) {
|
xtables_error(PARAMETER_PROBLEM, "bad --psd-lo-ports-weight '%s'", optarg);
|
||||||
xtables_error(PARAMETER_PROBLEM,"bad --psd-lo-ports-weight '%s'", optarg);
|
|
||||||
}
|
|
||||||
psdinfo->lo_ports_weight = num;
|
psdinfo->lo_ports_weight = num;
|
||||||
*flags |= XT_PSD_OPT_LPWEIGHT;
|
*flags |= XT_PSD_OPT_LPWEIGHT;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* PSD-hi-ports-weight */
|
/* PSD-hi-ports-weight */
|
||||||
case '4':
|
case '4':
|
||||||
if(*flags & XT_PSD_OPT_HPWEIGHT) {
|
if (*flags & XT_PSD_OPT_HPWEIGHT)
|
||||||
xtables_error(PARAMETER_PROBLEM, "Can't specify --psd-hi-ports-weight twice");
|
xtables_error(PARAMETER_PROBLEM, "Can't specify --psd-hi-ports-weight twice");
|
||||||
}
|
if (!xtables_strtoui(optarg, NULL, &num, 0, PSD_MAX_RATE))
|
||||||
if(!xtables_strtoui(optarg, NULL, &num, 0, PSD_MAX_RATE)) {
|
|
||||||
xtables_error(PARAMETER_PROBLEM, "bad --psd-hi-ports-weight '%s'", optarg);
|
xtables_error(PARAMETER_PROBLEM, "bad --psd-hi-ports-weight '%s'", optarg);
|
||||||
}
|
|
||||||
psdinfo->hi_ports_weight = num;
|
psdinfo->hi_ports_weight = num;
|
||||||
*flags |= XT_PSD_OPT_HPWEIGHT;
|
*flags |= XT_PSD_OPT_HPWEIGHT;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Final check; nothing. */
|
/* Final check; nothing. */
|
||||||
|
@@ -139,12 +139,10 @@ xt_psd_match(const struct sk_buff *pskb, const struct xt_match_param *match)
|
|||||||
src_port = tcph->source;
|
src_port = tcph->source;
|
||||||
dest_port = tcph->dest;
|
dest_port = tcph->dest;
|
||||||
|
|
||||||
if (proto == IPPROTO_TCP) {
|
if (proto == IPPROTO_TCP)
|
||||||
tcp_flags = *((u_int8_t*)tcph + 13);
|
tcp_flags = *((u_int8_t*)tcph + 13);
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
tcp_flags = 0x00;
|
tcp_flags = 0x00;
|
||||||
}
|
|
||||||
|
|
||||||
/* We're using IP address 0.0.0.0 for a special purpose here, so don't let
|
/* We're using IP address 0.0.0.0 for a special purpose here, so don't let
|
||||||
* them spoof us. [DHCP needs this feature - HW] */
|
* them spoof us. [DHCP needs this feature - HW] */
|
||||||
|
Reference in New Issue
Block a user