|
|
| version 1.6, 2004/01/06 03:17:25 | version 1.7, 2004/04/22 04:21:32 |
|---|---|
| Line 243 add_cluster(u_int16_t cluster_id, struct | Line 243 add_cluster(u_int16_t cluster_id, struct |
| goto found; | goto found; |
| /* Not found, need to reallocate */ | /* Not found, need to reallocate */ |
| c = malloc((1+n_clusters) * sizeof (*c), M_IFADDR, M_NOWAIT | M_ZERO); | c = malloc((1+n_clusters) * sizeof (*c), M_IFADDR, M_WAITOK | M_ZERO); |
| if (c == NULL) {/* malloc failure */ | c[n_clusters].ht = malloc(HASH_SIZE * sizeof(struct hash_table), |
| printf("-- bridge: cannot add new cluster\n"); | M_IFADDR, M_WAITOK | M_ZERO); |
| return NULL; | c[n_clusters].my_macs = malloc(BDG_MAX_PORTS * sizeof(struct bdg_addr), |
| } | M_IFADDR, M_WAITOK | M_ZERO); |
| c[n_clusters].ht = (struct hash_table *) | |
| malloc(HASH_SIZE * sizeof(struct hash_table), | |
| M_IFADDR, M_WAITOK | M_ZERO); | |
| if (c[n_clusters].ht == NULL) { | |
| printf("-- bridge: cannot allocate hash table for new cluster\n"); | |
| free(c, M_IFADDR); | |
| return NULL; | |
| } | |
| c[n_clusters].my_macs = (struct bdg_addr *) | |
| malloc(BDG_MAX_PORTS * sizeof(struct bdg_addr), | |
| M_IFADDR, M_WAITOK | M_ZERO); | |
| if (c[n_clusters].my_macs == NULL) { | |
| printf("-- bridge: cannot allocate mac addr table for new cluster\n"); | |
| free(c[n_clusters].ht, M_IFADDR); | |
| free(c, M_IFADDR); | |
| return NULL; | |
| } | |
| c[n_clusters].cluster_id = cluster_id; | c[n_clusters].cluster_id = cluster_id; |
| c[n_clusters].ports = 0; | c[n_clusters].ports = 0; |