mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 12:40:11 +01:00
2005-09-15 Christopher Aillon <caillon@redhat.com>
* src/NetworkManagerAP.c: * src/NetworkManagerAP.h: * src/NetworkManagerDevice.c: Set a blacklist for certain common manufacturer default ESSIDs: APs with these ESSIDs are extremely likely to be completely different networks: connecting to one should not make NM auto-connect to every other AP with the same default ESSID. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@963 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
7401bede03
commit
fd92ca40d8
4 changed files with 72 additions and 2 deletions
10
ChangeLog
10
ChangeLog
|
|
@ -1,3 +1,13 @@
|
|||
2005-09-15 Christopher Aillon <caillon@redhat.com>
|
||||
|
||||
* src/NetworkManagerAP.c:
|
||||
* src/NetworkManagerAP.h:
|
||||
* src/NetworkManagerDevice.c:
|
||||
Set a blacklist for certain common manufacturer default ESSIDs:
|
||||
APs with these ESSIDs are extremely likely to be completely
|
||||
different networks: connecting to one should not make NM
|
||||
auto-connect to every other AP with the same default ESSID.
|
||||
|
||||
2005-09-12 Christopher Aillon <caillon@redhat.com>
|
||||
|
||||
* gnome/applet/wireless-applet.glade:
|
||||
|
|
|
|||
|
|
@ -55,6 +55,16 @@ struct NMAccessPoint
|
|||
GSList *user_addresses;
|
||||
};
|
||||
|
||||
/* This is a controlled list. Want to add to it? Stop. Ask first. */
|
||||
static char* default_essid_list[] =
|
||||
{
|
||||
"linksys",
|
||||
"default",
|
||||
"belkin54g",
|
||||
"NETGEAR",
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* nm_ap_new
|
||||
*
|
||||
|
|
@ -613,3 +623,19 @@ gboolean nm_is_enc_key_valid (const char *key, NMEncKeyType key_type)
|
|||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean nm_ap_has_manufacturer_default_essid (NMAccessPoint *ap)
|
||||
{
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (ap != NULL, FALSE);
|
||||
|
||||
for (i = 0; default_essid_list[i] != NULL; i++)
|
||||
{
|
||||
char *essid = default_essid_list[i];
|
||||
if (strcmp (essid, ap->essid) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,4 +91,11 @@ void nm_ap_set_user_addresses (NMAccessPoint *ap, GSList *list);
|
|||
gboolean nm_ap_is_enc_key_valid (NMAccessPoint *ap);
|
||||
gboolean nm_is_enc_key_valid (const char *key, NMEncKeyType key_type);
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* This is not intended to return true for all APs with manufacturer defaults. It is intended to return true for
|
||||
* only the MOST COMMON manufacturing defaults.
|
||||
*/
|
||||
gboolean nm_ap_has_manufacturer_default_essid (NMAccessPoint *ap);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <iwlib.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <netinet/ether.h>
|
||||
|
||||
#include "autoip.h"
|
||||
#include "NetworkManager.h"
|
||||
|
|
@ -3511,14 +3512,40 @@ NMAccessPoint * nm_device_get_best_ap (NMDevice *dev)
|
|||
{
|
||||
const GTimeVal *curtime = nm_ap_get_timestamp (tmp_ap);
|
||||
|
||||
if (nm_ap_get_trusted (tmp_ap) && (curtime->tv_sec > trusted_latest_timestamp.tv_sec))
|
||||
gboolean blacklisted = nm_ap_has_manufacturer_default_essid (scan_ap);
|
||||
if (blacklisted)
|
||||
{
|
||||
GSList *elt, *user_addrs;
|
||||
const struct ether_addr *ap_addr;
|
||||
char char_addr[20];
|
||||
|
||||
ap_addr = nm_ap_get_address (scan_ap);
|
||||
user_addrs = nm_ap_get_user_addresses (tmp_ap);
|
||||
|
||||
memset (&char_addr[0], 0, 20);
|
||||
ether_ntoa_r (ap_addr, &char_addr[0]);
|
||||
|
||||
for (elt = user_addrs; elt; elt = g_slist_next (elt))
|
||||
{
|
||||
if (elt->data && !strcmp (elt->data, &char_addr[0]))
|
||||
{
|
||||
blacklisted = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_slist_foreach (user_addrs, (GFunc)g_free, NULL);
|
||||
g_slist_free (user_addrs);
|
||||
}
|
||||
|
||||
if (!blacklisted && nm_ap_get_trusted (tmp_ap) && (curtime->tv_sec > trusted_latest_timestamp.tv_sec))
|
||||
{
|
||||
trusted_latest_timestamp = *nm_ap_get_timestamp (tmp_ap);
|
||||
trusted_best_ap = scan_ap;
|
||||
/* Merge access point data (mainly to get updated WEP key) */
|
||||
nm_ap_set_enc_key_source (trusted_best_ap, nm_ap_get_enc_key_source (tmp_ap), nm_ap_get_enc_type (tmp_ap));
|
||||
}
|
||||
else if (!nm_ap_get_trusted (tmp_ap) && (curtime->tv_sec > untrusted_latest_timestamp.tv_sec))
|
||||
else if (!blacklisted && !nm_ap_get_trusted (tmp_ap) && (curtime->tv_sec > untrusted_latest_timestamp.tv_sec))
|
||||
{
|
||||
untrusted_latest_timestamp = *nm_ap_get_timestamp (tmp_ap);
|
||||
untrusted_best_ap = scan_ap;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue