Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 14062
b: refs/heads/master
c: c50d2c4
h: refs/heads/master
v: v3
  • Loading branch information
Paolo 'Blaisorblade' Giarrusso authored and Linus Torvalds committed Nov 14, 2005
1 parent 003fbf9 commit 3ee9aca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 85977376c73b7712ed3618888ade126075888c06
refs/heads/master: c50d2c4d6685db9b45cf6521046296df5bc42592
20 changes: 10 additions & 10 deletions trunk/arch/um/drivers/mcast_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static int mcast_open(void *data)
struct mcast_data *pri = data;
struct sockaddr_in *sin = pri->mcast_addr;
struct ip_mreq mreq;
int fd, yes = 1, err = 0;
int fd, yes = 1, err = -EINVAL;


if ((sin->sin_addr.s_addr == 0) || (sin->sin_port == 0))
Expand All @@ -63,40 +63,40 @@ static int mcast_open(void *data)
fd = socket(AF_INET, SOCK_DGRAM, 0);

if (fd < 0){
err = -errno;
printk("mcast_open : data socket failed, errno = %d\n",
errno);
err = -errno;
goto out;
}

if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) {
err = -errno;
printk("mcast_open: SO_REUSEADDR failed, errno = %d\n",
errno);
err = -errno;
goto out_close;
}

/* set ttl according to config */
if (setsockopt(fd, SOL_IP, IP_MULTICAST_TTL, &pri->ttl,
sizeof(pri->ttl)) < 0) {
err = -errno;
printk("mcast_open: IP_MULTICAST_TTL failed, error = %d\n",
errno);
err = -errno;
goto out_close;
}

/* set LOOP, so data does get fed back to local sockets */
if (setsockopt(fd, SOL_IP, IP_MULTICAST_LOOP, &yes, sizeof(yes)) < 0) {
err = -errno;
printk("mcast_open: IP_MULTICAST_LOOP failed, error = %d\n",
errno);
err = -errno;
goto out_close;
}

/* bind socket to mcast address */
if (bind(fd, (struct sockaddr *) sin, sizeof(*sin)) < 0) {
printk("mcast_open : data bind failed, errno = %d\n", errno);
err = -errno;
printk("mcast_open : data bind failed, errno = %d\n", errno);
goto out_close;
}

Expand All @@ -105,22 +105,22 @@ static int mcast_open(void *data)
mreq.imr_interface.s_addr = 0;
if (setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP,
&mreq, sizeof(mreq)) < 0) {
err = -errno;
printk("mcast_open: IP_ADD_MEMBERSHIP failed, error = %d\n",
errno);
printk("There appears not to be a multicast-capable network "
"interface on the host.\n");
printk("eth0 should be configured in order to use the "
"multicast transport.\n");
err = -errno;
goto out_close;
goto out_close;
}

return fd;

out_close:
os_close_file(fd);
os_close_file(fd);
out:
return err;
return err;
}

static void mcast_close(int fd, void *data)
Expand Down

0 comments on commit 3ee9aca

Please sign in to comment.