void br_cmd_showmacs(struct bridge *br, char *arg0, char *arg1) { struct fdb_entry fdb[1024]; int offset; printf("port no\tmac addr\t\tis local?\tageing timer\n"); offset = 0; while (1) { int i; int num; num = br_read_fdb(br, fdb, offset, 1024); if (!num) break; qsort(fdb, num, sizeof(struct fdb_entry), compare_fdbs); #ifdef CONFIG_NSBBOX_BRCTL_MAT_STATUS #define MACADDRPOOL_CLONE_PATH "/runtime/phyinf:1/macaddrpool/entry" { struct fdb_entry *pfdb; unsigned char value[20]; unsigned char path[50]; int j=1; xmldbc_del(NULL, 0, MACADDRPOOL_CLONE_PATH); for (i=0;i<num;i++){ pfdb = (struct fdb_entry *)(fdb+i); __dump_fdb_entry(fdb+i); if ((pfdb->port_no==1)&&(pfdb->is_local != 1)){ memset(path, 0x0, sizeof(path)); memset(value, 0x0, sizeof(value)); sprintf(path, "%s:%d/macaddr", MACADDRPOOL_CLONE_PATH, j); sprintf(value, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", pfdb->mac_addr[0], pfdb->mac_addr[1], pfdb->mac_addr[2], pfdb->mac_addr[3], pfdb->mac_addr[4], pfdb->mac_addr[5]); //printf("%s %s\n", path, value); xmldbc_set(NULL, 0, path, value); j++; } } } #else for (i=0;i<num;i++) __dump_fdb_entry(fdb+i); #endif /*CONFIG_NSBBOX_BRCTL_MAT_STATUS*/ offset += num; } }
void br_cmd_showmacs(struct bridge *br, char *arg0, char *arg1) { struct fdb_entry fdb[1024]; int offset; printf("port no\tmac addr\t\tis local?\tageing timer\n"); offset = 0; while (1) { int i; int num; #ifdef GUEST_ZONE num = br_read_fdb(br, fdb, offset, 1024, 0); #else num = br_read_fdb(br, fdb, offset, 1024); #endif if (!num) break; qsort(fdb, num, sizeof(struct fdb_entry), compare_fdbs); for (i=0;i<num;i++) __dump_fdb_entry(fdb+i); offset += num; } }