trival: fix whitespace

This commit is contained in:
Thomas Haller
2015-12-09 16:12:37 +01:00
parent a4de9187ff
commit 6a7730241b

View File

@@ -4716,59 +4716,59 @@ tun_add (NMPlatform *platform, const char *name, gboolean tap,
gint64 owner, gint64 group, gboolean pi, gboolean vnet_hdr, gint64 owner, gint64 group, gboolean pi, gboolean vnet_hdr,
gboolean multi_queue, const NMPlatformLink **out_link) gboolean multi_queue, const NMPlatformLink **out_link)
{ {
const NMPObject *obj; const NMPObject *obj;
struct ifreq ifr = { }; struct ifreq ifr = { };
int fd; int fd;
_LOGD ("link: add %s '%s' owner %" G_GINT64_FORMAT " group %" G_GINT64_FORMAT, _LOGD ("link: add %s '%s' owner %" G_GINT64_FORMAT " group %" G_GINT64_FORMAT,
tap ? "tap" : "tun", name, owner, group); tap ? "tap" : "tun", name, owner, group);
fd = open ("/dev/net/tun", O_RDWR); fd = open ("/dev/net/tun", O_RDWR);
if (fd < 0) if (fd < 0)
return FALSE; return FALSE;
strncpy (ifr.ifr_name, name, IFNAMSIZ); strncpy (ifr.ifr_name, name, IFNAMSIZ);
ifr.ifr_flags = tap ? IFF_TAP : IFF_TUN; ifr.ifr_flags = tap ? IFF_TAP : IFF_TUN;
if (!pi) if (!pi)
ifr.ifr_flags |= IFF_NO_PI; ifr.ifr_flags |= IFF_NO_PI;
if (vnet_hdr) if (vnet_hdr)
ifr.ifr_flags |= IFF_VNET_HDR; ifr.ifr_flags |= IFF_VNET_HDR;
if (multi_queue) if (multi_queue)
ifr.ifr_flags |= NM_IFF_MULTI_QUEUE; ifr.ifr_flags |= NM_IFF_MULTI_QUEUE;
if (ioctl (fd, TUNSETIFF, &ifr)) { if (ioctl (fd, TUNSETIFF, &ifr)) {
close (fd); close (fd);
return FALSE; return FALSE;
} }
if (owner >= 0 && owner < G_MAXINT32) { if (owner >= 0 && owner < G_MAXINT32) {
if (ioctl (fd, TUNSETOWNER, (uid_t) owner)) { if (ioctl (fd, TUNSETOWNER, (uid_t) owner)) {
close (fd); close (fd);
return FALSE; return FALSE;
} }
} }
if (group >= 0 && group < G_MAXINT32) { if (group >= 0 && group < G_MAXINT32) {
if (ioctl (fd, TUNSETGROUP, (gid_t) group)) { if (ioctl (fd, TUNSETGROUP, (gid_t) group)) {
close (fd); close (fd);
return FALSE; return FALSE;
} }
} }
if (ioctl (fd, TUNSETPERSIST, 1)) { if (ioctl (fd, TUNSETPERSIST, 1)) {
close (fd); close (fd);
return FALSE; return FALSE;
} }
do_request_link (platform, 0, name, TRUE); do_request_link (platform, 0, name, TRUE);
obj = nmp_cache_lookup_link_full (NM_LINUX_PLATFORM_GET_PRIVATE (platform)->cache, obj = nmp_cache_lookup_link_full (NM_LINUX_PLATFORM_GET_PRIVATE (platform)->cache,
0, name, FALSE, 0, name, FALSE,
tap ? NM_LINK_TYPE_TAP : NM_LINK_TYPE_TUN, tap ? NM_LINK_TYPE_TAP : NM_LINK_TYPE_TUN,
NULL, NULL); NULL, NULL);
if (out_link) if (out_link)
*out_link = obj ? &obj->link : NULL; *out_link = obj ? &obj->link : NULL;
return !!obj; return !!obj;
} }
static gboolean static gboolean