Bug 1169901 - ip rule help output contains action reject, but this action does not work
Summary: ip rule help output contains action reject, but this action does not work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: iproute
Version: 7.1
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Pavel Šimerda (pavlix)
QA Contact: Jaroslav Aster
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-02 16:32 UTC by Jaroslav Aster
Modified: 2015-11-19 14:40 UTC (History)
1 user (show)

Fixed In Version: iproute-3.10.0-42.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1243413 (view as bug list)
Environment:
Last Closed: 2015-11-19 14:40:36 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2117 normal SHIPPED_LIVE iproute bug fix and enhancement update 2015-11-19 11:35:06 UTC

Description Jaroslav Aster 2014-12-02 16:32:53 UTC
Description of problem:

ip rule help output contains action reject, but this action does not work. This action is in man-page too, but only in the beginning, where syntax of all options is described, but action is not described in the text bellow. I checked the source code and there is no action reject.


Version-Release number of selected component (if applicable):

iproute-3.10.0-21.el7


How reproducible:

Always.


Steps to Reproduce:

# ip rule help
Usage: ip rule [ list | add | del | flush ] SELECTOR ACTION
SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ tos TOS ] [ fwmark FWMARK[/MASK] ]
            [ iif STRING ] [ oif STRING ] [ pref NUMBER ]
ACTION := [ table TABLE_ID ]
          [ prohibit | reject | unreachable ]
          [ realms [SRCREALM/]DSTREALM ]
          [ goto NUMBER ]
TABLE_ID := [ local | main | default | NUMBER ]

# ip rule help 2>&1|grep reject
          [ prohibit | reject | unreachable ]

# ip rule add from 10.0.1.1 reject
Error: argument "reject" is wrong: Failed to parse rule type

# man ip-rule | col -b | grep reject
       ACTION := [ table TABLE_ID ] [ nat ADDRESS ] [ prohibit | reject | unreachable ] [ realms [SRCREALM/]DSTREALM ]


Actual results:

There is action reject in ip rule help and man-page ip-rule.


Expected results:

There is no action in ip rule help and man-page ip-rule.


Additional info:

Comment 1 Pavel Šimerda (pavlix) 2015-04-07 20:46:01 UTC
Applies to upstream as well.

Comment 2 Pavel Šimerda (pavlix) 2015-06-04 14:10:39 UTC
From iprule.c:

	fprintf(stderr, "ACTION := [ table TABLE_ID ]\n");
	fprintf(stderr, "          [ prohibit | reject | unreachable ]\n");
	fprintf(stderr, "          [ realms [SRCREALM/]DSTREALM ]\n");
	fprintf(stderr, "          [ goto NUMBER ]\n");
	fprintf(stderr, "          SUPPRESSOR\n");

...

			else if (rtnl_rtntype_a2n(&type, *argv))
				invarg("Failed to parse rule type", *argv);

From rtm_map.c:


int rtnl_rtntype_a2n(int *id, char *arg)
{
	char *end;
	unsigned long res;

	if (strcmp(arg, "local") == 0)
		res = RTN_LOCAL;
	else if (strcmp(arg, "nat") == 0)
		res = RTN_NAT;
	else if (matches(arg, "broadcast") == 0 ||
		 strcmp(arg, "brd") == 0)
		res = RTN_BROADCAST;
	else if (matches(arg, "anycast") == 0)
		res = RTN_ANYCAST;
	else if (matches(arg, "multicast") == 0)
		res = RTN_MULTICAST;
	else if (matches(arg, "prohibit") == 0)
		res = RTN_PROHIBIT;
	else if (matches(arg, "unreachable") == 0)
		res = RTN_UNREACHABLE;
	else if (matches(arg, "blackhole") == 0)
		res = RTN_BLACKHOLE;
	else if (matches(arg, "xresolve") == 0)
		res = RTN_XRESOLVE;
	else if (matches(arg, "unicast") == 0)
		res = RTN_UNICAST;
	else if (strcmp(arg, "throw") == 0)
		res = RTN_THROW;
	else {
		res = strtoul(arg, &end, 0);
		if (!end || end == arg || *end || res > 255)
			return -1;
	}
	*id = res;
	return 0;
}

I am not entirely sure why only prohibit, reject and unreachable are listed but "reject" is clearly not one of the valid values. I'm going to submit its removal upstream but feel free to comment on the whole situation.

Comment 7 errata-xmlrpc 2015-11-19 14:40:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2117.html


Note You need to log in before you can comment on or make changes to this bug.