platform: implement our own sequence counter

Instead of using the one from libnl's socket.
This commit is contained in:
Thomas Haller
2015-12-14 11:53:46 +01:00
parent 4ea711e03e
commit c9e04c963e

View File

@@ -2296,6 +2296,7 @@ typedef struct _NMLinuxPlatformPrivate NMLinuxPlatformPrivate;
struct _NMLinuxPlatformPrivate { struct _NMLinuxPlatformPrivate {
struct nl_sock *nlh; struct nl_sock *nlh;
struct nl_sock *nlh_event; struct nl_sock *nlh_event;
guint32 nlh_seq_next;
guint32 nlh_seq_expect; guint32 nlh_seq_expect;
guint32 nlh_seq_last; guint32 nlh_seq_last;
NMPCache *cache; NMPCache *cache;
@@ -3122,12 +3123,8 @@ _nl_send_auto_with_seq (NMPlatform *platform, struct nl_msg *nlmsg)
guint32 seq; guint32 seq;
int nle; int nle;
/* complete the message, by choosing our own sequence number, because libnl /* complete the message with a sequence number (ensuring it's not zero). */
* does not ensure that it isn't zero -- which would confuse our checking for seq = priv->nlh_seq_next++ ?: priv->nlh_seq_next++;
* outstanding messages. */
seq = nl_socket_use_seq (priv->nlh_event);
if (seq == 0)
seq = nl_socket_use_seq (priv->nlh_event);
nlmsg_hdr (nlmsg)->nlmsg_seq = seq; nlmsg_hdr (nlmsg)->nlmsg_seq = seq;
@@ -5718,6 +5715,7 @@ nm_linux_platform_init (NMLinuxPlatform *self)
self->priv = priv; self->priv = priv;
priv->nlh_seq_next = 1;
priv->cache = nmp_cache_new (); priv->cache = nmp_cache_new ();
priv->delayed_action.list_master_connected = g_ptr_array_new (); priv->delayed_action.list_master_connected = g_ptr_array_new ();
priv->delayed_action.list_refresh_link = g_ptr_array_new (); priv->delayed_action.list_refresh_link = g_ptr_array_new ();