Accepting request 185444 from Virtualization
- Fix send/recv buffer allocation (bnc#828714) OBS-URL: https://build.opensuse.org/request/show/185444 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/hyper-v?expand=0&rev=12
This commit is contained in:
commit
ac81a2d210
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 1 14:21:57 CEST 2013 - ohering@suse.de
|
||||
|
||||
- Fix send/recv buffer allocation (bnc#828714)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 24 10:18:34 CEST 2013 - ohering@suse.de
|
||||
|
||||
|
@ -79,8 +79,6 @@ enum {
|
||||
DNS
|
||||
};
|
||||
|
||||
static char kvp_send_buffer[4096];
|
||||
static char kvp_recv_buffer[4096 * 2];
|
||||
static struct sockaddr_nl addr;
|
||||
static int in_hand_shake = 1;
|
||||
|
||||
@ -1437,10 +1435,21 @@ int main(void)
|
||||
int pool;
|
||||
char *if_name;
|
||||
struct hv_kvp_ipaddr_value *kvp_ip_val;
|
||||
char *kvp_send_buffer;
|
||||
char *kvp_recv_buffer;
|
||||
size_t kvp_recv_buffer_len;
|
||||
|
||||
daemon(1, 0);
|
||||
openlog("KVP", 0, LOG_USER);
|
||||
syslog(LOG_INFO, "KVP starting; pid is:%d", getpid());
|
||||
|
||||
kvp_recv_buffer_len = NLMSG_HDRLEN + sizeof(struct cn_msg) + sizeof(struct hv_kvp_msg);
|
||||
kvp_send_buffer = calloc(1, kvp_recv_buffer_len);
|
||||
kvp_recv_buffer = calloc(1, kvp_recv_buffer_len);
|
||||
if (!(kvp_send_buffer && kvp_recv_buffer)) {
|
||||
syslog(LOG_ERR, "Failed to allocate netlink buffers");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
/*
|
||||
* Retrieve OS release information.
|
||||
*/
|
||||
@ -1514,7 +1523,7 @@ int main(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0,
|
||||
len = recvfrom(fd, kvp_recv_buffer, kvp_recv_buffer_len, 0,
|
||||
addr_p, &addr_l);
|
||||
|
||||
if (len < 0) {
|
||||
|
@ -38,8 +38,6 @@
|
||||
#include <linux/netlink.h>
|
||||
#include <syslog.h>
|
||||
|
||||
static char vss_recv_buffer[4096];
|
||||
static char vss_send_buffer[4096];
|
||||
static struct sockaddr_nl addr;
|
||||
|
||||
#ifndef SOL_NETLINK
|
||||
@ -52,7 +50,7 @@ static int vss_do_freeze(char *dir, unsigned int cmd, char *fs_op)
|
||||
int ret, fd = open(dir, O_RDONLY);
|
||||
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
return 1;
|
||||
ret = ioctl(fd, cmd, 0);
|
||||
syslog(LOG_INFO, "VSS: %s of %s: %s\n", fs_op, dir, strerror(errno));
|
||||
close(fd);
|
||||
@ -85,9 +83,11 @@ static int vss_operate(int operation)
|
||||
if (mounts == NULL)
|
||||
return -1;
|
||||
|
||||
while((ent = getmntent(mounts))) {
|
||||
while ((ent = getmntent(mounts))) {
|
||||
if (strncmp(ent->mnt_fsname, match, strlen(match)))
|
||||
continue;
|
||||
if (strcmp(ent->mnt_type, "iso9660") == 0)
|
||||
continue;
|
||||
if (strcmp(ent->mnt_dir, "/") == 0) {
|
||||
root_seen = 1;
|
||||
continue;
|
||||
@ -145,6 +145,9 @@ int main(void)
|
||||
struct cn_msg *incoming_cn_msg;
|
||||
int op;
|
||||
struct hv_vss_msg *vss_msg;
|
||||
char *vss_send_buffer;
|
||||
char *vss_recv_buffer;
|
||||
size_t vss_recv_buffer_len;
|
||||
|
||||
if (daemon(1, 0))
|
||||
return 1;
|
||||
@ -152,6 +155,14 @@ int main(void)
|
||||
openlog("Hyper-V VSS", 0, LOG_USER);
|
||||
syslog(LOG_INFO, "VSS starting; pid is:%d", getpid());
|
||||
|
||||
vss_recv_buffer_len = NLMSG_HDRLEN + sizeof(struct cn_msg) + sizeof(struct hv_vss_msg);
|
||||
vss_send_buffer = calloc(1, vss_recv_buffer_len);
|
||||
vss_recv_buffer = calloc(1, vss_recv_buffer_len);
|
||||
if (!(vss_send_buffer && vss_recv_buffer)) {
|
||||
syslog(LOG_ERR, "Failed to allocate netlink buffers");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
|
||||
if (fd < 0) {
|
||||
syslog(LOG_ERR, "netlink socket creation failed; error:%d", fd);
|
||||
@ -199,7 +210,7 @@ int main(void)
|
||||
pfd.revents = 0;
|
||||
poll(&pfd, 1, -1);
|
||||
|
||||
len = recvfrom(fd, vss_recv_buffer, sizeof(vss_recv_buffer), 0,
|
||||
len = recvfrom(fd, vss_recv_buffer, vss_recv_buffer_len, 0,
|
||||
addr_p, &addr_l);
|
||||
|
||||
if (len < 0) {
|
||||
@ -210,8 +221,9 @@ int main(void)
|
||||
}
|
||||
|
||||
if (addr.nl_pid) {
|
||||
syslog(LOG_WARNING, "Received packet from untrusted pid:%u",
|
||||
addr.nl_pid);
|
||||
syslog(LOG_WARNING,
|
||||
"Received packet from untrusted pid:%u",
|
||||
addr.nl_pid);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user