Skip to content

Commit

Permalink
Merge pull request #87 from pzanna/master
Browse files Browse the repository at this point in the history
v0.83
  • Loading branch information
pzanna authored Feb 3, 2018
2 parents f12d0c2 + 956ae88 commit 95f25d6
Show file tree
Hide file tree
Showing 6 changed files with 312 additions and 34 deletions.
137 changes: 131 additions & 6 deletions ZodiacFX/src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,36 @@ void command_root(char *command, char *param1, char *param2, char *param3)
return;
}

// Build shortcut - c to show config is saved
if (strcmp(command, "c")==0)
{
printf("\r\n");
printf("Build Configuration Check\r\n");
printf("-------------------------\r\n");
printf(" Name: %s\r\n",Zodiac_Config.device_name);
printf(" MAC Address: %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\r\n",Zodiac_Config.MAC_address[0], Zodiac_Config.MAC_address[1], Zodiac_Config.MAC_address[2], Zodiac_Config.MAC_address[3], Zodiac_Config.MAC_address[4], Zodiac_Config.MAC_address[5]);
printf(" IP Address: %d.%d.%d.%d\r\n" , Zodiac_Config.IP_address[0], Zodiac_Config.IP_address[1], Zodiac_Config.IP_address[2], Zodiac_Config.IP_address[3]);
printf(" Netmask: %d.%d.%d.%d\r\n" , Zodiac_Config.netmask[0], Zodiac_Config.netmask[1], Zodiac_Config.netmask[2], Zodiac_Config.netmask[3]);
printf(" Gateway: %d.%d.%d.%d\r\n" , Zodiac_Config.gateway_address[0], Zodiac_Config.gateway_address[1], Zodiac_Config.gateway_address[2], Zodiac_Config.gateway_address[3]);
printf(" OpenFlow Controller: %d.%d.%d.%d\r\n" , Zodiac_Config.OFIP_address[0], Zodiac_Config.OFIP_address[1], Zodiac_Config.OFIP_address[2], Zodiac_Config.OFIP_address[3]);
printf(" OpenFlow Port: %d\r\n" , Zodiac_Config.OFPort);
if (Zodiac_Config.OFEnabled == OF_ENABLED) printf(" Openflow Status: Enabled\r\n");
if (Zodiac_Config.OFEnabled == OF_DISABLED) printf(" Openflow Status: Disabled\r\n");
if (Zodiac_Config.failstate == 0) printf(" Failstate: Secure\r\n");
if (Zodiac_Config.failstate == 1) printf(" Failstate: Safe\r\n");
if (Zodiac_Config.of_version == 1) {
printf(" Force OpenFlow version: 1.0 (0x01)\r\n");
} else if (Zodiac_Config.of_version == 4){
printf(" Force OpenFlow version: 1.3 (0x04)\r\n");
} else {
printf(" Force OpenFlow version: Disabled\r\n");
}
if (Zodiac_Config.ethtype_filter == 1) printf(" EtherType Filtering: Enabled\r\n");
if (Zodiac_Config.ethtype_filter != 1) printf(" EtherType Filtering: Disabled\r\n");
printf("\r\n\n");
return;
}

// Restart switch
if (strcmp(command, "restart")==0)
{
Expand Down Expand Up @@ -1101,9 +1131,16 @@ void command_openflow(char *command, char *param1, char *param2, char *param3)
case OFPXMT_OFB_ETH_TYPE:
memcpy(&oxm_value16, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 2);
if (ntohs(oxm_value16) == 0x0806)printf(" ETH Type: ARP\r\n");
if (ntohs(oxm_value16) == 0x0800)printf(" ETH Type: IPv4\r\n");
if (ntohs(oxm_value16) == 0x86dd)printf(" ETH Type: IPv6\r\n");
if (ntohs(oxm_value16) == 0x8100)printf(" ETH Type: VLAN\r\n");
else if (ntohs(oxm_value16) == 0x0800)printf(" ETH Type: IPv4\r\n");
else if (ntohs(oxm_value16) == 0x86dd)printf(" ETH Type: IPv6\r\n");
else if (ntohs(oxm_value16) == 0x8100)printf(" ETH Type: VLAN\r\n");
else if (ntohs(oxm_value16) == 0x888e)printf(" ETH Type: EAPOL\r\n");
else if (ntohs(oxm_value16) == 0x88cc)printf(" ETH Type: LLDP\r\n");
else if (ntohs(oxm_value16) == 0x8999)printf(" ETH Type: BDDP\r\n");
else if (ntohs(oxm_value16) == 0x9100)printf(" ETH Type: VLAN(D)\r\n");
else if (ntohs(oxm_value16) == 0x8847)printf(" ETH Type: MPLS (Unicast)\r\n");
else if (ntohs(oxm_value16) == 0x8848)printf(" ETH Type: MPLS (Multicast)\r\n");
else printf(" ETH Type: 0x%X\r\n",ntohs(oxm_value16));
break;

case OFPXMT_OFB_IP_PROTO:
Expand Down Expand Up @@ -1170,6 +1207,61 @@ void command_openflow(char *command, char *param1, char *param2, char *param3)
if (oxm_value16 != 0) printf(" VLAN ID: %d\r\n",(ntohs(oxm_value16) - OFPVID_PRESENT));
break;

case OFPXMT_OFB_MPLS_LABEL:
memcpy(&oxm_value32, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 4);
if (oxm_value32 != 0) printf(" MPLS Label: %d\r\n",(ntohl(oxm_value32)));
break;

case OFPXMT_OFB_MPLS_TC:
memcpy(&oxm_value8, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 1);
if (oxm_value8 != 0) printf(" MPLS TC: %d\r\n",(oxm_value8));
break;

case OFPXMT_OFB_MPLS_BOS:
memcpy(&oxm_value8, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 1);
if (oxm_value8 != 0) printf(" MPLS BoS: %d\r\n",(oxm_value8));
break;

case OFPXMT_OFB_ARP_OP:
memcpy(&oxm_value16, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 2);
if (oxm_value16 == 1) printf(" ARP OP Code: Request (%d)\r\n",ntohs(oxm_value16));
if (oxm_value16 == 2) printf(" ARP OP Code: Reply (%d)\r\n",ntohs(oxm_value16));
break;

case OFPXMT_OFB_ARP_SPA:
if (has_mask)
{
memcpy(&oxm_ipv4, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 8);
printf(" Source IP: %d.%d.%d.%d / %d.%d.%d.%d\r\n", oxm_ipv4[0], oxm_ipv4[1], oxm_ipv4[2], oxm_ipv4[3], oxm_ipv4[4], oxm_ipv4[5], oxm_ipv4[6], oxm_ipv4[7]);
} else {
memcpy(&oxm_ipv4, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 4);
printf(" Source IP: %d.%d.%d.%d\r\n", oxm_ipv4[0], oxm_ipv4[1], oxm_ipv4[2], oxm_ipv4[3]);
}
break;

case OFPXMT_OFB_ARP_TPA:
if (has_mask)
{
memcpy(&oxm_ipv4, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 8);
printf(" Target IP: %d.%d.%d.%d / %d.%d.%d.%d\r\n", oxm_ipv4[0], oxm_ipv4[1], oxm_ipv4[2], oxm_ipv4[3], oxm_ipv4[4], oxm_ipv4[5], oxm_ipv4[6], oxm_ipv4[7]);
} else {
memcpy(&oxm_ipv4, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 4);
printf(" Target IP: %d.%d.%d.%d\r\n", oxm_ipv4[0], oxm_ipv4[1], oxm_ipv4[2], oxm_ipv4[3]);
}
break;

case OFPXMT_OFB_ARP_SHA:
memcpy(&oxm_eth, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 6);
printf(" Source MAC: %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\r\n", oxm_eth[0], oxm_eth[1], oxm_eth[2], oxm_eth[3], oxm_eth[4], oxm_eth[5]);
break;

case OFPXMT_OFB_ARP_THA:
memcpy(&oxm_eth, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 6);
printf(" Target MAC: %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\r\n", oxm_eth[0], oxm_eth[1], oxm_eth[2], oxm_eth[3], oxm_eth[4], oxm_eth[5]);
break;



};
match_size += (oxm_header.oxm_len + sizeof(struct oxm_header13));
}
Expand Down Expand Up @@ -1263,9 +1355,16 @@ void command_openflow(char *command, char *param1, char *param2, char *param3)
case OFPXMT_OFB_ETH_TYPE:
memcpy(&oxm_value16, act_set_field->field + sizeof(struct oxm_header13), 2);
if (ntohs(oxm_value16) == 0x0806 )printf(" Set ETH Type: ARP\r\n");
if (ntohs(oxm_value16) == 0x0800 )printf(" Set ETH Type: IPv4\r\n");
if (ntohs(oxm_value16) == 0x86dd )printf(" Set ETH Type: IPv6\r\n");
if (ntohs(oxm_value16) == 0x8100 )printf(" Set ETH Type: VLAN\r\n");
else if (ntohs(oxm_value16) == 0x0800)printf(" Set ETH Type: IPv4\r\n");
else if (ntohs(oxm_value16) == 0x86dd)printf(" Set ETH Type: IPv6\r\n");
else if (ntohs(oxm_value16) == 0x8100)printf(" Set ETH Type: VLAN\r\n");
else if (ntohs(oxm_value16) == 0x888e)printf(" Set ETH Type: EAPOL\r\n");
else if (ntohs(oxm_value16) == 0x88cc)printf(" Set ETH Type: LLDP\r\n");
else if (ntohs(oxm_value16) == 0x8999)printf(" Set ETH Type: BDDP\r\n");
else if (ntohs(oxm_value16) == 0x9100)printf(" Set ETH Type: VLAN(D)\r\n");
else if (ntohs(oxm_value16) == 0x8847)printf(" Set ETH Type: MPLS (Unicast)\r\n");
else if (ntohs(oxm_value16) == 0x8848)printf(" Set ETH Type: MPLS (Multicast)\r\n");
else printf(" Set ETH Type: VLAN\r\n",ntohs(oxm_value16));
break;

case OFPXMT_OFB_IPV4_SRC:
Expand Down Expand Up @@ -1339,6 +1438,21 @@ void command_openflow(char *command, char *param1, char *param2, char *param3)
memcpy(&oxm_eth, act_set_field->field + sizeof(struct oxm_header13), 6);
printf(" Set ARP Target HA: %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\r\n", oxm_eth[0], oxm_eth[1], oxm_eth[2], oxm_eth[3], oxm_eth[4], oxm_eth[5]);
break;

case OFPXMT_OFB_MPLS_LABEL:
memcpy(&oxm_value32, act_set_field->field + sizeof(struct oxm_header13), 4);
printf(" Set MPLS Label: %d\r\n",ntohl(oxm_value32));
break;

case OFPXMT_OFB_MPLS_TC:
memcpy(&oxm_value8, act_set_field->field + sizeof(struct oxm_header13), 1);
printf(" Set MPLS TC: %d\r\n",ntohs(oxm_value8));
break;

case OFPXMT_OFB_MPLS_BOS:
memcpy(&oxm_value8, act_set_field->field + sizeof(struct oxm_header13), 1);
printf(" Set MPLS BoS: %d\r\n",ntohs(oxm_value8));
break;

};
}
Expand All @@ -1353,6 +1467,17 @@ void command_openflow(char *command, char *param1, char *param2, char *param3)
{
printf(" Pop VLAN tag\r\n");
}

if (htons(act_hdr->type) == OFPAT13_PUSH_MPLS)
{
struct ofp13_action_push *act_push = act_hdr;
printf(" Push MPLS tag\r\n");
}

if (htons(act_hdr->type) == OFPAT13_POP_MPLS)
{
printf(" Pop MPLS tag\r\n");
}

act_size += htons(act_hdr->len);
}
Expand Down
2 changes: 1 addition & 1 deletion ZodiacFX/src/config/config_zodiac.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define CONFIG_ZODIAC_H_


#define VERSION "0.82" // Firmware version number
#define VERSION "0.83" // Firmware version number

#define TOTAL_PORTS 4 // Total number of physical ports on the Zodiac FX

Expand Down
55 changes: 51 additions & 4 deletions ZodiacFX/src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -2150,7 +2150,7 @@ static uint8_t interfaceCreate_Upload(void)
"<h2>Firmware Update</h2>"\
"</p>"\
"<body>"\
"<p>Browser firmware update supports official binaries (version 0.80 and later).<br><br>Please find the latest version in the <a href=\"http://forums.northboundnetworks.com/index.php?PHPSESSID=39c9227476da4ef211c9c3b1fa235951&topic=52.0\">forums</a>.</p>"\
"<p>Browser firmware update supports official binaries (version 0.81 and later).<br><br>Please find the latest version in the <a href=\"http://forums.northboundnetworks.com/index.php?PHPSESSID=39c9227476da4ef211c9c3b1fa235951&topic=52.0\">forums</a>.</p>"\
"<form action=\"upload\" method =\"post\" enctype=\"multipart/form-data\" onsubmit=\"return confirm('Firmware file will now be uploaded. This may take up to 60 seconds. DO NOT refresh the page while firmware update is in progress.');\">"\
"<input type=\"file\" name =\"file\"><br><br>"\
"<input type=\"submit\" value=\"Upload File\"/>"\
Expand Down Expand Up @@ -3078,9 +3078,16 @@ if (iLastFlow > 0)
case OFPXMT_OFB_ETH_TYPE:
memcpy(&oxm_value16, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 2);
if (ntohs(oxm_value16) == 0x0806)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: ARP\r\n");
if (ntohs(oxm_value16) == 0x0800)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: IPv4\r\n");
if (ntohs(oxm_value16) == 0x86dd)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: IPv6\r\n");
if (ntohs(oxm_value16) == 0x8100)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: VLAN\r\n");
else if (ntohs(oxm_value16) == 0x0800)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: IPv4\r\n");
else if (ntohs(oxm_value16) == 0x86dd)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: IPv6\r\n");
else if (ntohs(oxm_value16) == 0x8100)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: VLAN\r\n");
else if (ntohs(oxm_value16) == 0x9100)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: VLAN(D)\r\n");
else if (ntohs(oxm_value16) == 0x888e)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: EAPOL\r\n");
else if (ntohs(oxm_value16) == 0x88cc)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: LLDP\r\n");
else if (ntohs(oxm_value16) == 0x8999)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: BDDP\r\n");
else if (ntohs(oxm_value16) == 0x8847)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: MPLS (Unicast)\r\n");
else if (ntohs(oxm_value16) == 0x8848)snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: MPLS (Multicast)\r\n");
else snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," ETH Type: 0x%X\r\n", ntohs(oxm_value16));
break;

case OFPXMT_OFB_IP_PROTO:
Expand Down Expand Up @@ -3146,6 +3153,21 @@ if (iLastFlow > 0)
memcpy(&oxm_value16, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 2);
if (oxm_value16 != 0) snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," VLAN ID: %d\r\n",(ntohs(oxm_value16) - OFPVID_PRESENT));
break;

case OFPXMT_OFB_MPLS_LABEL:
memcpy(&oxm_value32, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 4);
if (oxm_value32 != 0) snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," MPLS Label: %d\r\n",(ntohl(oxm_value32)));
break;

case OFPXMT_OFB_MPLS_TC:
memcpy(&oxm_value8, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 1);
if (oxm_value8 != 0) snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," MPLS TC: %d\r\n",(oxm_value8));
break;

case OFPXMT_OFB_MPLS_BOS:
memcpy(&oxm_value8, ofp13_oxm_match[i] + sizeof(struct oxm_header13) + match_size, 1);
if (oxm_value8 != 0) snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," MPLS BoS: %d\r\n",(oxm_value8));
break;

};
match_size += (oxm_header.oxm_len + sizeof(struct oxm_header13));
Expand Down Expand Up @@ -3317,6 +3339,20 @@ if (iLastFlow > 0)
snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," Set ARP Target HA: %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\r\n", oxm_eth[0], oxm_eth[1], oxm_eth[2], oxm_eth[3], oxm_eth[4], oxm_eth[5]);
break;

case OFPXMT_OFB_MPLS_LABEL:
memcpy(&oxm_value32, act_set_field->field + sizeof(struct oxm_header13), 4);
snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," Set MPLS Label: %d\r\n", ntohl(oxm_value32));

break;
case OFPXMT_OFB_MPLS_TC:
memcpy(&oxm_value8, act_set_field->field + sizeof(struct oxm_header13), 1);
snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," Set MPLS TC: %d\r\n", oxm_value8);
break;

case OFPXMT_OFB_MPLS_BOS:
memcpy(&oxm_value8, act_set_field->field + sizeof(struct oxm_header13), 1);
snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," Set MPLS BoS: %d\r\n", oxm_value8);
break;
};
}

Expand All @@ -3331,6 +3367,17 @@ if (iLastFlow > 0)
snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," Pop VLAN tag\r\n");
}

if (htons(act_hdr->type) == OFPAT13_PUSH_MPLS)
{
struct ofp13_action_push *act_push = act_hdr;
snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," Push MPLS tag\r\n");
}

if (htons(act_hdr->type) == OFPAT13_POP_MPLS)
{
snprintf(shared_buffer+strlen(shared_buffer), SHARED_BUFFER_LEN-strlen(shared_buffer)," Pop MPLS tag\r\n");
}

act_size += htons(act_hdr->len);
}
}
Expand Down
Loading

0 comments on commit 95f25d6

Please sign in to comment.