[pve-devel] pve-firewall : masquerade results (+veth vlan tag bug)
Alexandre DERUMIER
aderumier at odiso.com
Mon May 5 14:52:32 CEST 2014
maybe better, reuse run_vznetcfg, and pass ADD|DEL , then we just need to add a new section in vznetcfg init script.
list_for_each(tmp, dev_h, list) {
if (op == ADD) {
if ((ret = h->veth_ctl(h, veid, ADD, tmp)))
break;
if ((ret = run_vznetcfg(veid, tmp, ADD)))
break;
} else if ((ret = h->veth_ctl(h, veid, DEL, tmp))) {
run_vznetcfg(veid, tmp, DEL);
break;
}
}
static int run_vznetcfg(envid_t veid, veth_dev *dev, int op)
{
int ret;
char buf[16];
char *argv[] = {VZNETCFG, op == ADD ? "init" : "del", "veth", NULL, NULL};
char *env[2];
if (stat_file(VZNETCFG) != 1)
return 0;
argv[3] = dev->dev_name;
snprintf(buf, sizeof(buf), "VEID=%d", veid);
env[0] = buf;
env[1] = NULL;
if ((ret = run_script(VZNETCFG, argv, env, 0))) {
logger(-1, 0, VZNETCFG " exited with error");
ret = VZ_VETH_ERROR;
}
return ret;
}
----- Mail original -----
De: "Alexandre DERUMIER" <aderumier at odiso.com>
À: "Dietmar Maurer" <dietmar at proxmox.com>
Cc: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Lundi 5 Mai 2014 14:32:20
Objet: Re: [pve-devel] pve-firewall : masquerade results (+veth vlan tag bug)
>>There is also /usr/sbin/vznetcfg, but seems this is only called for init.
indeed,
in veth.c
static int veth_ctl(vps_handler *h, envid_t veid, int op, veth_param *list,
int rollback)
list_for_each(tmp, dev_h, list) {
if (op == ADD) {
if ((ret = h->veth_ctl(h, veid, ADD, tmp)))
break;
if ((ret = run_vznetcfg(veid, tmp)))
break;
} else if ((ret = h->veth_ctl(h, veid, DEL, tmp))) {
break;
}
}
maybe can we add something like
else if ((ret = h->veth_ctl(h, veid, DEL, tmp))) {
if ((ret = run_vznetcfgdown(veid, tmp)))
break;
}
De: "Dietmar Maurer" <dietmar at proxmox.com>
À: "Alexandre DERUMIER" <aderumier at odiso.com>
Cc: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Vendredi 2 Mai 2014 16:25:23
Objet: RE: [pve-devel] pve-firewall : masquerade results (+veth vlan tag bug)
There is also /usr/sbin/vznetcfg, but seems this is only called for init.
> from vzctl/include/types.h:
>
> #define VPS_NET_ADD SCRIPTDIR "/vps-net_add"
> #define VPS_NET_DEL SCRIPTDIR "/vps-net_del"
> #define VPS_NETNS_DEV_ADD SCRIPTDIR "/vps-netns_dev_add"
> #define VPS_NETNS_DEV_DEL SCRIPTDIR "/vps-netns_dev_del"
>
> so we need to check which script in /usr/lib/vzctl/scripts/ is best.
>
> > > for openvz veth, I don't known if it's possible to use a script at shutdown ?
> >
> > Maybe we can use an action script for that:
> >
> > http://openvz.org/Man/vzctl.8#ACTION_SCRIPTS
> >
> > Maybe vps.umount?
> > _______________________________________________
> > pve-devel mailing list
> > pve-devel at pve.proxmox.com
> > http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
_______________________________________________
pve-devel mailing list
pve-devel at pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
More information about the pve-devel
mailing list