Thread (44 messages) flat view 44 messages, 4 authors, 2005-01-16

Re: [RFC] meta ematch

From: Thomas Graf <tgraf@suug.ch>
Date: 2005-01-16 16:49:05

* jamal [ref] 2005-01-16 11:19
quoted
quoted
I am not sure iam following yet:

So in the case of indev, you would need to 
- get indev ifindex from skb
- get indev name from skb
- compare the two??
Can you explain the above in context of indev = "eth0"? I am still not
sure i get it:

+     if (meta_get(skb, info, &meta->lvalue, &l_value) < 0 ||
+         meta_get(skb, info, &meta->rvalue, &r_value) < 0)
+             return 0;
+     r = meta_type_ops(&meta->lvalue)->compare(&l_value, &r_value);
Sure, indev = "eth0"

TCA_EM_META_HDR = {
	.left = {
		.kind = TCF_META_TYPE_VAR << 12 | TCF_META_ID_INDEV,
		.op = TCF_EM_EQ,
	},
	.right = {
		.kind = TCF_META_TYPE_VAR << 12 | TCF_META_ID_VALUE,
	},
};

TCA_EM_META_LVALUE = EMPTY; /* unused */
TCA_EM_META_RVALUE = "eth0"

The configuration part will transform this into:

struct meta_match = {
	.lvalue = {
		.hdr = {
			.kind = TCF_META_TYPE_VAR << 12 | TCF_META_ID_INDEV,
			.op = TCF_EM_EQ,
		},
	},
	.rvalue = {
		.hdr = {
			.kind = TCF_META_TYPE_VAR << 12 | TCF_META_ID_VALUE,
		}
		.val = strdup("eth0"),
		.len = strlen("eth0"),
	},
}

meta_get will make meta_obj's out of it:

struct meta_obj l_value = {
	.value = dev->name,
	.len = strlen(dev->name),
},

struct meta_obj r_value = {
	.value = "eth0",
	.len = strlen("eth0"),
}

the type specific compare will compare these.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help