rename attribut interface pppoe to bind

This commit is contained in:
fendo 2013-01-08 23:24:31 +01:00
parent 11996ba414
commit d547c00f76
3 changed files with 16 additions and 16 deletions

View file

@ -187,7 +187,7 @@ config_descriptt config_values[] = {
CONFIG("bind_address_remotelns", bind_address_remotelns, IPv4), CONFIG("bind_address_remotelns", bind_address_remotelns, IPv4),
CONFIG("bind_portremotelns", bind_portremotelns, SHORT), CONFIG("bind_portremotelns", bind_portremotelns, SHORT),
#endif #endif
CONFIG("pppoe_if_name", pppoe_if_name, STRING), CONFIG("pppoe_if_to_bind", pppoe_if_to_bind, STRING),
CONFIG("pppoe_service_name", pppoe_service_name, STRING), CONFIG("pppoe_service_name", pppoe_service_name, STRING),
CONFIG("pppoe_ac_name", pppoe_ac_name, STRING), CONFIG("pppoe_ac_name", pppoe_ac_name, STRING),
{ NULL, 0, 0, 0 }, { NULL, 0, 0, 0 },
@ -5121,10 +5121,10 @@ int main(int argc, char *argv[])
inittun(); inittun();
LOG(1, 0, 0, "Set up on interface %s\n", config->tundevicename); LOG(1, 0, 0, "Set up on interface %s\n", config->tundevicename);
if (*config->pppoe_if_name) if (*config->pppoe_if_to_bind)
{ {
init_pppoe(); init_pppoe();
LOG(1, 0, 0, "Set up on pppoe interface %s\n", config->pppoe_if_name); LOG(1, 0, 0, "Set up on pppoe interface %s\n", config->pppoe_if_to_bind);
} }
initudp(); initudp();
initrad(); initrad();

View file

@ -775,7 +775,7 @@ typedef struct
uint16_t bind_portremotelns; uint16_t bind_portremotelns;
in_addr_t bind_address_remotelns; in_addr_t bind_address_remotelns;
#endif #endif
char pppoe_if_name[IFNAMSIZ]; // Name pppoe interface to bind char pppoe_if_to_bind[IFNAMSIZ]; // Name pppoe interface to bind
char pppoe_service_name[64]; // pppoe service name char pppoe_service_name[64]; // pppoe service name
char pppoe_ac_name[64]; char pppoe_ac_name[64];
uint8_t pppoe_hwaddr[ETH_ALEN]; // MAC addr of interface pppoe to bind uint8_t pppoe_hwaddr[ETH_ALEN]; // MAC addr of interface pppoe to bind

24
pppoe.c
View file

@ -97,9 +97,9 @@ static void init_pppoe_disc(void)
exit(1); exit(1);
} }
assert(strlen(ifr.ifr_name) < sizeof(config->pppoe_if_name) - 1); assert(strlen(ifr.ifr_name) < sizeof(config->pppoe_if_to_bind) - 1);
if (*config->pppoe_if_name) if (*config->pppoe_if_to_bind)
strncpy(ifr.ifr_name, config->pppoe_if_name, IFNAMSIZ); strncpy(ifr.ifr_name, config->pppoe_if_to_bind, IFNAMSIZ);
if (ioctl(pppoediscfd, SIOCGIFHWADDR, &ifr)) if (ioctl(pppoediscfd, SIOCGIFHWADDR, &ifr))
{ {
@ -109,7 +109,7 @@ static void init_pppoe_disc(void)
if ((ifr.ifr_hwaddr.sa_data[0] & 1) != 0) if ((ifr.ifr_hwaddr.sa_data[0] & 1) != 0)
{ {
LOG(0, 0, 0, "Error pppoe: interface %s has not unicast address\n", config->pppoe_if_name); LOG(0, 0, 0, "Error pppoe: interface %s has not unicast address\n", config->pppoe_if_to_bind);
exit(1); exit(1);
} }
@ -122,7 +122,7 @@ static void init_pppoe_disc(void)
} }
if (ifr.ifr_mtu < ETH_DATA_LEN) if (ifr.ifr_mtu < ETH_DATA_LEN)
LOG(0, 0, 0, "Error pppoe: interface %s has MTU of %i, should be %i\n", config->pppoe_if_name, ifr.ifr_mtu, ETH_DATA_LEN); LOG(0, 0, 0, "Error pppoe: interface %s has MTU of %i, should be %i\n", config->pppoe_if_to_bind, ifr.ifr_mtu, ETH_DATA_LEN);
if (ioctl(pppoediscfd, SIOCGIFINDEX, &ifr)) if (ioctl(pppoediscfd, SIOCGIFINDEX, &ifr))
{ {
@ -174,9 +174,9 @@ static void init_pppoe_sess(void)
exit(1); exit(1);
} }
assert(strlen(ifr.ifr_name) < sizeof(config->pppoe_if_name) - 1); assert(strlen(ifr.ifr_name) < sizeof(config->pppoe_if_to_bind) - 1);
if (*config->pppoe_if_name) if (*config->pppoe_if_to_bind)
strncpy(ifr.ifr_name, config->pppoe_if_name, IFNAMSIZ); strncpy(ifr.ifr_name, config->pppoe_if_to_bind, IFNAMSIZ);
if (ioctl(pppoesessfd, SIOCGIFHWADDR, &ifr)) if (ioctl(pppoesessfd, SIOCGIFHWADDR, &ifr))
{ {
@ -186,7 +186,7 @@ static void init_pppoe_sess(void)
if ((ifr.ifr_hwaddr.sa_data[0] & 1) != 0) if ((ifr.ifr_hwaddr.sa_data[0] & 1) != 0)
{ {
LOG(0, 0, 0, "Error pppoe: interface %s has not unicast address\n", config->pppoe_if_name); LOG(0, 0, 0, "Error pppoe: interface %s has not unicast address\n", config->pppoe_if_to_bind);
exit(1); exit(1);
} }
@ -199,7 +199,7 @@ static void init_pppoe_sess(void)
} }
if (ifr.ifr_mtu < ETH_DATA_LEN) if (ifr.ifr_mtu < ETH_DATA_LEN)
LOG(0, 0, 0, "Error pppoe: interface %s has MTU of %i, should be %i\n", config->pppoe_if_name, ifr.ifr_mtu, ETH_DATA_LEN); LOG(0, 0, 0, "Error pppoe: interface %s has MTU of %i, should be %i\n", config->pppoe_if_to_bind, ifr.ifr_mtu, ETH_DATA_LEN);
if (ioctl(pppoesessfd, SIOCGIFINDEX, &ifr)) if (ioctl(pppoesessfd, SIOCGIFINDEX, &ifr))
{ {
@ -1115,7 +1115,7 @@ void pppoe_send_garp()
struct ifreq ifr; struct ifreq ifr;
uint8_t mac[6]; uint8_t mac[6];
if (!*config->pppoe_if_name) if (!*config->pppoe_if_to_bind)
return; return;
s = socket(PF_INET, SOCK_DGRAM, 0); s = socket(PF_INET, SOCK_DGRAM, 0);
@ -1125,7 +1125,7 @@ void pppoe_send_garp()
return; return;
} }
memset(&ifr, 0, sizeof(ifr)); memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, config->pppoe_if_name, sizeof(ifr.ifr_name) - 1); strncpy(ifr.ifr_name, config->pppoe_if_to_bind, sizeof(ifr.ifr_name) - 1);
if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0)
{ {
LOG(0, 0, 0, "Error getting eth0 hardware address for GARP: %s\n", strerror(errno)); LOG(0, 0, 0, "Error getting eth0 hardware address for GARP: %s\n", strerror(errno));