/*
* Distributed under the terms of the GNU GPL version 2.
- * Copyright (c) 2007 The Board of Trustees of The Leland Stanford Junior Univer
-sity
+ * Copyright (c) 2007, 2008 The Board of Trustees of The Leland
+ * Stanford Junior University
*/
#include <linux/skbuff.h>
set_action_data(struct sk_buff *skb, struct sw_flow_key *key, struct ofp_action *a)
{
if (key != NULL) {
- switch(a->type) {
+ switch(ntohs(a->type)) {
case(OFPAT_SET_DL_SRC):
memcpy(a->arg.dl_addr, key->dl_src, sizeof key->dl_src);
break;
}
if (a != NULL) {
- switch(a->type) {
+ switch(ntohs(a->type)) {
case(OFPAT_SET_DL_SRC):
if (memcmp(a->arg.dl_addr, eh->h_source, sizeof eh->h_source) != 0) {
unit_fail("Source eth addr has not been set");
test_l3_l4(void)
{
struct ofp_action action;
+ uint16_t a_type;
struct sk_buff *skb;
struct sw_flow_key key;
unsigned int i, j;
if (unit_failed())
return;
- for (action.type = OFPAT_SET_DL_SRC;
- action.type <= OFPAT_SET_TP_DST;
- action.type++)
+ for (a_type = OFPAT_SET_DL_SRC;
+ a_type <= OFPAT_SET_TP_DST;
+ a_type++)
{
+ action.type = htons(a_type);
set_action_data(skb, NULL, &action);
for(j = 0; j < 2; j++) {
skb = execute_setter(skb, eth_proto, &key, &action);
if (ret != 0)
break;
}
+
+ if (ret == 0)
+ printk("\nL3/L4 actions test passed.\n");
}
int
eh = eth_hdr(skb);
orig_id = eh->h_proto;
- action.type = OFPAT_SET_DL_VLAN;
+ action.type = htons(OFPAT_SET_DL_VLAN);
// Add a random vlan tag
new_id = (uint16_t) random32() & VLAN_VID_MASK;
printk("\nVLAN actions test passed.\n");
return ret;
-
-
}
/*