diff options
-rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 23 | ||||
-rw-r--r-- | net/batman-adv/bitarray.c | 16 | ||||
-rw-r--r-- | net/batman-adv/bitarray.h | 15 | ||||
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 175 | ||||
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.h | 43 | ||||
-rw-r--r-- | net/batman-adv/debugfs.c | 2 | ||||
-rw-r--r-- | net/batman-adv/distributed-arp-table.c | 6 | ||||
-rw-r--r-- | net/batman-adv/hard-interface.c | 15 | ||||
-rw-r--r-- | net/batman-adv/hash.h | 6 | ||||
-rw-r--r-- | net/batman-adv/main.h | 2 | ||||
-rw-r--r-- | net/batman-adv/network-coding.c | 12 | ||||
-rw-r--r-- | net/batman-adv/originator.c | 4 | ||||
-rw-r--r-- | net/batman-adv/originator.h | 2 | ||||
-rw-r--r-- | net/batman-adv/routing.c | 37 | ||||
-rw-r--r-- | net/batman-adv/routing.h | 6 | ||||
-rw-r--r-- | net/batman-adv/soft-interface.c | 6 | ||||
-rw-r--r-- | net/batman-adv/soft-interface.h | 3 | ||||
-rw-r--r-- | net/batman-adv/translation-table.c | 31 |
18 files changed, 205 insertions, 199 deletions
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index eb3435de54b5..7f98a9d39883 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -1168,13 +1168,13 @@ out: | |||
1168 | * @if_incoming: interface where the packet was received | 1168 | * @if_incoming: interface where the packet was received |
1169 | * @if_outgoing: interface for which the retransmission should be considered | 1169 | * @if_outgoing: interface for which the retransmission should be considered |
1170 | * | 1170 | * |
1171 | * Return: 1 if the link can be considered bidirectional, 0 otherwise | 1171 | * Return: true if the link can be considered bidirectional, false otherwise |
1172 | */ | 1172 | */ |
1173 | static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, | 1173 | static bool batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, |
1174 | struct batadv_orig_node *orig_neigh_node, | 1174 | struct batadv_orig_node *orig_neigh_node, |
1175 | struct batadv_ogm_packet *batadv_ogm_packet, | 1175 | struct batadv_ogm_packet *batadv_ogm_packet, |
1176 | struct batadv_hard_iface *if_incoming, | 1176 | struct batadv_hard_iface *if_incoming, |
1177 | struct batadv_hard_iface *if_outgoing) | 1177 | struct batadv_hard_iface *if_outgoing) |
1178 | { | 1178 | { |
1179 | struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface); | 1179 | struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface); |
1180 | struct batadv_neigh_node *neigh_node = NULL, *tmp_neigh_node; | 1180 | struct batadv_neigh_node *neigh_node = NULL, *tmp_neigh_node; |
@@ -1182,9 +1182,10 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, | |||
1182 | u8 total_count; | 1182 | u8 total_count; |
1183 | u8 orig_eq_count, neigh_rq_count, neigh_rq_inv, tq_own; | 1183 | u8 orig_eq_count, neigh_rq_count, neigh_rq_inv, tq_own; |
1184 | unsigned int neigh_rq_inv_cube, neigh_rq_max_cube; | 1184 | unsigned int neigh_rq_inv_cube, neigh_rq_max_cube; |
1185 | int tq_asym_penalty, inv_asym_penalty, if_num, ret = 0; | 1185 | int tq_asym_penalty, inv_asym_penalty, if_num; |
1186 | unsigned int combined_tq; | 1186 | unsigned int combined_tq; |
1187 | int tq_iface_penalty; | 1187 | int tq_iface_penalty; |
1188 | bool ret = false; | ||
1188 | 1189 | ||
1189 | /* find corresponding one hop neighbor */ | 1190 | /* find corresponding one hop neighbor */ |
1190 | rcu_read_lock(); | 1191 | rcu_read_lock(); |
@@ -1296,7 +1297,7 @@ static int batadv_iv_ogm_calc_tq(struct batadv_orig_node *orig_node, | |||
1296 | * consider it bidirectional | 1297 | * consider it bidirectional |
1297 | */ | 1298 | */ |
1298 | if (batadv_ogm_packet->tq >= BATADV_TQ_TOTAL_BIDRECT_LIMIT) | 1299 | if (batadv_ogm_packet->tq >= BATADV_TQ_TOTAL_BIDRECT_LIMIT) |
1299 | ret = 1; | 1300 | ret = true; |
1300 | 1301 | ||
1301 | out: | 1302 | out: |
1302 | if (neigh_node) | 1303 | if (neigh_node) |
@@ -1325,9 +1326,9 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, | |||
1325 | struct batadv_orig_ifinfo *orig_ifinfo = NULL; | 1326 | struct batadv_orig_ifinfo *orig_ifinfo = NULL; |
1326 | struct batadv_neigh_node *neigh_node; | 1327 | struct batadv_neigh_node *neigh_node; |
1327 | struct batadv_neigh_ifinfo *neigh_ifinfo; | 1328 | struct batadv_neigh_ifinfo *neigh_ifinfo; |
1328 | int is_dup; | 1329 | bool is_dup; |
1329 | s32 seq_diff; | 1330 | s32 seq_diff; |
1330 | int need_update = 0; | 1331 | bool need_update = false; |
1331 | int set_mark; | 1332 | int set_mark; |
1332 | enum batadv_dup_status ret = BATADV_NO_DUP; | 1333 | enum batadv_dup_status ret = BATADV_NO_DUP; |
1333 | u32 seqno = ntohl(batadv_ogm_packet->seqno); | 1334 | u32 seqno = ntohl(batadv_ogm_packet->seqno); |
@@ -1437,7 +1438,7 @@ batadv_iv_ogm_process_per_outif(const struct sk_buff *skb, int ogm_offset, | |||
1437 | struct sk_buff *skb_priv; | 1438 | struct sk_buff *skb_priv; |
1438 | struct ethhdr *ethhdr; | 1439 | struct ethhdr *ethhdr; |
1439 | u8 *prev_sender; | 1440 | u8 *prev_sender; |
1440 | int is_bidirect; | 1441 | bool is_bidirect; |
1441 | 1442 | ||
1442 | /* create a private copy of the skb, as some functions change tq value | 1443 | /* create a private copy of the skb, as some functions change tq value |
1443 | * and/or flags. | 1444 | * and/or flags. |
diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c index b56bb000a0ab..a0c7913837a5 100644 --- a/net/batman-adv/bitarray.c +++ b/net/batman-adv/bitarray.c | |||
@@ -38,11 +38,11 @@ static void batadv_bitmap_shift_left(unsigned long *seq_bits, s32 n) | |||
38 | * the last sequence number | 38 | * the last sequence number |
39 | * @set_mark: whether this packet should be marked in seq_bits | 39 | * @set_mark: whether this packet should be marked in seq_bits |
40 | * | 40 | * |
41 | * Return: 1 if the window was moved (either new or very old), | 41 | * Return: true if the window was moved (either new or very old), |
42 | * 0 if the window was not moved/shifted. | 42 | * false if the window was not moved/shifted. |
43 | */ | 43 | */ |
44 | int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, s32 seq_num_diff, | 44 | bool batadv_bit_get_packet(void *priv, unsigned long *seq_bits, |
45 | int set_mark) | 45 | s32 seq_num_diff, int set_mark) |
46 | { | 46 | { |
47 | struct batadv_priv *bat_priv = priv; | 47 | struct batadv_priv *bat_priv = priv; |
48 | 48 | ||
@@ -52,7 +52,7 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, s32 seq_num_diff, | |||
52 | if (seq_num_diff <= 0 && seq_num_diff > -BATADV_TQ_LOCAL_WINDOW_SIZE) { | 52 | if (seq_num_diff <= 0 && seq_num_diff > -BATADV_TQ_LOCAL_WINDOW_SIZE) { |
53 | if (set_mark) | 53 | if (set_mark) |
54 | batadv_set_bit(seq_bits, -seq_num_diff); | 54 | batadv_set_bit(seq_bits, -seq_num_diff); |
55 | return 0; | 55 | return false; |
56 | } | 56 | } |
57 | 57 | ||
58 | /* sequence number is slightly newer, so we shift the window and | 58 | /* sequence number is slightly newer, so we shift the window and |
@@ -63,7 +63,7 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, s32 seq_num_diff, | |||
63 | 63 | ||
64 | if (set_mark) | 64 | if (set_mark) |
65 | batadv_set_bit(seq_bits, 0); | 65 | batadv_set_bit(seq_bits, 0); |
66 | return 1; | 66 | return true; |
67 | } | 67 | } |
68 | 68 | ||
69 | /* sequence number is much newer, probably missed a lot of packets */ | 69 | /* sequence number is much newer, probably missed a lot of packets */ |
@@ -75,7 +75,7 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, s32 seq_num_diff, | |||
75 | bitmap_zero(seq_bits, BATADV_TQ_LOCAL_WINDOW_SIZE); | 75 | bitmap_zero(seq_bits, BATADV_TQ_LOCAL_WINDOW_SIZE); |
76 | if (set_mark) | 76 | if (set_mark) |
77 | batadv_set_bit(seq_bits, 0); | 77 | batadv_set_bit(seq_bits, 0); |
78 | return 1; | 78 | return true; |
79 | } | 79 | } |
80 | 80 | ||
81 | /* received a much older packet. The other host either restarted | 81 | /* received a much older packet. The other host either restarted |
@@ -94,5 +94,5 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, s32 seq_num_diff, | |||
94 | if (set_mark) | 94 | if (set_mark) |
95 | batadv_set_bit(seq_bits, 0); | 95 | batadv_set_bit(seq_bits, 0); |
96 | 96 | ||
97 | return 1; | 97 | return true; |
98 | } | 98 | } |
diff --git a/net/batman-adv/bitarray.h b/net/batman-adv/bitarray.h index 3e41bb80eb81..0e6e9d09078c 100644 --- a/net/batman-adv/bitarray.h +++ b/net/batman-adv/bitarray.h | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/bitops.h> | 23 | #include <linux/bitops.h> |
24 | #include <linux/compiler.h> | 24 | #include <linux/compiler.h> |
25 | #include <linux/stddef.h> | ||
25 | #include <linux/types.h> | 26 | #include <linux/types.h> |
26 | 27 | ||
27 | /** | 28 | /** |
@@ -31,17 +32,17 @@ | |||
31 | * @last_seqno: latest sequence number in seq_bits | 32 | * @last_seqno: latest sequence number in seq_bits |
32 | * @curr_seqno: sequence number to test for | 33 | * @curr_seqno: sequence number to test for |
33 | * | 34 | * |
34 | * Return: 1 if the corresponding bit in the given seq_bits indicates true | 35 | * Return: true if the corresponding bit in the given seq_bits indicates true |
35 | * and curr_seqno is within range of last_seqno. Otherwise returns 0. | 36 | * and curr_seqno is within range of last_seqno. Otherwise returns false. |
36 | */ | 37 | */ |
37 | static inline int batadv_test_bit(const unsigned long *seq_bits, | 38 | static inline bool batadv_test_bit(const unsigned long *seq_bits, |
38 | u32 last_seqno, u32 curr_seqno) | 39 | u32 last_seqno, u32 curr_seqno) |
39 | { | 40 | { |
40 | s32 diff; | 41 | s32 diff; |
41 | 42 | ||
42 | diff = last_seqno - curr_seqno; | 43 | diff = last_seqno - curr_seqno; |
43 | if (diff < 0 || diff >= BATADV_TQ_LOCAL_WINDOW_SIZE) | 44 | if (diff < 0 || diff >= BATADV_TQ_LOCAL_WINDOW_SIZE) |
44 | return 0; | 45 | return false; |
45 | return test_bit(diff, seq_bits) != 0; | 46 | return test_bit(diff, seq_bits) != 0; |
46 | } | 47 | } |
47 | 48 | ||
@@ -55,7 +56,7 @@ static inline void batadv_set_bit(unsigned long *seq_bits, s32 n) | |||
55 | set_bit(n, seq_bits); /* turn the position on */ | 56 | set_bit(n, seq_bits); /* turn the position on */ |
56 | } | 57 | } |
57 | 58 | ||
58 | int batadv_bit_get_packet(void *priv, unsigned long *seq_bits, s32 seq_num_diff, | 59 | bool batadv_bit_get_packet(void *priv, unsigned long *seq_bits, |
59 | int set_mark); | 60 | s32 seq_num_diff, int set_mark); |
60 | 61 | ||
61 | #endif /* _NET_BATMAN_ADV_BITARRAY_H_ */ | 62 | #endif /* _NET_BATMAN_ADV_BITARRAY_H_ */ |
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 5064ae5e9b34..748a9ead7ce5 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -101,10 +101,10 @@ static inline u32 batadv_choose_backbone_gw(const void *data, u32 size) | |||
101 | * @node: list node of the first entry to compare | 101 | * @node: list node of the first entry to compare |
102 | * @data2: pointer to the second backbone gateway | 102 | * @data2: pointer to the second backbone gateway |
103 | * | 103 | * |
104 | * Return: 1 if the backbones have the same data, 0 otherwise | 104 | * Return: true if the backbones have the same data, false otherwise |
105 | */ | 105 | */ |
106 | static int batadv_compare_backbone_gw(const struct hlist_node *node, | 106 | static bool batadv_compare_backbone_gw(const struct hlist_node *node, |
107 | const void *data2) | 107 | const void *data2) |
108 | { | 108 | { |
109 | const void *data1 = container_of(node, struct batadv_bla_backbone_gw, | 109 | const void *data1 = container_of(node, struct batadv_bla_backbone_gw, |
110 | hash_entry); | 110 | hash_entry); |
@@ -112,12 +112,12 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node, | |||
112 | const struct batadv_bla_backbone_gw *gw2 = data2; | 112 | const struct batadv_bla_backbone_gw *gw2 = data2; |
113 | 113 | ||
114 | if (!batadv_compare_eth(gw1->orig, gw2->orig)) | 114 | if (!batadv_compare_eth(gw1->orig, gw2->orig)) |
115 | return 0; | 115 | return false; |
116 | 116 | ||
117 | if (gw1->vid != gw2->vid) | 117 | if (gw1->vid != gw2->vid) |
118 | return 0; | 118 | return false; |
119 | 119 | ||
120 | return 1; | 120 | return true; |
121 | } | 121 | } |
122 | 122 | ||
123 | /** | 123 | /** |
@@ -125,10 +125,10 @@ static int batadv_compare_backbone_gw(const struct hlist_node *node, | |||
125 | * @node: list node of the first entry to compare | 125 | * @node: list node of the first entry to compare |
126 | * @data2: pointer to the second claims | 126 | * @data2: pointer to the second claims |
127 | * | 127 | * |
128 | * Return: 1 if the claim have the same data, 0 otherwise | 128 | * Return: true if the claim have the same data, 0 otherwise |
129 | */ | 129 | */ |
130 | static int batadv_compare_claim(const struct hlist_node *node, | 130 | static bool batadv_compare_claim(const struct hlist_node *node, |
131 | const void *data2) | 131 | const void *data2) |
132 | { | 132 | { |
133 | const void *data1 = container_of(node, struct batadv_bla_claim, | 133 | const void *data1 = container_of(node, struct batadv_bla_claim, |
134 | hash_entry); | 134 | hash_entry); |
@@ -136,12 +136,12 @@ static int batadv_compare_claim(const struct hlist_node *node, | |||
136 | const struct batadv_bla_claim *cl2 = data2; | 136 | const struct batadv_bla_claim *cl2 = data2; |
137 | 137 | ||
138 | if (!batadv_compare_eth(cl1->addr, cl2->addr)) | 138 | if (!batadv_compare_eth(cl1->addr, cl2->addr)) |
139 | return 0; | 139 | return false; |
140 | 140 | ||
141 | if (cl1->vid != cl2->vid) | 141 | if (cl1->vid != cl2->vid) |
142 | return 0; | 142 | return false; |
143 | 143 | ||
144 | return 1; | 144 | return true; |
145 | } | 145 | } |
146 | 146 | ||
147 | /** | 147 | /** |
@@ -775,22 +775,22 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, | |||
775 | * @backbone_addr: originator address of the sender (Ethernet source MAC) | 775 | * @backbone_addr: originator address of the sender (Ethernet source MAC) |
776 | * @vid: the VLAN ID of the frame | 776 | * @vid: the VLAN ID of the frame |
777 | * | 777 | * |
778 | * Return: 1 if handled | 778 | * Return: true if handled |
779 | */ | 779 | */ |
780 | static int batadv_handle_announce(struct batadv_priv *bat_priv, u8 *an_addr, | 780 | static bool batadv_handle_announce(struct batadv_priv *bat_priv, u8 *an_addr, |
781 | u8 *backbone_addr, unsigned short vid) | 781 | u8 *backbone_addr, unsigned short vid) |
782 | { | 782 | { |
783 | struct batadv_bla_backbone_gw *backbone_gw; | 783 | struct batadv_bla_backbone_gw *backbone_gw; |
784 | u16 backbone_crc, crc; | 784 | u16 backbone_crc, crc; |
785 | 785 | ||
786 | if (memcmp(an_addr, batadv_announce_mac, 4) != 0) | 786 | if (memcmp(an_addr, batadv_announce_mac, 4) != 0) |
787 | return 0; | 787 | return false; |
788 | 788 | ||
789 | backbone_gw = batadv_bla_get_backbone_gw(bat_priv, backbone_addr, vid, | 789 | backbone_gw = batadv_bla_get_backbone_gw(bat_priv, backbone_addr, vid, |
790 | false); | 790 | false); |
791 | 791 | ||
792 | if (unlikely(!backbone_gw)) | 792 | if (unlikely(!backbone_gw)) |
793 | return 1; | 793 | return true; |
794 | 794 | ||
795 | /* handle as ANNOUNCE frame */ | 795 | /* handle as ANNOUNCE frame */ |
796 | backbone_gw->lasttime = jiffies; | 796 | backbone_gw->lasttime = jiffies; |
@@ -823,7 +823,7 @@ static int batadv_handle_announce(struct batadv_priv *bat_priv, u8 *an_addr, | |||
823 | } | 823 | } |
824 | 824 | ||
825 | batadv_backbone_gw_put(backbone_gw); | 825 | batadv_backbone_gw_put(backbone_gw); |
826 | return 1; | 826 | return true; |
827 | } | 827 | } |
828 | 828 | ||
829 | /** | 829 | /** |
@@ -834,29 +834,29 @@ static int batadv_handle_announce(struct batadv_priv *bat_priv, u8 *an_addr, | |||
834 | * @ethhdr: ethernet header of a packet | 834 | * @ethhdr: ethernet header of a packet |
835 | * @vid: the VLAN ID of the frame | 835 | * @vid: the VLAN ID of the frame |
836 | * | 836 | * |
837 | * Return: 1 if handled | 837 | * Return: true if handled |
838 | */ | 838 | */ |
839 | static int batadv_handle_request(struct batadv_priv *bat_priv, | 839 | static bool batadv_handle_request(struct batadv_priv *bat_priv, |
840 | struct batadv_hard_iface *primary_if, | 840 | struct batadv_hard_iface *primary_if, |
841 | u8 *backbone_addr, struct ethhdr *ethhdr, | 841 | u8 *backbone_addr, struct ethhdr *ethhdr, |
842 | unsigned short vid) | 842 | unsigned short vid) |
843 | { | 843 | { |
844 | /* check for REQUEST frame */ | 844 | /* check for REQUEST frame */ |
845 | if (!batadv_compare_eth(backbone_addr, ethhdr->h_dest)) | 845 | if (!batadv_compare_eth(backbone_addr, ethhdr->h_dest)) |
846 | return 0; | 846 | return false; |
847 | 847 | ||
848 | /* sanity check, this should not happen on a normal switch, | 848 | /* sanity check, this should not happen on a normal switch, |
849 | * we ignore it in this case. | 849 | * we ignore it in this case. |
850 | */ | 850 | */ |
851 | if (!batadv_compare_eth(ethhdr->h_dest, primary_if->net_dev->dev_addr)) | 851 | if (!batadv_compare_eth(ethhdr->h_dest, primary_if->net_dev->dev_addr)) |
852 | return 1; | 852 | return true; |
853 | 853 | ||
854 | batadv_dbg(BATADV_DBG_BLA, bat_priv, | 854 | batadv_dbg(BATADV_DBG_BLA, bat_priv, |
855 | "handle_request(): REQUEST vid %d (sent by %pM)...\n", | 855 | "handle_request(): REQUEST vid %d (sent by %pM)...\n", |
856 | BATADV_PRINT_VID(vid), ethhdr->h_source); | 856 | BATADV_PRINT_VID(vid), ethhdr->h_source); |
857 | 857 | ||
858 | batadv_bla_answer_request(bat_priv, primary_if, vid); | 858 | batadv_bla_answer_request(bat_priv, primary_if, vid); |
859 | return 1; | 859 | return true; |
860 | } | 860 | } |
861 | 861 | ||
862 | /** | 862 | /** |
@@ -867,12 +867,12 @@ static int batadv_handle_request(struct batadv_priv *bat_priv, | |||
867 | * @claim_addr: Client to be unclaimed (ARP sender HW MAC) | 867 | * @claim_addr: Client to be unclaimed (ARP sender HW MAC) |
868 | * @vid: the VLAN ID of the frame | 868 | * @vid: the VLAN ID of the frame |
869 | * | 869 | * |
870 | * Return: 1 if handled | 870 | * Return: true if handled |
871 | */ | 871 | */ |
872 | static int batadv_handle_unclaim(struct batadv_priv *bat_priv, | 872 | static bool batadv_handle_unclaim(struct batadv_priv *bat_priv, |
873 | struct batadv_hard_iface *primary_if, | 873 | struct batadv_hard_iface *primary_if, |
874 | u8 *backbone_addr, u8 *claim_addr, | 874 | u8 *backbone_addr, u8 *claim_addr, |
875 | unsigned short vid) | 875 | unsigned short vid) |
876 | { | 876 | { |
877 | struct batadv_bla_backbone_gw *backbone_gw; | 877 | struct batadv_bla_backbone_gw *backbone_gw; |
878 | 878 | ||
@@ -885,7 +885,7 @@ static int batadv_handle_unclaim(struct batadv_priv *bat_priv, | |||
885 | backbone_gw = batadv_backbone_hash_find(bat_priv, backbone_addr, vid); | 885 | backbone_gw = batadv_backbone_hash_find(bat_priv, backbone_addr, vid); |
886 | 886 | ||
887 | if (!backbone_gw) | 887 | if (!backbone_gw) |
888 | return 1; | 888 | return true; |
889 | 889 | ||
890 | /* this must be an UNCLAIM frame */ | 890 | /* this must be an UNCLAIM frame */ |
891 | batadv_dbg(BATADV_DBG_BLA, bat_priv, | 891 | batadv_dbg(BATADV_DBG_BLA, bat_priv, |
@@ -894,7 +894,7 @@ static int batadv_handle_unclaim(struct batadv_priv *bat_priv, | |||
894 | 894 | ||
895 | batadv_bla_del_claim(bat_priv, claim_addr, vid); | 895 | batadv_bla_del_claim(bat_priv, claim_addr, vid); |
896 | batadv_backbone_gw_put(backbone_gw); | 896 | batadv_backbone_gw_put(backbone_gw); |
897 | return 1; | 897 | return true; |
898 | } | 898 | } |
899 | 899 | ||
900 | /** | 900 | /** |
@@ -905,12 +905,12 @@ static int batadv_handle_unclaim(struct batadv_priv *bat_priv, | |||
905 | * @claim_addr: client mac address to be claimed (ARP sender HW MAC) | 905 | * @claim_addr: client mac address to be claimed (ARP sender HW MAC) |
906 | * @vid: the VLAN ID of the frame | 906 | * @vid: the VLAN ID of the frame |
907 | * | 907 | * |
908 | * Return: 1 if handled | 908 | * Return: true if handled |
909 | */ | 909 | */ |
910 | static int batadv_handle_claim(struct batadv_priv *bat_priv, | 910 | static bool batadv_handle_claim(struct batadv_priv *bat_priv, |
911 | struct batadv_hard_iface *primary_if, | 911 | struct batadv_hard_iface *primary_if, |
912 | u8 *backbone_addr, u8 *claim_addr, | 912 | u8 *backbone_addr, u8 *claim_addr, |
913 | unsigned short vid) | 913 | unsigned short vid) |
914 | { | 914 | { |
915 | struct batadv_bla_backbone_gw *backbone_gw; | 915 | struct batadv_bla_backbone_gw *backbone_gw; |
916 | 916 | ||
@@ -920,7 +920,7 @@ static int batadv_handle_claim(struct batadv_priv *bat_priv, | |||
920 | false); | 920 | false); |
921 | 921 | ||
922 | if (unlikely(!backbone_gw)) | 922 | if (unlikely(!backbone_gw)) |
923 | return 1; | 923 | return true; |
924 | 924 | ||
925 | /* this must be a CLAIM frame */ | 925 | /* this must be a CLAIM frame */ |
926 | batadv_bla_add_claim(bat_priv, claim_addr, vid, backbone_gw); | 926 | batadv_bla_add_claim(bat_priv, claim_addr, vid, backbone_gw); |
@@ -931,7 +931,7 @@ static int batadv_handle_claim(struct batadv_priv *bat_priv, | |||
931 | /* TODO: we could call something like tt_local_del() here. */ | 931 | /* TODO: we could call something like tt_local_del() here. */ |
932 | 932 | ||
933 | batadv_backbone_gw_put(backbone_gw); | 933 | batadv_backbone_gw_put(backbone_gw); |
934 | return 1; | 934 | return true; |
935 | } | 935 | } |
936 | 936 | ||
937 | /** | 937 | /** |
@@ -1015,12 +1015,12 @@ static int batadv_check_claim_group(struct batadv_priv *bat_priv, | |||
1015 | * @primary_if: the primary hard interface of this batman soft interface | 1015 | * @primary_if: the primary hard interface of this batman soft interface |
1016 | * @skb: the frame to be checked | 1016 | * @skb: the frame to be checked |
1017 | * | 1017 | * |
1018 | * Return: 1 if it was a claim frame, otherwise return 0 to | 1018 | * Return: true if it was a claim frame, otherwise return false to |
1019 | * tell the callee that it can use the frame on its own. | 1019 | * tell the callee that it can use the frame on its own. |
1020 | */ | 1020 | */ |
1021 | static int batadv_bla_process_claim(struct batadv_priv *bat_priv, | 1021 | static bool batadv_bla_process_claim(struct batadv_priv *bat_priv, |
1022 | struct batadv_hard_iface *primary_if, | 1022 | struct batadv_hard_iface *primary_if, |
1023 | struct sk_buff *skb) | 1023 | struct sk_buff *skb) |
1024 | { | 1024 | { |
1025 | struct batadv_bla_claim_dst *bla_dst, *bla_dst_own; | 1025 | struct batadv_bla_claim_dst *bla_dst, *bla_dst_own; |
1026 | u8 *hw_src, *hw_dst; | 1026 | u8 *hw_src, *hw_dst; |
@@ -1051,7 +1051,7 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, | |||
1051 | vhdr = skb_header_pointer(skb, headlen, VLAN_HLEN, | 1051 | vhdr = skb_header_pointer(skb, headlen, VLAN_HLEN, |
1052 | &vhdr_buf); | 1052 | &vhdr_buf); |
1053 | if (!vhdr) | 1053 | if (!vhdr) |
1054 | return 0; | 1054 | return false; |
1055 | 1055 | ||
1056 | proto = vhdr->h_vlan_encapsulated_proto; | 1056 | proto = vhdr->h_vlan_encapsulated_proto; |
1057 | headlen += VLAN_HLEN; | 1057 | headlen += VLAN_HLEN; |
@@ -1060,12 +1060,12 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, | |||
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | if (proto != htons(ETH_P_ARP)) | 1062 | if (proto != htons(ETH_P_ARP)) |
1063 | return 0; /* not a claim frame */ | 1063 | return false; /* not a claim frame */ |
1064 | 1064 | ||
1065 | /* this must be a ARP frame. check if it is a claim. */ | 1065 | /* this must be a ARP frame. check if it is a claim. */ |
1066 | 1066 | ||
1067 | if (unlikely(!pskb_may_pull(skb, headlen + arp_hdr_len(skb->dev)))) | 1067 | if (unlikely(!pskb_may_pull(skb, headlen + arp_hdr_len(skb->dev)))) |
1068 | return 0; | 1068 | return false; |
1069 | 1069 | ||
1070 | /* pskb_may_pull() may have modified the pointers, get ethhdr again */ | 1070 | /* pskb_may_pull() may have modified the pointers, get ethhdr again */ |
1071 | ethhdr = eth_hdr(skb); | 1071 | ethhdr = eth_hdr(skb); |
@@ -1075,13 +1075,13 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, | |||
1075 | * IP information | 1075 | * IP information |
1076 | */ | 1076 | */ |
1077 | if (arphdr->ar_hrd != htons(ARPHRD_ETHER)) | 1077 | if (arphdr->ar_hrd != htons(ARPHRD_ETHER)) |
1078 | return 0; | 1078 | return false; |
1079 | if (arphdr->ar_pro != htons(ETH_P_IP)) | 1079 | if (arphdr->ar_pro != htons(ETH_P_IP)) |
1080 | return 0; | 1080 | return false; |
1081 | if (arphdr->ar_hln != ETH_ALEN) | 1081 | if (arphdr->ar_hln != ETH_ALEN) |
1082 | return 0; | 1082 | return false; |
1083 | if (arphdr->ar_pln != 4) | 1083 | if (arphdr->ar_pln != 4) |
1084 | return 0; | 1084 | return false; |
1085 | 1085 | ||
1086 | hw_src = (u8 *)arphdr + sizeof(struct arphdr); | 1086 | hw_src = (u8 *)arphdr + sizeof(struct arphdr); |
1087 | hw_dst = hw_src + ETH_ALEN + 4; | 1087 | hw_dst = hw_src + ETH_ALEN + 4; |
@@ -1091,14 +1091,14 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, | |||
1091 | /* check if it is a claim frame in general */ | 1091 | /* check if it is a claim frame in general */ |
1092 | if (memcmp(bla_dst->magic, bla_dst_own->magic, | 1092 | if (memcmp(bla_dst->magic, bla_dst_own->magic, |
1093 | sizeof(bla_dst->magic)) != 0) | 1093 | sizeof(bla_dst->magic)) != 0) |
1094 | return 0; | 1094 | return false; |
1095 | 1095 | ||
1096 | /* check if there is a claim frame encapsulated deeper in (QinQ) and | 1096 | /* check if there is a claim frame encapsulated deeper in (QinQ) and |
1097 | * drop that, as this is not supported by BLA but should also not be | 1097 | * drop that, as this is not supported by BLA but should also not be |
1098 | * sent via the mesh. | 1098 | * sent via the mesh. |
1099 | */ | 1099 | */ |
1100 | if (vlan_depth > 1) | 1100 | if (vlan_depth > 1) |
1101 | return 1; | 1101 | return true; |
1102 | 1102 | ||
1103 | /* Let the loopdetect frames on the mesh in any case. */ | 1103 | /* Let the loopdetect frames on the mesh in any case. */ |
1104 | if (bla_dst->type == BATADV_CLAIM_TYPE_LOOPDETECT) | 1104 | if (bla_dst->type == BATADV_CLAIM_TYPE_LOOPDETECT) |
@@ -1114,7 +1114,7 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, | |||
1114 | hw_dst); | 1114 | hw_dst); |
1115 | 1115 | ||
1116 | if (ret < 2) | 1116 | if (ret < 2) |
1117 | return ret; | 1117 | return !!ret; |
1118 | 1118 | ||
1119 | /* become a backbone gw ourselves on this vlan if not happened yet */ | 1119 | /* become a backbone gw ourselves on this vlan if not happened yet */ |
1120 | batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); | 1120 | batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); |
@@ -1124,30 +1124,30 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, | |||
1124 | case BATADV_CLAIM_TYPE_CLAIM: | 1124 | case BATADV_CLAIM_TYPE_CLAIM: |
1125 | if (batadv_handle_claim(bat_priv, primary_if, hw_src, | 1125 | if (batadv_handle_claim(bat_priv, primary_if, hw_src, |
1126 | ethhdr->h_source, vid)) | 1126 | ethhdr->h_source, vid)) |
1127 | return 1; | 1127 | return true; |
1128 | break; | 1128 | break; |
1129 | case BATADV_CLAIM_TYPE_UNCLAIM: | 1129 | case BATADV_CLAIM_TYPE_UNCLAIM: |
1130 | if (batadv_handle_unclaim(bat_priv, primary_if, | 1130 | if (batadv_handle_unclaim(bat_priv, primary_if, |
1131 | ethhdr->h_source, hw_src, vid)) | 1131 | ethhdr->h_source, hw_src, vid)) |
1132 | return 1; | 1132 | return true; |
1133 | break; | 1133 | break; |
1134 | 1134 | ||
1135 | case BATADV_CLAIM_TYPE_ANNOUNCE: | 1135 | case BATADV_CLAIM_TYPE_ANNOUNCE: |
1136 | if (batadv_handle_announce(bat_priv, hw_src, ethhdr->h_source, | 1136 | if (batadv_handle_announce(bat_priv, hw_src, ethhdr->h_source, |
1137 | vid)) | 1137 | vid)) |
1138 | return 1; | 1138 | return true; |
1139 | break; | 1139 | break; |
1140 | case BATADV_CLAIM_TYPE_REQUEST: | 1140 | case BATADV_CLAIM_TYPE_REQUEST: |
1141 | if (batadv_handle_request(bat_priv, primary_if, hw_src, ethhdr, | 1141 | if (batadv_handle_request(bat_priv, primary_if, hw_src, ethhdr, |
1142 | vid)) | 1142 | vid)) |
1143 | return 1; | 1143 | return true; |
1144 | break; | 1144 | break; |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | batadv_dbg(BATADV_DBG_BLA, bat_priv, | 1147 | batadv_dbg(BATADV_DBG_BLA, bat_priv, |
1148 | "bla_process_claim(): ERROR - this looks like a claim frame, but is useless. eth src %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", | 1148 | "bla_process_claim(): ERROR - this looks like a claim frame, but is useless. eth src %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", |
1149 | ethhdr->h_source, BATADV_PRINT_VID(vid), hw_src, hw_dst); | 1149 | ethhdr->h_source, BATADV_PRINT_VID(vid), hw_src, hw_dst); |
1150 | return 1; | 1150 | return true; |
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | /** | 1153 | /** |
@@ -1529,15 +1529,16 @@ int batadv_bla_init(struct batadv_priv *bat_priv) | |||
1529 | * sent by another host, drop it. We allow equal packets from | 1529 | * sent by another host, drop it. We allow equal packets from |
1530 | * the same host however as this might be intended. | 1530 | * the same host however as this might be intended. |
1531 | * | 1531 | * |
1532 | * Return: 1 if a packet is in the duplicate list, 0 otherwise. | 1532 | * Return: true if a packet is in the duplicate list, false otherwise. |
1533 | */ | 1533 | */ |
1534 | int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | 1534 | bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, |
1535 | struct sk_buff *skb) | 1535 | struct sk_buff *skb) |
1536 | { | 1536 | { |
1537 | int i, curr, ret = 0; | 1537 | int i, curr; |
1538 | __be32 crc; | 1538 | __be32 crc; |
1539 | struct batadv_bcast_packet *bcast_packet; | 1539 | struct batadv_bcast_packet *bcast_packet; |
1540 | struct batadv_bcast_duplist_entry *entry; | 1540 | struct batadv_bcast_duplist_entry *entry; |
1541 | bool ret = false; | ||
1541 | 1542 | ||
1542 | bcast_packet = (struct batadv_bcast_packet *)skb->data; | 1543 | bcast_packet = (struct batadv_bcast_packet *)skb->data; |
1543 | 1544 | ||
@@ -1565,9 +1566,9 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | |||
1565 | continue; | 1566 | continue; |
1566 | 1567 | ||
1567 | /* this entry seems to match: same crc, not too old, | 1568 | /* this entry seems to match: same crc, not too old, |
1568 | * and from another gw. therefore return 1 to forbid it. | 1569 | * and from another gw. therefore return true to forbid it. |
1569 | */ | 1570 | */ |
1570 | ret = 1; | 1571 | ret = true; |
1571 | goto out; | 1572 | goto out; |
1572 | } | 1573 | } |
1573 | /* not found, add a new entry (overwrite the oldest entry) | 1574 | /* not found, add a new entry (overwrite the oldest entry) |
@@ -1633,21 +1634,21 @@ bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig, | |||
1633 | * @orig_node: the orig_node of the frame | 1634 | * @orig_node: the orig_node of the frame |
1634 | * @hdr_size: maximum length of the frame | 1635 | * @hdr_size: maximum length of the frame |
1635 | * | 1636 | * |
1636 | * Return: 1 if the orig_node is also a gateway on the soft interface, otherwise | 1637 | * Return: true if the orig_node is also a gateway on the soft interface, |
1637 | * it returns 0. | 1638 | * otherwise it returns false. |
1638 | */ | 1639 | */ |
1639 | int batadv_bla_is_backbone_gw(struct sk_buff *skb, | 1640 | bool batadv_bla_is_backbone_gw(struct sk_buff *skb, |
1640 | struct batadv_orig_node *orig_node, int hdr_size) | 1641 | struct batadv_orig_node *orig_node, int hdr_size) |
1641 | { | 1642 | { |
1642 | struct batadv_bla_backbone_gw *backbone_gw; | 1643 | struct batadv_bla_backbone_gw *backbone_gw; |
1643 | unsigned short vid; | 1644 | unsigned short vid; |
1644 | 1645 | ||
1645 | if (!atomic_read(&orig_node->bat_priv->bridge_loop_avoidance)) | 1646 | if (!atomic_read(&orig_node->bat_priv->bridge_loop_avoidance)) |
1646 | return 0; | 1647 | return false; |
1647 | 1648 | ||
1648 | /* first, find out the vid. */ | 1649 | /* first, find out the vid. */ |
1649 | if (!pskb_may_pull(skb, hdr_size + ETH_HLEN)) | 1650 | if (!pskb_may_pull(skb, hdr_size + ETH_HLEN)) |
1650 | return 0; | 1651 | return false; |
1651 | 1652 | ||
1652 | vid = batadv_get_vid(skb, hdr_size); | 1653 | vid = batadv_get_vid(skb, hdr_size); |
1653 | 1654 | ||
@@ -1655,10 +1656,10 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb, | |||
1655 | backbone_gw = batadv_backbone_hash_find(orig_node->bat_priv, | 1656 | backbone_gw = batadv_backbone_hash_find(orig_node->bat_priv, |
1656 | orig_node->orig, vid); | 1657 | orig_node->orig, vid); |
1657 | if (!backbone_gw) | 1658 | if (!backbone_gw) |
1658 | return 0; | 1659 | return false; |
1659 | 1660 | ||
1660 | batadv_backbone_gw_put(backbone_gw); | 1661 | batadv_backbone_gw_put(backbone_gw); |
1661 | return 1; | 1662 | return true; |
1662 | } | 1663 | } |
1663 | 1664 | ||
1664 | /** | 1665 | /** |
@@ -1750,16 +1751,16 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb, | |||
1750 | * | 1751 | * |
1751 | * in these cases, the skb is further handled by this function | 1752 | * in these cases, the skb is further handled by this function |
1752 | * | 1753 | * |
1753 | * Return: 1 if handled, otherwise it returns 0 and the caller shall further | 1754 | * Return: true if handled, otherwise it returns false and the caller shall |
1754 | * process the skb. | 1755 | * further process the skb. |
1755 | */ | 1756 | */ |
1756 | int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, | 1757 | bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, |
1757 | unsigned short vid, bool is_bcast) | 1758 | unsigned short vid, bool is_bcast) |
1758 | { | 1759 | { |
1759 | struct ethhdr *ethhdr; | 1760 | struct ethhdr *ethhdr; |
1760 | struct batadv_bla_claim search_claim, *claim = NULL; | 1761 | struct batadv_bla_claim search_claim, *claim = NULL; |
1761 | struct batadv_hard_iface *primary_if; | 1762 | struct batadv_hard_iface *primary_if; |
1762 | int ret; | 1763 | bool ret; |
1763 | 1764 | ||
1764 | ethhdr = eth_hdr(skb); | 1765 | ethhdr = eth_hdr(skb); |
1765 | 1766 | ||
@@ -1821,12 +1822,12 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, | |||
1821 | } | 1822 | } |
1822 | allow: | 1823 | allow: |
1823 | batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); | 1824 | batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); |
1824 | ret = 0; | 1825 | ret = false; |
1825 | goto out; | 1826 | goto out; |
1826 | 1827 | ||
1827 | handled: | 1828 | handled: |
1828 | kfree_skb(skb); | 1829 | kfree_skb(skb); |
1829 | ret = 1; | 1830 | ret = true; |
1830 | 1831 | ||
1831 | out: | 1832 | out: |
1832 | if (primary_if) | 1833 | if (primary_if) |
@@ -1850,16 +1851,16 @@ out: | |||
1850 | * | 1851 | * |
1851 | * This call might reallocate skb data. | 1852 | * This call might reallocate skb data. |
1852 | * | 1853 | * |
1853 | * Return: 1 if handled, otherwise it returns 0 and the caller shall further | 1854 | * Return: true if handled, otherwise it returns false and the caller shall |
1854 | * process the skb. | 1855 | * further process the skb. |
1855 | */ | 1856 | */ |
1856 | int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, | 1857 | bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, |
1857 | unsigned short vid) | 1858 | unsigned short vid) |
1858 | { | 1859 | { |
1859 | struct ethhdr *ethhdr; | 1860 | struct ethhdr *ethhdr; |
1860 | struct batadv_bla_claim search_claim, *claim = NULL; | 1861 | struct batadv_bla_claim search_claim, *claim = NULL; |
1861 | struct batadv_hard_iface *primary_if; | 1862 | struct batadv_hard_iface *primary_if; |
1862 | int ret = 0; | 1863 | bool ret = false; |
1863 | 1864 | ||
1864 | primary_if = batadv_primary_if_get_selected(bat_priv); | 1865 | primary_if = batadv_primary_if_get_selected(bat_priv); |
1865 | if (!primary_if) | 1866 | if (!primary_if) |
@@ -1913,10 +1914,10 @@ int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, | |||
1913 | } | 1914 | } |
1914 | allow: | 1915 | allow: |
1915 | batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); | 1916 | batadv_bla_update_own_backbone_gw(bat_priv, primary_if, vid); |
1916 | ret = 0; | 1917 | ret = false; |
1917 | goto out; | 1918 | goto out; |
1918 | handled: | 1919 | handled: |
1919 | ret = 1; | 1920 | ret = true; |
1920 | out: | 1921 | out: |
1921 | if (primary_if) | 1922 | if (primary_if) |
1922 | batadv_hardif_put(primary_if); | 1923 | batadv_hardif_put(primary_if); |
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h index 579f0fa6fe6a..0f01daeb359e 100644 --- a/net/batman-adv/bridge_loop_avoidance.h +++ b/net/batman-adv/bridge_loop_avoidance.h | |||
@@ -27,19 +27,20 @@ struct seq_file; | |||
27 | struct sk_buff; | 27 | struct sk_buff; |
28 | 28 | ||
29 | #ifdef CONFIG_BATMAN_ADV_BLA | 29 | #ifdef CONFIG_BATMAN_ADV_BLA |
30 | int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, | 30 | bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, |
31 | unsigned short vid, bool is_bcast); | 31 | unsigned short vid, bool is_bcast); |
32 | int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, | 32 | bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, |
33 | unsigned short vid); | 33 | unsigned short vid); |
34 | int batadv_bla_is_backbone_gw(struct sk_buff *skb, | 34 | bool batadv_bla_is_backbone_gw(struct sk_buff *skb, |
35 | struct batadv_orig_node *orig_node, int hdr_size); | 35 | struct batadv_orig_node *orig_node, |
36 | int hdr_size); | ||
36 | int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset); | 37 | int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset); |
37 | int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, | 38 | int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, |
38 | void *offset); | 39 | void *offset); |
39 | bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig, | 40 | bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig, |
40 | unsigned short vid); | 41 | unsigned short vid); |
41 | int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | 42 | bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, |
42 | struct sk_buff *skb); | 43 | struct sk_buff *skb); |
43 | void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, | 44 | void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, |
44 | struct batadv_hard_iface *primary_if, | 45 | struct batadv_hard_iface *primary_if, |
45 | struct batadv_hard_iface *oldif); | 46 | struct batadv_hard_iface *oldif); |
@@ -50,24 +51,24 @@ void batadv_bla_free(struct batadv_priv *bat_priv); | |||
50 | #define BATADV_BLA_CRC_INIT 0 | 51 | #define BATADV_BLA_CRC_INIT 0 |
51 | #else /* ifdef CONFIG_BATMAN_ADV_BLA */ | 52 | #else /* ifdef CONFIG_BATMAN_ADV_BLA */ |
52 | 53 | ||
53 | static inline int batadv_bla_rx(struct batadv_priv *bat_priv, | 54 | static inline bool batadv_bla_rx(struct batadv_priv *bat_priv, |
54 | struct sk_buff *skb, unsigned short vid, | 55 | struct sk_buff *skb, unsigned short vid, |
55 | bool is_bcast) | 56 | bool is_bcast) |
56 | { | 57 | { |
57 | return 0; | 58 | return false; |
58 | } | 59 | } |
59 | 60 | ||
60 | static inline int batadv_bla_tx(struct batadv_priv *bat_priv, | 61 | static inline bool batadv_bla_tx(struct batadv_priv *bat_priv, |
61 | struct sk_buff *skb, unsigned short vid) | 62 | struct sk_buff *skb, unsigned short vid) |
62 | { | 63 | { |
63 | return 0; | 64 | return false; |
64 | } | 65 | } |
65 | 66 | ||
66 | static inline int batadv_bla_is_backbone_gw(struct sk_buff *skb, | 67 | static inline bool batadv_bla_is_backbone_gw(struct sk_buff *skb, |
67 | struct batadv_orig_node *orig_node, | 68 | struct batadv_orig_node *orig_node, |
68 | int hdr_size) | 69 | int hdr_size) |
69 | { | 70 | { |
70 | return 0; | 71 | return false; |
71 | } | 72 | } |
72 | 73 | ||
73 | static inline int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, | 74 | static inline int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, |
@@ -88,11 +89,11 @@ static inline bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, | |||
88 | return false; | 89 | return false; |
89 | } | 90 | } |
90 | 91 | ||
91 | static inline int | 92 | static inline bool |
92 | batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | 93 | batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, |
93 | struct sk_buff *skb) | 94 | struct sk_buff *skb) |
94 | { | 95 | { |
95 | return 0; | 96 | return false; |
96 | } | 97 | } |
97 | 98 | ||
98 | static inline void | 99 | static inline void |
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c index aa315da83429..952900466d88 100644 --- a/net/batman-adv/debugfs.c +++ b/net/batman-adv/debugfs.c | |||
@@ -134,7 +134,7 @@ static int batadv_log_release(struct inode *inode, struct file *file) | |||
134 | return 0; | 134 | return 0; |
135 | } | 135 | } |
136 | 136 | ||
137 | static int batadv_log_empty(struct batadv_priv_debug_log *debug_log) | 137 | static bool batadv_log_empty(struct batadv_priv_debug_log *debug_log) |
138 | { | 138 | { |
139 | return !(debug_log->log_start - debug_log->log_end); | 139 | return !(debug_log->log_start - debug_log->log_end); |
140 | } | 140 | } |
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 67f44f5d630b..278800a99c69 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c | |||
@@ -165,14 +165,14 @@ static void batadv_dat_purge(struct work_struct *work) | |||
165 | * @node: node in the local table | 165 | * @node: node in the local table |
166 | * @data2: second object to compare the node to | 166 | * @data2: second object to compare the node to |
167 | * | 167 | * |
168 | * Return: 1 if the two entries are the same, 0 otherwise. | 168 | * Return: true if the two entries are the same, false otherwise. |
169 | */ | 169 | */ |
170 | static int batadv_compare_dat(const struct hlist_node *node, const void *data2) | 170 | static bool batadv_compare_dat(const struct hlist_node *node, const void *data2) |
171 | { | 171 | { |
172 | const void *data1 = container_of(node, struct batadv_dat_entry, | 172 | const void *data1 = container_of(node, struct batadv_dat_entry, |
173 | hash_entry); | 173 | hash_entry); |
174 | 174 | ||
175 | return memcmp(data1, data2, sizeof(__be32)) == 0 ? 1 : 0; | 175 | return memcmp(data1, data2, sizeof(__be32)) == 0; |
176 | } | 176 | } |
177 | 177 | ||
178 | /** | 178 | /** |
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 7c1d8d7ac548..8c2f39962fa5 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -146,22 +146,22 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev) | |||
146 | return ret; | 146 | return ret; |
147 | } | 147 | } |
148 | 148 | ||
149 | static int batadv_is_valid_iface(const struct net_device *net_dev) | 149 | static bool batadv_is_valid_iface(const struct net_device *net_dev) |
150 | { | 150 | { |
151 | if (net_dev->flags & IFF_LOOPBACK) | 151 | if (net_dev->flags & IFF_LOOPBACK) |
152 | return 0; | 152 | return false; |
153 | 153 | ||
154 | if (net_dev->type != ARPHRD_ETHER) | 154 | if (net_dev->type != ARPHRD_ETHER) |
155 | return 0; | 155 | return false; |
156 | 156 | ||
157 | if (net_dev->addr_len != ETH_ALEN) | 157 | if (net_dev->addr_len != ETH_ALEN) |
158 | return 0; | 158 | return false; |
159 | 159 | ||
160 | /* no batman over batman */ | 160 | /* no batman over batman */ |
161 | if (batadv_is_on_batman_iface(net_dev)) | 161 | if (batadv_is_on_batman_iface(net_dev)) |
162 | return 0; | 162 | return false; |
163 | 163 | ||
164 | return 1; | 164 | return true; |
165 | } | 165 | } |
166 | 166 | ||
167 | /** | 167 | /** |
@@ -653,8 +653,7 @@ batadv_hardif_add_interface(struct net_device *net_dev) | |||
653 | 653 | ||
654 | ASSERT_RTNL(); | 654 | ASSERT_RTNL(); |
655 | 655 | ||
656 | ret = batadv_is_valid_iface(net_dev); | 656 | if (!batadv_is_valid_iface(net_dev)) |
657 | if (ret != 1) | ||
658 | goto out; | 657 | goto out; |
659 | 658 | ||
660 | dev_hold(net_dev); | 659 | dev_hold(net_dev); |
diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h index 9bb57b87447c..cbbf87075f06 100644 --- a/net/batman-adv/hash.h +++ b/net/batman-adv/hash.h | |||
@@ -32,10 +32,10 @@ struct lock_class_key; | |||
32 | /* callback to a compare function. should compare 2 element datas for their | 32 | /* callback to a compare function. should compare 2 element datas for their |
33 | * keys | 33 | * keys |
34 | * | 34 | * |
35 | * Return: 0 if same and not 0 if not same | 35 | * Return: true if same and false if not same |
36 | */ | 36 | */ |
37 | typedef int (*batadv_hashdata_compare_cb)(const struct hlist_node *, | 37 | typedef bool (*batadv_hashdata_compare_cb)(const struct hlist_node *, |
38 | const void *); | 38 | const void *); |
39 | 39 | ||
40 | /* the hashfunction | 40 | /* the hashfunction |
41 | * | 41 | * |
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 090c6f0f2398..76925266deed 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h | |||
@@ -292,7 +292,7 @@ static inline void _batadv_dbg(int type __always_unused, | |||
292 | * | 292 | * |
293 | * note: can't use ether_addr_equal() as it requires aligned memory | 293 | * note: can't use ether_addr_equal() as it requires aligned memory |
294 | * | 294 | * |
295 | * Return: 1 if they are the same ethernet addr | 295 | * Return: true if they are the same ethernet addr |
296 | */ | 296 | */ |
297 | static inline bool batadv_compare_eth(const void *data1, const void *data2) | 297 | static inline bool batadv_compare_eth(const void *data1, const void *data2) |
298 | { | 298 | { |
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c index 953dff1ad43b..df5ae9c7e507 100644 --- a/net/batman-adv/network-coding.c +++ b/net/batman-adv/network-coding.c | |||
@@ -510,10 +510,10 @@ static u32 batadv_nc_hash_choose(const void *data, u32 size) | |||
510 | * @node: node in the local table | 510 | * @node: node in the local table |
511 | * @data2: second object to compare the node to | 511 | * @data2: second object to compare the node to |
512 | * | 512 | * |
513 | * Return: 1 if the two entry are the same, 0 otherwise | 513 | * Return: true if the two entry are the same, false otherwise |
514 | */ | 514 | */ |
515 | static int batadv_nc_hash_compare(const struct hlist_node *node, | 515 | static bool batadv_nc_hash_compare(const struct hlist_node *node, |
516 | const void *data2) | 516 | const void *data2) |
517 | { | 517 | { |
518 | const struct batadv_nc_path *nc_path1, *nc_path2; | 518 | const struct batadv_nc_path *nc_path1, *nc_path2; |
519 | 519 | ||
@@ -523,13 +523,13 @@ static int batadv_nc_hash_compare(const struct hlist_node *node, | |||
523 | /* Return 1 if the two keys are identical */ | 523 | /* Return 1 if the two keys are identical */ |
524 | if (memcmp(nc_path1->prev_hop, nc_path2->prev_hop, | 524 | if (memcmp(nc_path1->prev_hop, nc_path2->prev_hop, |
525 | sizeof(nc_path1->prev_hop)) != 0) | 525 | sizeof(nc_path1->prev_hop)) != 0) |
526 | return 0; | 526 | return false; |
527 | 527 | ||
528 | if (memcmp(nc_path1->next_hop, nc_path2->next_hop, | 528 | if (memcmp(nc_path1->next_hop, nc_path2->next_hop, |
529 | sizeof(nc_path1->next_hop)) != 0) | 529 | sizeof(nc_path1->next_hop)) != 0) |
530 | return 0; | 530 | return false; |
531 | 531 | ||
532 | return 1; | 532 | return true; |
533 | } | 533 | } |
534 | 534 | ||
535 | /** | 535 | /** |
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 04fa139911c3..1ff4ee473966 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -54,9 +54,9 @@ static void batadv_purge_orig(struct work_struct *work); | |||
54 | * @node: node in the local table | 54 | * @node: node in the local table |
55 | * @data2: second object to compare the node to | 55 | * @data2: second object to compare the node to |
56 | * | 56 | * |
57 | * Return: 1 if they are the same originator | 57 | * Return: true if they are the same originator |
58 | */ | 58 | */ |
59 | int batadv_compare_orig(const struct hlist_node *node, const void *data2) | 59 | bool batadv_compare_orig(const struct hlist_node *node, const void *data2) |
60 | { | 60 | { |
61 | const void *data1 = container_of(node, struct batadv_orig_node, | 61 | const void *data1 = container_of(node, struct batadv_orig_node, |
62 | hash_entry); | 62 | hash_entry); |
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h index 4e8b67f11051..64a8951e5844 100644 --- a/net/batman-adv/originator.h +++ b/net/batman-adv/originator.h | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | struct seq_file; | 34 | struct seq_file; |
35 | 35 | ||
36 | int batadv_compare_orig(const struct hlist_node *node, const void *data2); | 36 | bool batadv_compare_orig(const struct hlist_node *node, const void *data2); |
37 | int batadv_originator_init(struct batadv_priv *bat_priv); | 37 | int batadv_originator_init(struct batadv_priv *bat_priv); |
38 | void batadv_originator_free(struct batadv_priv *bat_priv); | 38 | void batadv_originator_free(struct batadv_priv *bat_priv); |
39 | void batadv_purge_orig_ref(struct batadv_priv *bat_priv); | 39 | void batadv_purge_orig_ref(struct batadv_priv *bat_priv); |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index b494e435686f..ae850f2d11cb 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -163,18 +163,18 @@ out: | |||
163 | * doesn't change otherwise. | 163 | * doesn't change otherwise. |
164 | * | 164 | * |
165 | * Return: | 165 | * Return: |
166 | * 0 if the packet is to be accepted. | 166 | * false if the packet is to be accepted. |
167 | * 1 if the packet is to be ignored. | 167 | * true if the packet is to be ignored. |
168 | */ | 168 | */ |
169 | int batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff, | 169 | bool batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff, |
170 | s32 seq_old_max_diff, unsigned long *last_reset, | 170 | s32 seq_old_max_diff, unsigned long *last_reset, |
171 | bool *protection_started) | 171 | bool *protection_started) |
172 | { | 172 | { |
173 | if (seq_num_diff <= -seq_old_max_diff || | 173 | if (seq_num_diff <= -seq_old_max_diff || |
174 | seq_num_diff >= BATADV_EXPECTED_SEQNO_RANGE) { | 174 | seq_num_diff >= BATADV_EXPECTED_SEQNO_RANGE) { |
175 | if (!batadv_has_timed_out(*last_reset, | 175 | if (!batadv_has_timed_out(*last_reset, |
176 | BATADV_RESET_PROTECTION_MS)) | 176 | BATADV_RESET_PROTECTION_MS)) |
177 | return 1; | 177 | return true; |
178 | 178 | ||
179 | *last_reset = jiffies; | 179 | *last_reset = jiffies; |
180 | if (protection_started) | 180 | if (protection_started) |
@@ -183,7 +183,7 @@ int batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff, | |||
183 | "old packet received, start protection\n"); | 183 | "old packet received, start protection\n"); |
184 | } | 184 | } |
185 | 185 | ||
186 | return 0; | 186 | return false; |
187 | } | 187 | } |
188 | 188 | ||
189 | bool batadv_check_management_packet(struct sk_buff *skb, | 189 | bool batadv_check_management_packet(struct sk_buff *skb, |
@@ -718,8 +718,9 @@ out: | |||
718 | return ret; | 718 | return ret; |
719 | } | 719 | } |
720 | 720 | ||
721 | static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, | 721 | static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, |
722 | struct sk_buff *skb, int hdr_len) { | 722 | struct sk_buff *skb, int hdr_len) |
723 | { | ||
723 | struct batadv_unicast_packet *unicast_packet; | 724 | struct batadv_unicast_packet *unicast_packet; |
724 | struct batadv_hard_iface *primary_if; | 725 | struct batadv_hard_iface *primary_if; |
725 | struct batadv_orig_node *orig_node; | 726 | struct batadv_orig_node *orig_node; |
@@ -730,11 +731,11 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, | |||
730 | 731 | ||
731 | /* check if there is enough data before accessing it */ | 732 | /* check if there is enough data before accessing it */ |
732 | if (!pskb_may_pull(skb, hdr_len + ETH_HLEN)) | 733 | if (!pskb_may_pull(skb, hdr_len + ETH_HLEN)) |
733 | return 0; | 734 | return false; |
734 | 735 | ||
735 | /* create a copy of the skb (in case of for re-routing) to modify it. */ | 736 | /* create a copy of the skb (in case of for re-routing) to modify it. */ |
736 | if (skb_cow(skb, sizeof(*unicast_packet)) < 0) | 737 | if (skb_cow(skb, sizeof(*unicast_packet)) < 0) |
737 | return 0; | 738 | return false; |
738 | 739 | ||
739 | unicast_packet = (struct batadv_unicast_packet *)skb->data; | 740 | unicast_packet = (struct batadv_unicast_packet *)skb->data; |
740 | vid = batadv_get_vid(skb, hdr_len); | 741 | vid = batadv_get_vid(skb, hdr_len); |
@@ -758,7 +759,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, | |||
758 | * table. If not, let the packet go untouched anyway because | 759 | * table. If not, let the packet go untouched anyway because |
759 | * there is nothing the node can do | 760 | * there is nothing the node can do |
760 | */ | 761 | */ |
761 | return 1; | 762 | return true; |
762 | } | 763 | } |
763 | 764 | ||
764 | /* retrieve the TTVN known by this node for the packet destination. This | 765 | /* retrieve the TTVN known by this node for the packet destination. This |
@@ -774,7 +775,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, | |||
774 | * not be possible to deliver it | 775 | * not be possible to deliver it |
775 | */ | 776 | */ |
776 | if (!orig_node) | 777 | if (!orig_node) |
777 | return 0; | 778 | return false; |
778 | 779 | ||
779 | curr_ttvn = (u8)atomic_read(&orig_node->last_ttvn); | 780 | curr_ttvn = (u8)atomic_read(&orig_node->last_ttvn); |
780 | batadv_orig_node_put(orig_node); | 781 | batadv_orig_node_put(orig_node); |
@@ -785,7 +786,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, | |||
785 | */ | 786 | */ |
786 | is_old_ttvn = batadv_seq_before(unicast_packet->ttvn, curr_ttvn); | 787 | is_old_ttvn = batadv_seq_before(unicast_packet->ttvn, curr_ttvn); |
787 | if (!is_old_ttvn) | 788 | if (!is_old_ttvn) |
788 | return 1; | 789 | return true; |
789 | 790 | ||
790 | old_ttvn = unicast_packet->ttvn; | 791 | old_ttvn = unicast_packet->ttvn; |
791 | /* the packet was forged based on outdated network information. Its | 792 | /* the packet was forged based on outdated network information. Its |
@@ -798,7 +799,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, | |||
798 | "Rerouting unicast packet to %pM (dst=%pM): TTVN mismatch old_ttvn=%u new_ttvn=%u\n", | 799 | "Rerouting unicast packet to %pM (dst=%pM): TTVN mismatch old_ttvn=%u new_ttvn=%u\n", |
799 | unicast_packet->dest, ethhdr->h_dest, | 800 | unicast_packet->dest, ethhdr->h_dest, |
800 | old_ttvn, curr_ttvn); | 801 | old_ttvn, curr_ttvn); |
801 | return 1; | 802 | return true; |
802 | } | 803 | } |
803 | 804 | ||
804 | /* the packet has not been re-routed: either the destination is | 805 | /* the packet has not been re-routed: either the destination is |
@@ -806,14 +807,14 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, | |||
806 | * it is possible to drop the packet | 807 | * it is possible to drop the packet |
807 | */ | 808 | */ |
808 | if (!batadv_is_my_client(bat_priv, ethhdr->h_dest, vid)) | 809 | if (!batadv_is_my_client(bat_priv, ethhdr->h_dest, vid)) |
809 | return 0; | 810 | return false; |
810 | 811 | ||
811 | /* update the header in order to let the packet be delivered to this | 812 | /* update the header in order to let the packet be delivered to this |
812 | * node's soft interface | 813 | * node's soft interface |
813 | */ | 814 | */ |
814 | primary_if = batadv_primary_if_get_selected(bat_priv); | 815 | primary_if = batadv_primary_if_get_selected(bat_priv); |
815 | if (!primary_if) | 816 | if (!primary_if) |
816 | return 0; | 817 | return false; |
817 | 818 | ||
818 | ether_addr_copy(unicast_packet->dest, primary_if->net_dev->dev_addr); | 819 | ether_addr_copy(unicast_packet->dest, primary_if->net_dev->dev_addr); |
819 | 820 | ||
@@ -821,7 +822,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv, | |||
821 | 822 | ||
822 | unicast_packet->ttvn = curr_ttvn; | 823 | unicast_packet->ttvn = curr_ttvn; |
823 | 824 | ||
824 | return 1; | 825 | return true; |
825 | } | 826 | } |
826 | 827 | ||
827 | /** | 828 | /** |
diff --git a/net/batman-adv/routing.h b/net/batman-adv/routing.h index 02a5caa84127..05c3ff42e181 100644 --- a/net/batman-adv/routing.h +++ b/net/batman-adv/routing.h | |||
@@ -51,8 +51,8 @@ struct batadv_neigh_node * | |||
51 | batadv_find_router(struct batadv_priv *bat_priv, | 51 | batadv_find_router(struct batadv_priv *bat_priv, |
52 | struct batadv_orig_node *orig_node, | 52 | struct batadv_orig_node *orig_node, |
53 | struct batadv_hard_iface *recv_if); | 53 | struct batadv_hard_iface *recv_if); |
54 | int batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff, | 54 | bool batadv_window_protected(struct batadv_priv *bat_priv, s32 seq_num_diff, |
55 | s32 seq_old_max_diff, unsigned long *last_reset, | 55 | s32 seq_old_max_diff, unsigned long *last_reset, |
56 | bool *protection_started); | 56 | bool *protection_started); |
57 | 57 | ||
58 | #endif /* _NET_BATMAN_ADV_ROUTING_H_ */ | 58 | #endif /* _NET_BATMAN_ADV_ROUTING_H_ */ |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 04866c9b860a..3a0fc3c18444 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -1045,12 +1045,12 @@ static void batadv_softif_destroy_netlink(struct net_device *soft_iface, | |||
1045 | unregister_netdevice_queue(soft_iface, head); | 1045 | unregister_netdevice_queue(soft_iface, head); |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | int batadv_softif_is_valid(const struct net_device *net_dev) | 1048 | bool batadv_softif_is_valid(const struct net_device *net_dev) |
1049 | { | 1049 | { |
1050 | if (net_dev->netdev_ops->ndo_start_xmit == batadv_interface_tx) | 1050 | if (net_dev->netdev_ops->ndo_start_xmit == batadv_interface_tx) |
1051 | return 1; | 1051 | return true; |
1052 | 1052 | ||
1053 | return 0; | 1053 | return false; |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | struct rtnl_link_ops batadv_link_ops __read_mostly = { | 1056 | struct rtnl_link_ops batadv_link_ops __read_mostly = { |
diff --git a/net/batman-adv/soft-interface.h b/net/batman-adv/soft-interface.h index b0966342a986..ec303ddbf647 100644 --- a/net/batman-adv/soft-interface.h +++ b/net/batman-adv/soft-interface.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include "main.h" | 21 | #include "main.h" |
22 | 22 | ||
23 | #include <linux/types.h> | ||
23 | #include <net/rtnetlink.h> | 24 | #include <net/rtnetlink.h> |
24 | 25 | ||
25 | struct net_device; | 26 | struct net_device; |
@@ -32,7 +33,7 @@ void batadv_interface_rx(struct net_device *soft_iface, | |||
32 | struct batadv_orig_node *orig_node); | 33 | struct batadv_orig_node *orig_node); |
33 | struct net_device *batadv_softif_create(struct net *net, const char *name); | 34 | struct net_device *batadv_softif_create(struct net *net, const char *name); |
34 | void batadv_softif_destroy_sysfs(struct net_device *soft_iface); | 35 | void batadv_softif_destroy_sysfs(struct net_device *soft_iface); |
35 | int batadv_softif_is_valid(const struct net_device *net_dev); | 36 | bool batadv_softif_is_valid(const struct net_device *net_dev); |
36 | extern struct rtnl_link_ops batadv_link_ops; | 37 | extern struct rtnl_link_ops batadv_link_ops; |
37 | int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid); | 38 | int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid); |
38 | void batadv_softif_vlan_put(struct batadv_softif_vlan *softif_vlan); | 39 | void batadv_softif_vlan_put(struct batadv_softif_vlan *softif_vlan); |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 6ea6e9bf9a8c..feaf492b01ca 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -75,9 +75,9 @@ static void batadv_tt_global_del(struct batadv_priv *bat_priv, | |||
75 | * | 75 | * |
76 | * Compare the MAC address and the VLAN ID of the two TT entries and check if | 76 | * Compare the MAC address and the VLAN ID of the two TT entries and check if |
77 | * they are the same TT client. | 77 | * they are the same TT client. |
78 | * Return: 1 if the two TT clients are the same, 0 otherwise | 78 | * Return: true if the two TT clients are the same, false otherwise |
79 | */ | 79 | */ |
80 | static int batadv_compare_tt(const struct hlist_node *node, const void *data2) | 80 | static bool batadv_compare_tt(const struct hlist_node *node, const void *data2) |
81 | { | 81 | { |
82 | const void *data1 = container_of(node, struct batadv_tt_common_entry, | 82 | const void *data1 = container_of(node, struct batadv_tt_common_entry, |
83 | hash_entry); | 83 | hash_entry); |
@@ -2361,19 +2361,19 @@ unlock: | |||
2361 | * @entry_ptr: to be checked local tt entry | 2361 | * @entry_ptr: to be checked local tt entry |
2362 | * @data_ptr: not used but definition required to satisfy the callback prototype | 2362 | * @data_ptr: not used but definition required to satisfy the callback prototype |
2363 | * | 2363 | * |
2364 | * Return: 1 if the entry is a valid, 0 otherwise. | 2364 | * Return: true if the entry is a valid, false otherwise. |
2365 | */ | 2365 | */ |
2366 | static int batadv_tt_local_valid(const void *entry_ptr, const void *data_ptr) | 2366 | static bool batadv_tt_local_valid(const void *entry_ptr, const void *data_ptr) |
2367 | { | 2367 | { |
2368 | const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; | 2368 | const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; |
2369 | 2369 | ||
2370 | if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW) | 2370 | if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW) |
2371 | return 0; | 2371 | return false; |
2372 | return 1; | 2372 | return true; |
2373 | } | 2373 | } |
2374 | 2374 | ||
2375 | static int batadv_tt_global_valid(const void *entry_ptr, | 2375 | static bool batadv_tt_global_valid(const void *entry_ptr, |
2376 | const void *data_ptr) | 2376 | const void *data_ptr) |
2377 | { | 2377 | { |
2378 | const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; | 2378 | const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; |
2379 | const struct batadv_tt_global_entry *tt_global_entry; | 2379 | const struct batadv_tt_global_entry *tt_global_entry; |
@@ -2381,7 +2381,7 @@ static int batadv_tt_global_valid(const void *entry_ptr, | |||
2381 | 2381 | ||
2382 | if (tt_common_entry->flags & BATADV_TT_CLIENT_ROAM || | 2382 | if (tt_common_entry->flags & BATADV_TT_CLIENT_ROAM || |
2383 | tt_common_entry->flags & BATADV_TT_CLIENT_TEMP) | 2383 | tt_common_entry->flags & BATADV_TT_CLIENT_TEMP) |
2384 | return 0; | 2384 | return false; |
2385 | 2385 | ||
2386 | tt_global_entry = container_of(tt_common_entry, | 2386 | tt_global_entry = container_of(tt_common_entry, |
2387 | struct batadv_tt_global_entry, | 2387 | struct batadv_tt_global_entry, |
@@ -2403,7 +2403,8 @@ static int batadv_tt_global_valid(const void *entry_ptr, | |||
2403 | static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, | 2403 | static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, |
2404 | struct batadv_hashtable *hash, | 2404 | struct batadv_hashtable *hash, |
2405 | void *tvlv_buff, u16 tt_len, | 2405 | void *tvlv_buff, u16 tt_len, |
2406 | int (*valid_cb)(const void *, const void *), | 2406 | bool (*valid_cb)(const void *, |
2407 | const void *), | ||
2407 | void *cb_data) | 2408 | void *cb_data) |
2408 | { | 2409 | { |
2409 | struct batadv_tt_common_entry *tt_common_entry; | 2410 | struct batadv_tt_common_entry *tt_common_entry; |
@@ -2552,11 +2553,11 @@ static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv, | |||
2552 | * | 2553 | * |
2553 | * Return: true if the TT Request was sent, false otherwise | 2554 | * Return: true if the TT Request was sent, false otherwise |
2554 | */ | 2555 | */ |
2555 | static int batadv_send_tt_request(struct batadv_priv *bat_priv, | 2556 | static bool batadv_send_tt_request(struct batadv_priv *bat_priv, |
2556 | struct batadv_orig_node *dst_orig_node, | 2557 | struct batadv_orig_node *dst_orig_node, |
2557 | u8 ttvn, | 2558 | u8 ttvn, |
2558 | struct batadv_tvlv_tt_vlan_data *tt_vlan, | 2559 | struct batadv_tvlv_tt_vlan_data *tt_vlan, |
2559 | u16 num_vlan, bool full_table) | 2560 | u16 num_vlan, bool full_table) |
2560 | { | 2561 | { |
2561 | struct batadv_tvlv_tt_data *tvlv_tt_data = NULL; | 2562 | struct batadv_tvlv_tt_data *tvlv_tt_data = NULL; |
2562 | struct batadv_tt_req_node *tt_req_node = NULL; | 2563 | struct batadv_tt_req_node *tt_req_node = NULL; |