virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jens Osterkamp <jens@linux.vnet.ibm.com>
To: e1000-eedc@lists.sourceforge.net,
	virtualization@lists.linux-foundation.org, evb@yahoogroups.com
Cc: chrisw@redhat.com, Gerhard Stenzel <gstenzel@linux.vnet.ibm.com>,
	Jens Osterkamp <jens@linux.vnet.ibm.com>
Subject: [PATCH 7/9] use connect instead of bind
Date: Tue, 28 Sep 2010 17:11:00 +0200	[thread overview]
Message-ID: <1285686662-8561-8-git-send-email-jens@linux.vnet.ibm.com> (raw)
In-Reply-To: <1285686662-8561-1-git-send-email-jens@linux.vnet.ibm.com>

modifies the setup of the netlink socket in drv_cfg.c to use pid 0 instead
of the processes pid.
Also replaces bind with connect to allow the reception of netlink messages
from libvirt.
Preparation patch for communication between libvirt and lldpad.

Signed-off-by: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com>
---
 drv_cfg.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drv_cfg.c b/drv_cfg.c
index 6c02555..23c11f3 100644
--- a/drv_cfg.c
+++ b/drv_cfg.c
@@ -71,9 +71,9 @@ static int init_socket(void)
 
 	memset((void *)&snl, 0, sizeof(struct sockaddr_nl));
 	snl.nl_family = AF_NETLINK;
-	snl.nl_pid = getpid();
+	snl.nl_pid = 0;
 
-	if (bind(sd, (struct sockaddr *)&snl, sizeof(struct sockaddr_nl)) < 0) {
+	if (connect(sd, (struct sockaddr *)&snl, sizeof(struct sockaddr_nl)) < 0) {
 		close(sd);
 		return -EIO;
 	}
@@ -195,6 +195,7 @@ static struct nlmsghdr *get_msg(unsigned int seq)
 			nlh = NULL;
 			break;
 		}
+		fprintf(stderr, "%s:%s: nlmsg_type: %d\n", __FILE__, __FUNCTION__, nlh->nlmsg_type);
 		if ((nlh->nlmsg_type == RTM_GETDCB ||
 			nlh->nlmsg_type == RTM_SETDCB) &&
 			nlh->nlmsg_seq == seq) {
-- 
1.7.1

  parent reply	other threads:[~2010-09-28 15:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28 15:10 implementation of IEEE 802.1Qbg in lldpad Jens Osterkamp
2010-09-28 15:10 ` [PATCH 1/9] consolidation of MIN and MAX macros in common.h Jens Osterkamp
2010-09-28 15:10 ` [PATCH 2/9] implementation of IEEE 802.1Qbg in lldpad, part 1 Jens Osterkamp
2010-10-12 18:05   ` [E1000-eedc] " John Fastabend
2010-10-13 14:40     ` Jens Osterkamp
2010-09-28 15:10 ` [PATCH 3/9] BUGFIX: check for existence of ifup Jens Osterkamp
2010-09-28 15:10 ` [PATCH 4/9] implementation of IEEE 802.1Qbg in lldpad, part 2 Jens Osterkamp
2010-10-12 18:06   ` [E1000-eedc] " John Fastabend
2010-10-13 15:03     ` Jens Osterkamp
2010-09-28 15:10 ` [PATCH 5/9] VDP commandline interface Jens Osterkamp
2010-09-28 15:10 ` [PATCH 6/9] add libnl dependency to configure.ac Jens Osterkamp
2010-09-28 15:11 ` Jens Osterkamp [this message]
2010-09-28 15:11 ` [PATCH 8/9] lldpad support for libvirt netlink message Jens Osterkamp
2010-09-28 15:11 ` [PATCH 9/9] do not use macv[tap/lan] interfaces as ports Jens Osterkamp
  -- strict thread matches above, loose matches on Subject: below --
2010-10-22 11:26 implementation of IEEE 802.1Qbg in lldpad Jens Osterkamp
2010-10-22 11:26 ` [PATCH 7/9] use connect instead of bind Jens Osterkamp
2010-11-08 16:11 implementation of IEEE 802.1Qbg in lldpad Jens Osterkamp
2010-11-08 16:11 ` [PATCH 7/9] use connect instead of bind Jens Osterkamp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1285686662-8561-8-git-send-email-jens@linux.vnet.ibm.com \
    --to=jens@linux.vnet.ibm.com \
    --cc=chrisw@redhat.com \
    --cc=e1000-eedc@lists.sourceforge.net \
    --cc=evb@yahoogroups.com \
    --cc=gstenzel@linux.vnet.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).