staticint ovpn_mp_alloc(struct ovpn_priv *ovpn)
{ struct in_device *dev_v4; int i;
if (ovpn->mode != OVPN_MODE_MP) return0;
dev_v4 = __in_dev_get_rtnl(ovpn->dev); if (dev_v4) { /* disable redirects as Linux gets confused by ovpn *handlingsame-LANrouting. *Thishappensbecauseamultipeerinterfaceisusedas *relaypointbetweenhostsinthesamesubnet,while *inaclassicLANthiswouldnotbeneededbecausethe *twohostswouldbeabletotalkdirectly.
*/
IN_DEV_CONF_SET(dev_v4, SEND_REDIRECTS, false);
IPV4_DEVCONF_ALL(dev_net(ovpn->dev), SEND_REDIRECTS) = false;
}
/* the peer container is fairly large, therefore we allocate it only in *MPmode
*/
ovpn->peers = kzalloc(sizeof(*ovpn->peers), GFP_KERNEL); if (!ovpn->peers) return -ENOMEM;
for (i = 0; i < ARRAY_SIZE(ovpn->peers->by_id); i++) {
INIT_HLIST_HEAD(&ovpn->peers->by_id[i]);
INIT_HLIST_NULLS_HEAD(&ovpn->peers->by_vpn_addr4[i], i);
INIT_HLIST_NULLS_HEAD(&ovpn->peers->by_vpn_addr6[i], i);
INIT_HLIST_NULLS_HEAD(&ovpn->peers->by_transp_addr[i], i);
}
dev->type = ARPHRD_NONE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
dev->priv_flags |= IFF_NO_QUEUE; /* when routing packets to a LAN behind a client, we rely on the *routeentrythatoriginallybroughtthepacketintoovpn,so *don'treleaseit
*/
netif_keep_dst(dev);
/* Set carrier explicitly after registration, this way state is *clearlydefined. * *IncaseofMPinterfaceswekeepthecarrieralwayson. * *CarrierforP2Pinterfacesisinitiallyoffanditisthen *switchedonandoffwhentheremotepeerisaddedordeleted.
*/ if (ovpn->mode == OVPN_MODE_MP)
netif_carrier_on(dev); else
netif_carrier_off(dev);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.