diff options
Diffstat (limited to 'drivers/s390/net/qeth_l3_main.c')
-rw-r--r-- | drivers/s390/net/qeth_l3_main.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 6a73894b0cb5..ef0961e18686 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -164,8 +164,8 @@ static void qeth_l3_convert_addr_to_bits(u8 *addr, u8 *bits, int len) | |||
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | int qeth_l3_is_addr_covered_by_ipato(struct qeth_card *card, | 167 | static bool qeth_l3_is_addr_covered_by_ipato(struct qeth_card *card, |
168 | struct qeth_ipaddr *addr) | 168 | struct qeth_ipaddr *addr) |
169 | { | 169 | { |
170 | struct qeth_ipato_entry *ipatoe; | 170 | struct qeth_ipato_entry *ipatoe; |
171 | u8 addr_bits[128] = {0, }; | 171 | u8 addr_bits[128] = {0, }; |
@@ -174,6 +174,8 @@ int qeth_l3_is_addr_covered_by_ipato(struct qeth_card *card, | |||
174 | 174 | ||
175 | if (!card->ipato.enabled) | 175 | if (!card->ipato.enabled) |
176 | return 0; | 176 | return 0; |
177 | if (addr->type != QETH_IP_TYPE_NORMAL) | ||
178 | return 0; | ||
177 | 179 | ||
178 | qeth_l3_convert_addr_to_bits((u8 *) &addr->u, addr_bits, | 180 | qeth_l3_convert_addr_to_bits((u8 *) &addr->u, addr_bits, |
179 | (addr->proto == QETH_PROT_IPV4)? 4:16); | 181 | (addr->proto == QETH_PROT_IPV4)? 4:16); |
@@ -290,8 +292,7 @@ int qeth_l3_add_ip(struct qeth_card *card, struct qeth_ipaddr *tmp_addr) | |||
290 | memcpy(addr, tmp_addr, sizeof(struct qeth_ipaddr)); | 292 | memcpy(addr, tmp_addr, sizeof(struct qeth_ipaddr)); |
291 | addr->ref_counter = 1; | 293 | addr->ref_counter = 1; |
292 | 294 | ||
293 | if (addr->type == QETH_IP_TYPE_NORMAL && | 295 | if (qeth_l3_is_addr_covered_by_ipato(card, addr)) { |
294 | qeth_l3_is_addr_covered_by_ipato(card, addr)) { | ||
295 | QETH_CARD_TEXT(card, 2, "tkovaddr"); | 296 | QETH_CARD_TEXT(card, 2, "tkovaddr"); |
296 | addr->set_flags |= QETH_IPA_SETIP_TAKEOVER_FLAG; | 297 | addr->set_flags |= QETH_IPA_SETIP_TAKEOVER_FLAG; |
297 | } | 298 | } |
@@ -605,6 +606,27 @@ int qeth_l3_setrouting_v6(struct qeth_card *card) | |||
605 | /* | 606 | /* |
606 | * IP address takeover related functions | 607 | * IP address takeover related functions |
607 | */ | 608 | */ |
609 | |||
610 | /** | ||
611 | * qeth_l3_update_ipato() - Update 'takeover' property, for all NORMAL IPs. | ||
612 | * | ||
613 | * Caller must hold ip_lock. | ||
614 | */ | ||
615 | void qeth_l3_update_ipato(struct qeth_card *card) | ||
616 | { | ||
617 | struct qeth_ipaddr *addr; | ||
618 | unsigned int i; | ||
619 | |||
620 | hash_for_each(card->ip_htable, i, addr, hnode) { | ||
621 | if (addr->type != QETH_IP_TYPE_NORMAL) | ||
622 | continue; | ||
623 | if (qeth_l3_is_addr_covered_by_ipato(card, addr)) | ||
624 | addr->set_flags |= QETH_IPA_SETIP_TAKEOVER_FLAG; | ||
625 | else | ||
626 | addr->set_flags &= ~QETH_IPA_SETIP_TAKEOVER_FLAG; | ||
627 | } | ||
628 | } | ||
629 | |||
608 | static void qeth_l3_clear_ipato_list(struct qeth_card *card) | 630 | static void qeth_l3_clear_ipato_list(struct qeth_card *card) |
609 | { | 631 | { |
610 | struct qeth_ipato_entry *ipatoe, *tmp; | 632 | struct qeth_ipato_entry *ipatoe, *tmp; |
@@ -616,6 +638,7 @@ static void qeth_l3_clear_ipato_list(struct qeth_card *card) | |||
616 | kfree(ipatoe); | 638 | kfree(ipatoe); |
617 | } | 639 | } |
618 | 640 | ||
641 | qeth_l3_update_ipato(card); | ||
619 | spin_unlock_bh(&card->ip_lock); | 642 | spin_unlock_bh(&card->ip_lock); |
620 | } | 643 | } |
621 | 644 | ||
@@ -640,8 +663,10 @@ int qeth_l3_add_ipato_entry(struct qeth_card *card, | |||
640 | } | 663 | } |
641 | } | 664 | } |
642 | 665 | ||
643 | if (!rc) | 666 | if (!rc) { |
644 | list_add_tail(&new->entry, &card->ipato.entries); | 667 | list_add_tail(&new->entry, &card->ipato.entries); |
668 | qeth_l3_update_ipato(card); | ||
669 | } | ||
645 | 670 | ||
646 | spin_unlock_bh(&card->ip_lock); | 671 | spin_unlock_bh(&card->ip_lock); |
647 | 672 | ||
@@ -664,6 +689,7 @@ void qeth_l3_del_ipato_entry(struct qeth_card *card, | |||
664 | (proto == QETH_PROT_IPV4)? 4:16) && | 689 | (proto == QETH_PROT_IPV4)? 4:16) && |
665 | (ipatoe->mask_bits == mask_bits)) { | 690 | (ipatoe->mask_bits == mask_bits)) { |
666 | list_del(&ipatoe->entry); | 691 | list_del(&ipatoe->entry); |
692 | qeth_l3_update_ipato(card); | ||
667 | kfree(ipatoe); | 693 | kfree(ipatoe); |
668 | } | 694 | } |
669 | } | 695 | } |