[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 29/43: eth-multiplexer: Respect interfaces up flags.
From: |
Samuel Thibault |
Subject: |
[hurd] 29/43: eth-multiplexer: Respect interfaces up flags. |
Date: |
Mon, 11 Sep 2017 07:10:11 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 61d5aee1ce02888e78eab4ed85a9c8e631006d7b
Author: Justus Winter <address@hidden>
Date: Tue Aug 22 19:38:25 2017 +0200
eth-multiplexer: Respect interfaces up flags.
* eth-multiplexer/device_impl.c (ds_device_write): Deny writes when
interface is down.
* eth-multiplexer/vdev.c (add_vdev): Initialize flags to
a sane value.
(broadcast_pack): Skip interfaces that are down.
(broadcast_msg): Likewise.
---
eth-multiplexer/device_impl.c | 3 +++
eth-multiplexer/vdev.c | 14 +++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/eth-multiplexer/device_impl.c b/eth-multiplexer/device_impl.c
index 18ebf07..f23738a 100644
--- a/eth-multiplexer/device_impl.c
+++ b/eth-multiplexer/device_impl.c
@@ -108,6 +108,9 @@ ds_device_write (struct vether_device *vdev, mach_port_t
reply_port,
if (vdev == NULL)
return D_NO_SUCH_DEVICE;
+ if ((vdev->if_flags & IFF_UP) == 0)
+ return D_DEVICE_DOWN;
+
/* The packet is forwarded to all virtual interfaces and
* the interface which the multiplexer connects to. */
broadcast_pack (data, datalen, vdev);
diff --git a/eth-multiplexer/vdev.c b/eth-multiplexer/vdev.c
index 47dc8d2..9a1f7b2 100644
--- a/eth-multiplexer/vdev.c
+++ b/eth-multiplexer/vdev.c
@@ -145,7 +145,12 @@ add_vdev (char *name, int size,
vdev->if_mtu = ETH_MTU;
vdev->if_header_format = HDR_ETHERNET;
vdev->if_address_size = ETH_ALEN;
- vdev->if_flags = 0;
+ vdev->if_flags = (/* The interface is 'UP' on creation. */
+ IFF_UP
+ /* We have allocated resources for it. */
+ | IFF_RUNNING
+ /* Advertise ethernet-style capabilities. */
+ | IFF_BROADCAST | IFF_MULTICAST);
/* Compute a pseudo-random but stable ethernet address. */
vdev->if_address[0] = 0x52;
@@ -203,8 +208,12 @@ broadcast_pack (char *data, int datalen, struct
vether_device *from_vdev)
{
int internal_deliver_pack (struct vether_device *vdev)
{
+ /* Skip current interface. */
if (from_vdev == vdev)
return 0;
+ /* Skip interfaces that are down. */
+ if ((vdev->if_flags & IFF_UP) == 0)
+ return 0;
return deliver_pack (data, datalen, vdev);
}
@@ -247,6 +256,9 @@ broadcast_msg (struct net_rcv_msg *msg)
int internal_deliver_msg (struct vether_device *vdev)
{
+ /* Skip interfaces that are down. */
+ if ((vdev->if_flags & IFF_UP) == 0)
+ return 0;
return deliver_msg (msg, vdev);
}
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 14/43: procfs: Provide 'hostinfo'., (continued)
- [hurd] 14/43: procfs: Provide 'hostinfo'., Samuel Thibault, 2017/09/11
- [hurd] 23/43: startup: Improve error handling., Samuel Thibault, 2017/09/11
- [hurd] 28/43: eth-multiplexer: Allow setting of flags., Samuel Thibault, 2017/09/11
- [hurd] 33/43: libdiskfs: Use control class for the singleton 'bootinfo'., Samuel Thibault, 2017/09/11
- [hurd] 31/43: ext2fs: Improve inlining., Samuel Thibault, 2017/09/11
- [hurd] 08/43: trans/fakeroot: Obey O_NOFOLLOW., Samuel Thibault, 2017/09/11
- [hurd] 35/43: libnetfs: Remove redundant type checks., Samuel Thibault, 2017/09/11
- [hurd] 26/43: eth-multiplexer: Remove local definiton., Samuel Thibault, 2017/09/11
- [hurd] 34/43: libdiskfs: Simplify type checks., Samuel Thibault, 2017/09/11
- [hurd] 16/43: Simplify deallocations., Samuel Thibault, 2017/09/11
- [hurd] 29/43: eth-multiplexer: Respect interfaces up flags.,
Samuel Thibault <=
- [hurd] 36/43: startup: Don't spin on host_reboot failures., Samuel Thibault, 2017/09/11
- [hurd] 30/43: Drop the register qualifier., Samuel Thibault, 2017/09/11
- [hurd] 02/43: trans: New random translator., Samuel Thibault, 2017/09/11
- [hurd] 43/43: storeio: Avoid calling mmap with zero size, Samuel Thibault, 2017/09/11
- [hurd] 03/43: trans: Conditionally build the random translator., Samuel Thibault, 2017/09/11
- [hurd] 17/43: Replace bcopy with memcpy or memmove as appropriate., Samuel Thibault, 2017/09/11
- [hurd] 42/43: Fix build with glibc-2.26, Samuel Thibault, 2017/09/11
- [hurd] 39/43: Remove unused parameter from the 'get_source' machinery., Samuel Thibault, 2017/09/11
- [hurd] 37/43: trans/symlink: Use default server stubs., Samuel Thibault, 2017/09/11
- [hurd] 40/43: pfinet: select UDP/TCP ports randomly, Samuel Thibault, 2017/09/11