File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -5117,7 +5117,7 @@ static void onstatechange(struct mg_tcpip_if *ifp) {
5117
5117
MG_INFO(("READY, IP: %M", mg_print_ip4, &ifp->ip));
5118
5118
MG_INFO((" GW: %M", mg_print_ip4, &ifp->gw));
5119
5119
MG_INFO((" MAC: %M", mg_print_mac, &ifp->mac));
5120
- arp_ask(ifp, ifp->gw);
5120
+ arp_ask(ifp, ifp->gw); // unsolicited GW ARP request
5121
5121
} else if (ifp->state == MG_TCPIP_STATE_UP) {
5122
5122
MG_ERROR(("Link up"));
5123
5123
srand((unsigned int) mg_millis());
@@ -5966,7 +5966,8 @@ void mg_connect_resolved(struct mg_connection *c) {
5966
5966
if (c->is_udp && (rem_ip == 0xffffffff || rem_ip == (ifp->ip | ~ifp->mask))) {
5967
5967
struct connstate *s = (struct connstate *) (c + 1);
5968
5968
memset(s->mac, 0xFF, sizeof(s->mac)); // global or local broadcast
5969
- } else if (ifp->ip && ((rem_ip & ifp->mask) == (ifp->ip & ifp->mask))) {
5969
+ } else if (ifp->ip && ((rem_ip & ifp->mask) == (ifp->ip & ifp->mask)) &&
5970
+ rem_ip != ifp->gw) { // skip if gw (onstatechange -> READY -> ARP)
5970
5971
// If we're in the same LAN, fire an ARP lookup.
5971
5972
MG_DEBUG(("%lu ARP lookup...", c->id));
5972
5973
arp_ask(ifp, rem_ip);
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ static void onstatechange(struct mg_tcpip_if *ifp) {
204
204
MG_INFO (("READY, IP: %M" , mg_print_ip4 , & ifp -> ip ));
205
205
MG_INFO ((" GW: %M" , mg_print_ip4 , & ifp -> gw ));
206
206
MG_INFO ((" MAC: %M" , mg_print_mac , & ifp -> mac ));
207
- arp_ask (ifp , ifp -> gw );
207
+ arp_ask (ifp , ifp -> gw ); // unsolicited GW ARP request
208
208
} else if (ifp -> state == MG_TCPIP_STATE_UP ) {
209
209
MG_ERROR (("Link up" ));
210
210
srand ((unsigned int ) mg_millis ());
@@ -1053,7 +1053,8 @@ void mg_connect_resolved(struct mg_connection *c) {
1053
1053
if (c -> is_udp && (rem_ip == 0xffffffff || rem_ip == (ifp -> ip | ~ifp -> mask ))) {
1054
1054
struct connstate * s = (struct connstate * ) (c + 1 );
1055
1055
memset (s -> mac , 0xFF , sizeof (s -> mac )); // global or local broadcast
1056
- } else if (ifp -> ip && ((rem_ip & ifp -> mask ) == (ifp -> ip & ifp -> mask ))) {
1056
+ } else if (ifp -> ip && ((rem_ip & ifp -> mask ) == (ifp -> ip & ifp -> mask )) &&
1057
+ rem_ip != ifp -> gw ) { // skip if gw (onstatechange -> READY -> ARP)
1057
1058
// If we're in the same LAN, fire an ARP lookup.
1058
1059
MG_DEBUG (("%lu ARP lookup..." , c -> id ));
1059
1060
arp_ask (ifp , rem_ip );
You can’t perform that action at this time.
0 commit comments