Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e5e7013 authored by Mohammed Javid's avatar Mohammed Javid
Browse files

msm: ipa: Protect ipa default routing table



Protect ipa default routing table from
addition, deletion and modification once after
default rule added by ipa-driver.

Change-Id: I045d9c29fed23edf796d826e440b81124e1f666a
Signed-off-by: default avatarMohammed Javid <mjavid@codeaurora.org>
parent 9c5d11e0
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -1223,13 +1223,12 @@ static int __ipa_add_rt_rule(enum ipa_ip_type ip, const char *name,
		goto error;
	}
	/*
	 * do not allow any rules to be added at end of the "default" routing
	 * tables
	 * do not allow any rule to be added at "default" routing
	 * table
	 */
	if (!strcmp(tbl->name, IPA_DFLT_RT_TBL_NAME) &&
	    (tbl->rule_cnt > 0) && (at_rear != 0)) {
		IPAERR_RL("cannot add rule at end of tbl rule_cnt=%d at_rear=%d"
				, tbl->rule_cnt, at_rear);
	    (tbl->rule_cnt > 0)) {
		IPAERR_RL("cannot add rules to default rt table\n");
		goto error;
	}

@@ -1452,13 +1451,12 @@ int ipa3_add_rt_rule_after(struct ipa_ioc_add_rt_rule_after *rules)
	}

	/*
	 * do not allow any rules to be added at end of the "default" routing
	 * tables
	 * do not allow any rule to be added at "default" routing
	 * table
	 */
	if (!strcmp(tbl->name, IPA_DFLT_RT_TBL_NAME) &&
			(&entry->link == tbl->head_rt_rule_list.prev)) {
		IPAERR_RL("cannot add rule at end of tbl rule_cnt=%d\n",
			tbl->rule_cnt);
		(tbl->rule_cnt > 0)) {
		IPAERR_RL("cannot add rules to default rt table\n");
		ret = -EINVAL;
		goto bail;
	}
@@ -1916,6 +1914,10 @@ static int __ipa_mdfy_rt_rule(struct ipa_rt_rule_mdfy *rtrule)
		goto error;
	}

	if (!strcmp(entry->tbl->name, IPA_DFLT_RT_TBL_NAME)) {
		IPAERR_RL("Default tbl rule cannot be modified\n");
		return -EINVAL;
	}
	/* Adding check to confirm still
	 * header entry present in header table or not
	 */