aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/main.c5
-rw-r--r--net/batman-adv/main.h2
-rw-r--r--net/batman-adv/routing.c38
-rw-r--r--net/batman-adv/translation-table.c2
-rw-r--r--net/batman-adv/vis.c4
-rw-r--r--net/ipv4/tcp_input.c64
6 files changed, 59 insertions, 56 deletions
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 0488d70c8c35..fa563e497c48 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -169,7 +169,7 @@ void batadv_mesh_free(struct net_device *soft_iface)
169 atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE); 169 atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE);
170} 170}
171 171
172int batadv_is_my_mac(const uint8_t *addr) 172int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr)
173{ 173{
174 const struct batadv_hard_iface *hard_iface; 174 const struct batadv_hard_iface *hard_iface;
175 175
@@ -178,6 +178,9 @@ int batadv_is_my_mac(const uint8_t *addr)
178 if (hard_iface->if_status != BATADV_IF_ACTIVE) 178 if (hard_iface->if_status != BATADV_IF_ACTIVE)
179 continue; 179 continue;
180 180
181 if (hard_iface->soft_iface != bat_priv->soft_iface)
182 continue;
183
181 if (batadv_compare_eth(hard_iface->net_dev->dev_addr, addr)) { 184 if (batadv_compare_eth(hard_iface->net_dev->dev_addr, addr)) {
182 rcu_read_unlock(); 185 rcu_read_unlock();
183 return 1; 186 return 1;
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index ced08b936a96..d40910dfc8ea 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -162,7 +162,7 @@ extern struct workqueue_struct *batadv_event_workqueue;
162 162
163int batadv_mesh_init(struct net_device *soft_iface); 163int batadv_mesh_init(struct net_device *soft_iface);
164void batadv_mesh_free(struct net_device *soft_iface); 164void batadv_mesh_free(struct net_device *soft_iface);
165int batadv_is_my_mac(const uint8_t *addr); 165int batadv_is_my_mac(struct batadv_priv *bat_priv, const uint8_t *addr);
166struct batadv_hard_iface * 166struct batadv_hard_iface *
167batadv_seq_print_text_primary_if_get(struct seq_file *seq); 167batadv_seq_print_text_primary_if_get(struct seq_file *seq);
168int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, 168int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 5ee21cebbbb0..319f2906c71a 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -402,7 +402,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
402 goto out; 402 goto out;
403 403
404 /* not for me */ 404 /* not for me */
405 if (!batadv_is_my_mac(ethhdr->h_dest)) 405 if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest))
406 goto out; 406 goto out;
407 407
408 icmp_packet = (struct batadv_icmp_packet_rr *)skb->data; 408 icmp_packet = (struct batadv_icmp_packet_rr *)skb->data;
@@ -416,7 +416,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb,
416 } 416 }
417 417
418 /* packet for me */ 418 /* packet for me */
419 if (batadv_is_my_mac(icmp_packet->dst)) 419 if (batadv_is_my_mac(bat_priv, icmp_packet->dst))
420 return batadv_recv_my_icmp_packet(bat_priv, skb, hdr_size); 420 return batadv_recv_my_icmp_packet(bat_priv, skb, hdr_size);
421 421
422 /* TTL exceeded */ 422 /* TTL exceeded */
@@ -548,7 +548,8 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig,
548 return router; 548 return router;
549} 549}
550 550
551static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size) 551static int batadv_check_unicast_packet(struct batadv_priv *bat_priv,
552 struct sk_buff *skb, int hdr_size)
552{ 553{
553 struct ethhdr *ethhdr; 554 struct ethhdr *ethhdr;
554 555
@@ -567,7 +568,7 @@ static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size)
567 return -1; 568 return -1;
568 569
569 /* not for me */ 570 /* not for me */
570 if (!batadv_is_my_mac(ethhdr->h_dest)) 571 if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest))
571 return -1; 572 return -1;
572 573
573 return 0; 574 return 0;
@@ -582,7 +583,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
582 char tt_flag; 583 char tt_flag;
583 size_t packet_size; 584 size_t packet_size;
584 585
585 if (batadv_check_unicast_packet(skb, hdr_size) < 0) 586 if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
586 return NET_RX_DROP; 587 return NET_RX_DROP;
587 588
588 /* I could need to modify it */ 589 /* I could need to modify it */
@@ -614,7 +615,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
614 case BATADV_TT_RESPONSE: 615 case BATADV_TT_RESPONSE:
615 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); 616 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX);
616 617
617 if (batadv_is_my_mac(tt_query->dst)) { 618 if (batadv_is_my_mac(bat_priv, tt_query->dst)) {
618 /* packet needs to be linearized to access the TT 619 /* packet needs to be linearized to access the TT
619 * changes 620 * changes
620 */ 621 */
@@ -657,14 +658,15 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
657 struct batadv_roam_adv_packet *roam_adv_packet; 658 struct batadv_roam_adv_packet *roam_adv_packet;
658 struct batadv_orig_node *orig_node; 659 struct batadv_orig_node *orig_node;
659 660
660 if (batadv_check_unicast_packet(skb, sizeof(*roam_adv_packet)) < 0) 661 if (batadv_check_unicast_packet(bat_priv, skb,
662 sizeof(*roam_adv_packet)) < 0)
661 goto out; 663 goto out;
662 664
663 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); 665 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
664 666
665 roam_adv_packet = (struct batadv_roam_adv_packet *)skb->data; 667 roam_adv_packet = (struct batadv_roam_adv_packet *)skb->data;
666 668
667 if (!batadv_is_my_mac(roam_adv_packet->dst)) 669 if (!batadv_is_my_mac(bat_priv, roam_adv_packet->dst))
668 return batadv_route_unicast_packet(skb, recv_if); 670 return batadv_route_unicast_packet(skb, recv_if);
669 671
670 /* check if it is a backbone gateway. we don't accept 672 /* check if it is a backbone gateway. we don't accept
@@ -967,7 +969,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
967 * last time) the packet had an updated information or not 969 * last time) the packet had an updated information or not
968 */ 970 */
969 curr_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn); 971 curr_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn);
970 if (!batadv_is_my_mac(unicast_packet->dest)) { 972 if (!batadv_is_my_mac(bat_priv, unicast_packet->dest)) {
971 orig_node = batadv_orig_hash_find(bat_priv, 973 orig_node = batadv_orig_hash_find(bat_priv,
972 unicast_packet->dest); 974 unicast_packet->dest);
973 /* if it is not possible to find the orig_node representing the 975 /* if it is not possible to find the orig_node representing the
@@ -1044,14 +1046,14 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
1044 if (is4addr) 1046 if (is4addr)
1045 hdr_size = sizeof(*unicast_4addr_packet); 1047 hdr_size = sizeof(*unicast_4addr_packet);
1046 1048
1047 if (batadv_check_unicast_packet(skb, hdr_size) < 0) 1049 if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
1048 return NET_RX_DROP; 1050 return NET_RX_DROP;
1049 1051
1050 if (!batadv_check_unicast_ttvn(bat_priv, skb)) 1052 if (!batadv_check_unicast_ttvn(bat_priv, skb))
1051 return NET_RX_DROP; 1053 return NET_RX_DROP;
1052 1054
1053 /* packet for me */ 1055 /* packet for me */
1054 if (batadv_is_my_mac(unicast_packet->dest)) { 1056 if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) {
1055 if (is4addr) { 1057 if (is4addr) {
1056 batadv_dat_inc_counter(bat_priv, 1058 batadv_dat_inc_counter(bat_priv,
1057 unicast_4addr_packet->subtype); 1059 unicast_4addr_packet->subtype);
@@ -1088,7 +1090,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
1088 struct sk_buff *new_skb = NULL; 1090 struct sk_buff *new_skb = NULL;
1089 int ret; 1091 int ret;
1090 1092
1091 if (batadv_check_unicast_packet(skb, hdr_size) < 0) 1093 if (batadv_check_unicast_packet(bat_priv, skb, hdr_size) < 0)
1092 return NET_RX_DROP; 1094 return NET_RX_DROP;
1093 1095
1094 if (!batadv_check_unicast_ttvn(bat_priv, skb)) 1096 if (!batadv_check_unicast_ttvn(bat_priv, skb))
@@ -1097,7 +1099,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
1097 unicast_packet = (struct batadv_unicast_frag_packet *)skb->data; 1099 unicast_packet = (struct batadv_unicast_frag_packet *)skb->data;
1098 1100
1099 /* packet for me */ 1101 /* packet for me */
1100 if (batadv_is_my_mac(unicast_packet->dest)) { 1102 if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) {
1101 ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb); 1103 ret = batadv_frag_reassemble_skb(skb, bat_priv, &new_skb);
1102 1104
1103 if (ret == NET_RX_DROP) 1105 if (ret == NET_RX_DROP)
@@ -1151,13 +1153,13 @@ int batadv_recv_bcast_packet(struct sk_buff *skb,
1151 goto out; 1153 goto out;
1152 1154
1153 /* ignore broadcasts sent by myself */ 1155 /* ignore broadcasts sent by myself */
1154 if (batadv_is_my_mac(ethhdr->h_source)) 1156 if (batadv_is_my_mac(bat_priv, ethhdr->h_source))
1155 goto out; 1157 goto out;
1156 1158
1157 bcast_packet = (struct batadv_bcast_packet *)skb->data; 1159 bcast_packet = (struct batadv_bcast_packet *)skb->data;
1158 1160
1159 /* ignore broadcasts originated by myself */ 1161 /* ignore broadcasts originated by myself */
1160 if (batadv_is_my_mac(bcast_packet->orig)) 1162 if (batadv_is_my_mac(bat_priv, bcast_packet->orig))
1161 goto out; 1163 goto out;
1162 1164
1163 if (bcast_packet->header.ttl < 2) 1165 if (bcast_packet->header.ttl < 2)
@@ -1243,14 +1245,14 @@ int batadv_recv_vis_packet(struct sk_buff *skb,
1243 ethhdr = (struct ethhdr *)skb_mac_header(skb); 1245 ethhdr = (struct ethhdr *)skb_mac_header(skb);
1244 1246
1245 /* not for me */ 1247 /* not for me */
1246 if (!batadv_is_my_mac(ethhdr->h_dest)) 1248 if (!batadv_is_my_mac(bat_priv, ethhdr->h_dest))
1247 return NET_RX_DROP; 1249 return NET_RX_DROP;
1248 1250
1249 /* ignore own packets */ 1251 /* ignore own packets */
1250 if (batadv_is_my_mac(vis_packet->vis_orig)) 1252 if (batadv_is_my_mac(bat_priv, vis_packet->vis_orig))
1251 return NET_RX_DROP; 1253 return NET_RX_DROP;
1252 1254
1253 if (batadv_is_my_mac(vis_packet->sender_orig)) 1255 if (batadv_is_my_mac(bat_priv, vis_packet->sender_orig))
1254 return NET_RX_DROP; 1256 return NET_RX_DROP;
1255 1257
1256 switch (vis_packet->vis_type) { 1258 switch (vis_packet->vis_type) {
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 98a66a021a60..7abee19567e9 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1953,7 +1953,7 @@ out:
1953bool batadv_send_tt_response(struct batadv_priv *bat_priv, 1953bool batadv_send_tt_response(struct batadv_priv *bat_priv,
1954 struct batadv_tt_query_packet *tt_request) 1954 struct batadv_tt_query_packet *tt_request)
1955{ 1955{
1956 if (batadv_is_my_mac(tt_request->dst)) { 1956 if (batadv_is_my_mac(bat_priv, tt_request->dst)) {
1957 /* don't answer backbone gws! */ 1957 /* don't answer backbone gws! */
1958 if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_request->src)) 1958 if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_request->src))
1959 return true; 1959 return true;
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index c053244b97bd..6a1e646be96d 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -477,7 +477,7 @@ void batadv_receive_client_update_packet(struct batadv_priv *bat_priv,
477 477
478 /* Are we the target for this VIS packet? */ 478 /* Are we the target for this VIS packet? */
479 if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC && 479 if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC &&
480 batadv_is_my_mac(vis_packet->target_orig)) 480 batadv_is_my_mac(bat_priv, vis_packet->target_orig))
481 are_target = 1; 481 are_target = 1;
482 482
483 spin_lock_bh(&bat_priv->vis.hash_lock); 483 spin_lock_bh(&bat_priv->vis.hash_lock);
@@ -496,7 +496,7 @@ void batadv_receive_client_update_packet(struct batadv_priv *bat_priv,
496 batadv_send_list_add(bat_priv, info); 496 batadv_send_list_add(bat_priv, info);
497 497
498 /* ... we're not the recipient (and thus need to forward). */ 498 /* ... we're not the recipient (and thus need to forward). */
499 } else if (!batadv_is_my_mac(packet->target_orig)) { 499 } else if (!batadv_is_my_mac(bat_priv, packet->target_orig)) {
500 batadv_send_list_add(bat_priv, info); 500 batadv_send_list_add(bat_priv, info);
501 } 501 }
502 502
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 3bd55bad230a..13b9c08fc158 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -113,6 +113,7 @@ int sysctl_tcp_early_retrans __read_mostly = 2;
113#define FLAG_DSACKING_ACK 0x800 /* SACK blocks contained D-SACK info */ 113#define FLAG_DSACKING_ACK 0x800 /* SACK blocks contained D-SACK info */
114#define FLAG_NONHEAD_RETRANS_ACKED 0x1000 /* Non-head rexmitted data was ACKed */ 114#define FLAG_NONHEAD_RETRANS_ACKED 0x1000 /* Non-head rexmitted data was ACKed */
115#define FLAG_SACK_RENEGING 0x2000 /* snd_una advanced to a sacked seq */ 115#define FLAG_SACK_RENEGING 0x2000 /* snd_una advanced to a sacked seq */
116#define FLAG_UPDATE_TS_RECENT 0x4000 /* tcp_replace_ts_recent() */
116 117
117#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) 118#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
118#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED) 119#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)
@@ -3564,6 +3565,27 @@ static void tcp_send_challenge_ack(struct sock *sk)
3564 } 3565 }
3565} 3566}
3566 3567
3568static void tcp_store_ts_recent(struct tcp_sock *tp)
3569{
3570 tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval;
3571 tp->rx_opt.ts_recent_stamp = get_seconds();
3572}
3573
3574static void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq)
3575{
3576 if (tp->rx_opt.saw_tstamp && !after(seq, tp->rcv_wup)) {
3577 /* PAWS bug workaround wrt. ACK frames, the PAWS discard
3578 * extra check below makes sure this can only happen
3579 * for pure ACK frames. -DaveM
3580 *
3581 * Not only, also it occurs for expired timestamps.
3582 */
3583
3584 if (tcp_paws_check(&tp->rx_opt, 0))
3585 tcp_store_ts_recent(tp);
3586 }
3587}
3588
3567/* This routine deals with incoming acks, but not outgoing ones. */ 3589/* This routine deals with incoming acks, but not outgoing ones. */
3568static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) 3590static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
3569{ 3591{
@@ -3607,6 +3629,12 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
3607 prior_fackets = tp->fackets_out; 3629 prior_fackets = tp->fackets_out;
3608 prior_in_flight = tcp_packets_in_flight(tp); 3630 prior_in_flight = tcp_packets_in_flight(tp);
3609 3631
3632 /* ts_recent update must be made after we are sure that the packet
3633 * is in window.
3634 */
3635 if (flag & FLAG_UPDATE_TS_RECENT)
3636 tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
3637
3610 if (!(flag & FLAG_SLOWPATH) && after(ack, prior_snd_una)) { 3638 if (!(flag & FLAG_SLOWPATH) && after(ack, prior_snd_una)) {
3611 /* Window is constant, pure forward advance. 3639 /* Window is constant, pure forward advance.
3612 * No more checks are required. 3640 * No more checks are required.
@@ -3927,27 +3955,6 @@ const u8 *tcp_parse_md5sig_option(const struct tcphdr *th)
3927EXPORT_SYMBOL(tcp_parse_md5sig_option); 3955EXPORT_SYMBOL(tcp_parse_md5sig_option);
3928#endif 3956#endif
3929 3957
3930static inline void tcp_store_ts_recent(struct tcp_sock *tp)
3931{
3932 tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval;
3933 tp->rx_opt.ts_recent_stamp = get_seconds();
3934}
3935
3936static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq)
3937{
3938 if (tp->rx_opt.saw_tstamp && !after(seq, tp->rcv_wup)) {
3939 /* PAWS bug workaround wrt. ACK frames, the PAWS discard
3940 * extra check below makes sure this can only happen
3941 * for pure ACK frames. -DaveM
3942 *
3943 * Not only, also it occurs for expired timestamps.
3944 */
3945
3946 if (tcp_paws_check(&tp->rx_opt, 0))
3947 tcp_store_ts_recent(tp);
3948 }
3949}
3950
3951/* Sorry, PAWS as specified is broken wrt. pure-ACKs -DaveM 3958/* Sorry, PAWS as specified is broken wrt. pure-ACKs -DaveM
3952 * 3959 *
3953 * It is not fatal. If this ACK does _not_ change critical state (seqs, window) 3960 * It is not fatal. If this ACK does _not_ change critical state (seqs, window)
@@ -5543,14 +5550,9 @@ slow_path:
5543 return 0; 5550 return 0;
5544 5551
5545step5: 5552step5:
5546 if (tcp_ack(sk, skb, FLAG_SLOWPATH) < 0) 5553 if (tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT) < 0)
5547 goto discard; 5554 goto discard;
5548 5555
5549 /* ts_recent update must be made after we are sure that the packet
5550 * is in window.
5551 */
5552 tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
5553
5554 tcp_rcv_rtt_measure_ts(sk, skb); 5556 tcp_rcv_rtt_measure_ts(sk, skb);
5555 5557
5556 /* Process urgent data. */ 5558 /* Process urgent data. */
@@ -5986,7 +5988,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
5986 5988
5987 /* step 5: check the ACK field */ 5989 /* step 5: check the ACK field */
5988 if (true) { 5990 if (true) {
5989 int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH) > 0; 5991 int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH |
5992 FLAG_UPDATE_TS_RECENT) > 0;
5990 5993
5991 switch (sk->sk_state) { 5994 switch (sk->sk_state) {
5992 case TCP_SYN_RECV: 5995 case TCP_SYN_RECV:
@@ -6137,11 +6140,6 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
6137 } 6140 }
6138 } 6141 }
6139 6142
6140 /* ts_recent update must be made after we are sure that the packet
6141 * is in window.
6142 */
6143 tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
6144
6145 /* step 6: check the URG bit */ 6143 /* step 6: check the URG bit */
6146 tcp_urg(sk, skb, th); 6144 tcp_urg(sk, skb, th);
6147 6145