Hi,

or export the right VEID from /proc/vz/veth:

/proc/vz/veth :
MAC_VE0 veth_dev_on_VE0 mac_dev_VE dev_VE VEID deny

Attached a workaround patch, to solve this issue.

Regards,
Thorsten

Kristian F. Høgh schrieb:
On Thursday den 7. June 2007 11:32:39 Kirill Korotaev wrote:
Kristian F. Høgh wrote:
On Wednesday den 6. June 2007 17:14:57 Nils Domrose wrote:
Hi,

we are facing a problem with veth device in combination with long veids.
if we configure a veth device as described in the wiki, we are unable
to start that VE with the following error:
In veth.c a buffer with length 11 is allocated.
The buffer is used as follows:
snprintf(buf, sizeof(buf), "VEID=%d", veid);

As 6 characters are used for static content (VEID= + '\0'), only 5
characters are left. Your VEID (249104) is 6 characters long.

Apply the following patch, and you should be running.
(An alternative is to limit your VEID in the range 100 to <= 99999)


--- a/src/lib/veth.c
+++ b/src/lib/veth.c
@@ -90,7 +90,7 @@ static int veth_dev_remove(vps_handler *h, envid_t
veid, veth_dev *dev) static int run_vznetcfg(envid_t veid, veth_dev *dev)
 {
        int ret;
-       char buf[11];
+       char buf[12];
        char *argv[] = {VZNETCFG, "init", "veth", NULL, NULL};
        char *env[2];

(Last line is empty)
In kernel if name is limited to 16 bytes, i.e. to 15 chars (plus zero).
4 chars for "veth",
I call my veth interfaces ve${VEID}.0, ve${VEID}.1 ...
So VEID 1234 will have an interface called ve1234.0 in VE0 (eth0 in VE 1234)

so 11 chars for number. VEID is int, so limited to 2^32, which is no more then 10 chars length. So everything should
be fine except this silly bug in vzctl.
What if I call my veth interfase abcdefghij${VEID} ?

(Or do I misunderstand?)

Why have you chosen 12 instead of 11?
AFAICS it should be sizeof("VEID=") + 10 + 1 (for \0) = 16
I chose 12 because 11 was to small :-)
It was ment as a workaround. 16 must be right.

Thanks,
Kirill

Regards,
Kristian.

_______________________________________________
Users mailing list
[email protected]
https://openvz.org/mailman/listinfo/users

--- /usr/sbin/vznetcfg	2007-06-07 16:53:46.728284477 +0200
+++ /usr/sbin/vznetcfg.new	2007-06-07 16:54:20.879074560 +0200
@@ -32,6 +32,7 @@
 }
 # Call the external script if defined
 if [ -n "${EXTERNAL_SCRIPT}" -a -x "${EXTERNAL_SCRIPT}" ]; then
+	VEID=`awk "/$3/ {print \\$5}" /proc/vz/veth`
 	export VEID
 	exec ${EXTERNAL_SCRIPT} $@
 fi
_______________________________________________
Users mailing list
[email protected]
https://openvz.org/mailman/listinfo/users

Reply via email to