diff --git a/ZodiacFX/src/command.c b/ZodiacFX/src/command.c index 8c1befa..9e1ae0a 100644 --- a/ZodiacFX/src/command.c +++ b/ZodiacFX/src/command.c @@ -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) { @@ -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: @@ -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)); } @@ -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: @@ -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; }; } @@ -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); } diff --git a/ZodiacFX/src/config/config_zodiac.h b/ZodiacFX/src/config/config_zodiac.h index d24b34d..543f272 100644 --- a/ZodiacFX/src/config/config_zodiac.h +++ b/ZodiacFX/src/config/config_zodiac.h @@ -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 diff --git a/ZodiacFX/src/http.c b/ZodiacFX/src/http.c index 9846d63..cb24118 100644 --- a/ZodiacFX/src/http.c +++ b/ZodiacFX/src/http.c @@ -2150,7 +2150,7 @@ static uint8_t interfaceCreate_Upload(void) "
Browser firmware update supports official binaries (version 0.80 and later).
Please find the latest version in the forums.
Browser firmware update supports official binaries (version 0.81 and later).
Please find the latest version in the forums.