-/*
- strip off the MAC adresses of an ethernet frame
-*/
-void strip_mac_addresses(vpn_packet_t *p)
-{
-cp
- memmove(p->data, p->data + 12, p->len -= 12);
-cp
-}
-
-/*
- reassemble MAC addresses
-*/
-void add_mac_addresses(vpn_packet_t *p)
-{
-cp
- memcpy(p->data + 12, p->data, p->len);
- p->len += 12;
- p->data[0] = p->data[6] = 0xfe;
- p->data[1] = p->data[7] = 0xfd;
- /* Really evil pointer stuff just below! */
- *((ip_t*)(&p->data[2])) = (ip_t)(htonl(myself->address));
- *((ip_t*)(&p->data[8])) = *((ip_t*)(&p->data[26]));
-cp
-}
-
-/*
- Execute the given script.
- This function doesn't really belong here.
-*/
-int execute_script(const char* name)
-{
- char *scriptname;
- pid_t pid;
- char **env;
- extern char **environment; /* From tincd.c; contains our env */
-
- asprintf(&scriptname, "%s/%s", confbase, name);
-
- if((pid = fork()) < 0)
- {
- syslog(LOG_ERR, _("System call `%s' failed: %m"),
- "fork");
- return -1;
- }
-
- if(pid)
- {
- free(scriptname);
- return 0;
- }
-
- /* Child here */
-
- env = xmalloc(sizeof(environment) + 1 * sizeof(char*));
- memcpy(&(env[1]), environment, sizeof(environment));
- asprintf(&(env[0]), "IFNAME=%s", interface_name);
- execle(scriptname, NULL, env);
- /* No return on success */
-
- if(errno != ENOENT) /* Ignore if the file does not exist */
- syslog(LOG_WARNING, _("Error executing `%s': %m"), scriptname);
-
- /* No need to free things */
- exit(0);
-}
-
-int xsend(conn_list_t *cl, vpn_packet_t *inpkt)