Browse Source

compile fixes for older gcc versions

Fixes #1
pull/6/head
Richard Fuchs 12 years ago
parent
commit
838917b226
4 changed files with 19 additions and 17 deletions
  1. +4
    -4
      daemon/call.c
  2. +1
    -1
      daemon/dtls.c
  3. +13
    -11
      kernel-module/xt_MEDIAPROXY.c
  4. +1
    -1
      kernel-module/xt_MEDIAPROXY.h

+ 4
- 4
daemon/call.c View File

@ -339,15 +339,15 @@ void kernelize(struct packet_stream *stream) {
if (IN6_IS_ADDR_V4MAPPED(&sink->endpoint.ip46)) { if (IN6_IS_ADDR_V4MAPPED(&sink->endpoint.ip46)) {
mpt.src_addr.family = AF_INET; mpt.src_addr.family = AF_INET;
mpt.src_addr.ipv4 = cm->conf.ipv4;
mpt.src_addr.u.ipv4 = cm->conf.ipv4;
mpt.dst_addr.family = AF_INET; mpt.dst_addr.family = AF_INET;
mpt.dst_addr.ipv4 = sink->endpoint.ip46.s6_addr32[3];
mpt.dst_addr.u.ipv4 = sink->endpoint.ip46.s6_addr32[3];
} }
else { else {
mpt.src_addr.family = AF_INET6; mpt.src_addr.family = AF_INET6;
memcpy(mpt.src_addr.ipv6, &cm->conf.ipv6, sizeof(mpt.src_addr.ipv6));
memcpy(mpt.src_addr.u.ipv6, &cm->conf.ipv6, sizeof(mpt.src_addr.u.ipv6));
mpt.dst_addr.family = AF_INET6; mpt.dst_addr.family = AF_INET6;
memcpy(mpt.dst_addr.ipv6, &sink->endpoint.ip46, sizeof(mpt.src_addr.ipv6));
memcpy(mpt.dst_addr.u.ipv6, &sink->endpoint.ip46, sizeof(mpt.src_addr.u.ipv6));
} }
stream->handler->in->kernel(&mpt.decrypt, stream); stream->handler->in->kernel(&mpt.decrypt, stream);


+ 1
- 1
daemon/dtls.c View File

@ -624,7 +624,7 @@ int dtls(struct packet_stream *ps, const str *s, struct sockaddr_in6 *fsin) {
if (ret > sizeof(buf)) { if (ret > sizeof(buf)) {
ilog(LOG_ERROR, "BIO buffer overflow"); ilog(LOG_ERROR, "BIO buffer overflow");
BIO_reset(d->w_bio);
(void) BIO_reset(d->w_bio);
return 0; return 0;
} }


+ 13
- 11
kernel-module/xt_MEDIAPROXY.c View File

@ -923,12 +923,14 @@ static void proc_list_addr_print(struct seq_file *f, const char *s, const struct
seq_printf(f, " %6s ", s); seq_printf(f, " %6s ", s);
switch (a->family) { switch (a->family) {
case AF_INET: case AF_INET:
seq_printf(f, "inet4 %u.%u.%u.%u:%u\n", a->u8[0], a->u8[1], a->u8[2], a->u8[3], a->port);
seq_printf(f, "inet4 %u.%u.%u.%u:%u\n", a->u.u8[0], a->u.u8[1], a->u.u8[2],
a->u.u8[3], a->port);
break; break;
case AF_INET6: case AF_INET6:
seq_printf(f, "inet6 [%x:%x:%x:%x:%x:%x:%x:%x]:%u\n", htons(a->u16[0]), htons(a->u16[1]),
htons(a->u16[2]), htons(a->u16[3]), htons(a->u16[4]), htons(a->u16[5]),
htons(a->u16[6]), htons(a->u16[7]), a->port);
seq_printf(f, "inet6 [%x:%x:%x:%x:%x:%x:%x:%x]:%u\n",
htons(a->u.u16[0]), htons(a->u.u16[1]),
htons(a->u.u16[2]), htons(a->u.u16[3]), htons(a->u.u16[4]), htons(a->u.u16[5]),
htons(a->u.u16[6]), htons(a->u.u16[7]), a->port);
break; break;
default: default:
seq_printf(f, "<unknown>\n"); seq_printf(f, "<unknown>\n");
@ -1034,12 +1036,12 @@ out:
static int is_valid_address(struct mp_address *mpa) { static int is_valid_address(struct mp_address *mpa) {
switch (mpa->family) { switch (mpa->family) {
case AF_INET: case AF_INET:
if (!mpa->ipv4)
if (!mpa->u.ipv4)
return 0; return 0;
break; break;
case AF_INET6: case AF_INET6:
if (!mpa->u32[0] && !mpa->u32[1] && !mpa->u32[2] && !mpa->u32[3])
if (!mpa->u.u32[0] && !mpa->u.u32[1] && !mpa->u.u32[2] && !mpa->u.u32[3])
return 0; return 0;
break; break;
@ -1693,13 +1695,13 @@ static int send_proxy_packet4(struct sk_buff *skb, struct mp_address *src, struc
.tot_len = htons(sizeof(*ih) + datalen), .tot_len = htons(sizeof(*ih) + datalen),
.ttl = 64, .ttl = 64,
.protocol = IPPROTO_UDP, .protocol = IPPROTO_UDP,
.saddr = src->ipv4,
.daddr = dst->ipv4,
.saddr = src->u.ipv4,
.daddr = dst->u.ipv4,
}; };
skb->csum_start = skb_transport_header(skb) - skb->head; skb->csum_start = skb_transport_header(skb) - skb->head;
skb->csum_offset = offsetof(struct udphdr, check); skb->csum_offset = offsetof(struct udphdr, check);
uh->check = csum_tcpudp_magic(src->ipv4, dst->ipv4, datalen, IPPROTO_UDP, csum_partial(uh, datalen, 0));
uh->check = csum_tcpudp_magic(src->u.ipv4, dst->u.ipv4, datalen, IPPROTO_UDP, csum_partial(uh, datalen, 0));
if (uh->check == 0) if (uh->check == 0)
uh->check = CSUM_MANGLED_0; uh->check = CSUM_MANGLED_0;
@ -1750,8 +1752,8 @@ static int send_proxy_packet6(struct sk_buff *skb, struct mp_address *src, struc
.nexthdr = IPPROTO_UDP, .nexthdr = IPPROTO_UDP,
.hop_limit = 64, .hop_limit = 64,
}; };
memcpy(&ih->saddr, src->ipv6, sizeof(ih->saddr));
memcpy(&ih->daddr, dst->ipv6, sizeof(ih->daddr));
memcpy(&ih->saddr, src->u.ipv6, sizeof(ih->saddr));
memcpy(&ih->daddr, dst->u.ipv6, sizeof(ih->daddr));
skb->csum_start = skb_transport_header(skb) - skb->head; skb->csum_start = skb_transport_header(skb) - skb->head;
skb->csum_offset = offsetof(struct udphdr, check); skb->csum_offset = offsetof(struct udphdr, check);


+ 1
- 1
kernel-module/xt_MEDIAPROXY.h View File

@ -20,7 +20,7 @@ struct mp_address {
unsigned char u8[16]; unsigned char u8[16];
u_int16_t u16[8]; u_int16_t u16[8];
u_int32_t u32[4]; u_int32_t u32[4];
};
} u;
u_int16_t port; u_int16_t port;
}; };


Loading…
Cancel
Save