[ovs-dev] [PATCH 1/2] netdev-linux: Support 'send' for netdevs opened with NETDEV_ETH_TYPE_NONE.

Ben Pfaff blp at nicira.com
Fri Apr 1 21:22:55 UTC 2011


On Fri, Apr 01, 2011 at 02:15:04PM -0700, Ethan Jackson wrote:
> > ?/* A Netlink routing socket that is not subscribed to any multicast groups. */
> > ?static struct nl_sock *rtnl_sock;
> > @@ -443,6 +444,14 @@ netdev_linux_init(void)
> > ? ? ? ? status = af_inet_sock >= 0 ? 0 : errno;
> > ? ? ? ? if (status) {
> > ? ? ? ? ? ? VLOG_ERR("failed to create inet socket: %s", strerror(status));
> > + ? ? ? ?} else {
> > + ? ? ? ? ? ?/* Create AF_PACKET socket. */
> > + ? ? ? ? ? ?af_packet_sock = socket(AF_PACKET, SOCK_RAW, 0);
> > + ? ? ? ? ? ?status = af_packet_sock >= 0 ? 0 : errno;
> > + ? ? ? ? ? ?if (status) {
> > + ? ? ? ? ? ? ? ?VLOG_ERR("failed to create packet socket: %s",
> > + ? ? ? ? ? ? ? ? ? ? ? ? strerror(status));
> > + ? ? ? ? ? ?}
> > ? ? ? ? }
> 
> It's not clear to me why this is an else condition.  Is it possible to
> create an af_packet_socket when an af_inet_socket fails?  It seems
> like they are orthogonal.

They are orthogonal but there's no point in creating one without the
other.  The overall initialization procedure fails if any part of it
fails.



More information about the dev mailing list