OpenVZ Forum


Home » Mailing lists » Users » trouble with veth device in combination with long veid
trouble with veth device in combination with long veid [message #13845] Wed, 06 June 2007 15:14 Go to next message
Nils Domrose is currently offline  Nils Domrose
Messages: 6
Registered: March 2007
Junior Member
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:

xnetadm:/etc/vz/conf# vzctl start 249104
Starting VE ...
VE is mounted
Setting CPU units: 23945
Configure meminfo: 655360
Set hostname: vz-netnagios
File resolv.conf was modified
Configure veth devices: veth104.0
debug veid 24910 vznetcfg
debug veid 24910 vznetaddroute
/usr/sbin/vznetaddroute: line 6: /etc/vz/conf/24910.conf: No such
file or directory
According to /etc/vz/conf/24910.conf VE has no veth IPs configured.
/usr/sbin/vznetcfg exited with error
VE start failed
Stopping VE ...
VE was stopped
VE is unmounted


Note that we are echoing the $VEID in vznetcfg and vznetaddroute for
debugging reasons and we noticed that the last character is cut off.
This is also the reason why the scripts fail. We have not yet fihured
out if vznetcfg is called by vzctl directly.

This does not happen if we use a shorter veid like 104.


Maybe someone has an idea what is causing the issue.

Here is the vzctl log output.


2007-06-06T16:23:28+0200 vzctl : VE 249104 : Starting VE ...
2007-06-06T16:23:28+0200 vzctl : VE 249104 : VE is mounted
2007-06-06T16:23:28+0200 vzctl : VE 249104 : Setting CPU units: 23945
2007-06-06T16:23:28+0200 vzctl : VE 249104 : Configure meminfo: 655360
2007-06-06T16:23:28+0200 vzctl : VE 249104 : Set hostname: vz-netnagios
2007-06-06T16:23:28+0200 vzctl : VE 249104 : File resolv.conf was
modified
2007-06-06T16:23:28+0200 vzctl : VE 249104 : Configure veth devices:
veth104.0
2007-06-06T16:23:28+0200 vzctl : VE 249104 : /usr/sbin/vznetcfg
exited with error
2007-06-06T16:23:28+0200 vzctl : VE 249104 : VE start failed
2007-06-06T16:23:28+0200 vzctl : VE 249104 : Stopping VE ...
2007-06-06T16:23:28+0200 vzctl : VE 249104 : VE was stopped
2007-06-06T16:23:29+0200 vzctl : VE 249104 : VE is unmounted

kernel version:

Linux xnetadm 2.6.18-028stab033.1-ovz-smp #1 SMP Thu May 31 10:29:27
CEST 2007 x86_64 GNU/Linux

vzctl version:

xnetadm:/usr/lib/vzctl/scripts# vzctl --version
vzctl version 3.0.16-5dso1


Nils
Re: trouble with veth device in combination with long veid [message #13889 is a reply to message #13845] Thu, 07 June 2007 07:45 Go to previous messageGo to next message
kfh is currently offline  kfh
Messages: 28
Registered: October 2006
Junior Member
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)

Regards,
Kristian Høgh
Re: trouble with veth device in combination with long veid [message #13898 is a reply to message #13889] Thu, 07 June 2007 09:32 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

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", 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.

Why have you chosen 12 instead of 11?
AFAICS it should be sizeof("VEID=") + 10 + 1 (for \0) = 16

Thanks,
Kirill
Re: trouble with veth device in combination with long veid [message #13905 is a reply to message #13898] Thu, 07 June 2007 12:08 Go to previous messageGo to next message
kfh is currently offline  kfh
Messages: 28
Registered: October 2006
Junior Member
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.
Re: trouble with veth device in combination with long veid [message #13910 is a reply to message #13905] Thu, 07 June 2007 15:02 Go to previous message
Thorsten Schifferdeck is currently offline  Thorsten Schifferdeck
Messages: 38
Registered: February 2006
Member
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.
>
Previous Topic: OpenVZ to Virtozzo
Next Topic: /dev/tty0
Goto Forum:
  


Current Time: Fri Apr 26 02:27:17 GMT 2024

Total time taken to generate the page: 0.01640 seconds