Browse Source

MT#55283 C90 compile fixes

Change-Id: I5e6bba67507689ba9b1c14865bedb8625373508c
pull/2035/head
Richard Fuchs 1 week ago
parent
commit
5586ed0ed6
2 changed files with 43 additions and 24 deletions
  1. +21
    -9
      kernel-module/extmap_filter.inc.c
  2. +22
    -15
      kernel-module/xt_RTPENGINE.c

+ 21
- 9
kernel-module/extmap_filter.inc.c View File

@ -90,13 +90,17 @@ static void add_extmap_exts_long(unsigned char **w, unsigned int *count,
static void apply_extmap_filter_finish(unsigned char *r, unsigned char *w, unsigned int count,
struct rtpengine_output *o, struct sk_buff *skb, struct rtp_parsed *rtp)
{
size_t size;
size_t padded;
if (r == w)
return; // everything left as it was
if (count == 0) {
size_t pull;
// no extensions, remove header and trim packet
rtp->rtp_header->v_p_x_cc &= ~0x10;
size_t pull = rtp->payload - (unsigned char *) rtp->ext_hdr;
pull = rtp->payload - (unsigned char *) rtp->ext_hdr;
memmove(rtp->ext_hdr, rtp->payload, rtp->payload_len);
rtp->payload = (unsigned char *) rtp->ext_hdr;
rtp->ext_hdr = NULL;
@ -107,14 +111,15 @@ static void apply_extmap_filter_finish(unsigned char *r, unsigned char *w, unsig
// shift payload and adjust packet length
rtp->rtp_header->v_p_x_cc |= 0x90;
size_t size = w - rtp->extension;
size_t padded = (size + 3L) & ~3L;
size = w - rtp->extension;
padded = (size + 3L) & ~3L;
rtp->ext_hdr->length = htons(padded / 4);
if (rtp->extension_len >= padded) {
size_t pull;
// shift up payload and trim packet
memset(w, 0, padded - size);
size_t pull = rtp->extension_len - padded;
pull = rtp->extension_len - padded;
rtp->extension_len = padded;
memmove(rtp->payload - pull, rtp->payload, rtp->payload_len);
rtp->payload -= pull;
@ -137,6 +142,9 @@ static void apply_extmap_filter_short(struct sk_buff *skb, struct rtpengine_outp
// XXX partly shared code
while (r < end) {
uint8_t id;
uint8_t len;
uint8_t id_len = r[0];
if (id_len == '\0') {
// padding
@ -144,8 +152,8 @@ static void apply_extmap_filter_short(struct sk_buff *skb, struct rtpengine_outp
continue;
}
uint8_t id = id_len >> 4;
uint8_t len = (id_len & 0xf) + 1;
id = id_len >> 4;
len = (id_len & 0xf) + 1;
if (!apply_extmap_filter_ext(id, len, 1, &r, &w, end, &count, o))
break;
@ -164,6 +172,8 @@ static void apply_extmap_filter_long(struct sk_buff *skb, struct rtpengine_outpu
// XXX partly shared code
while (r < end) {
uint8_t len;
uint8_t id = r[0];
if (id == '\0') {
// padding
@ -171,7 +181,7 @@ static void apply_extmap_filter_long(struct sk_buff *skb, struct rtpengine_outpu
continue;
}
uint8_t len = r[1];
len = r[1];
if (!apply_extmap_filter_ext(id, len, 2, &r, &w, end, &count, o))
break;
@ -183,6 +193,7 @@ static void apply_extmap_filter_long(struct sk_buff *skb, struct rtpengine_outpu
}
static void add_extmap_hdr_long(struct sk_buff *skb, struct rtpengine_output *o, struct rtp_parsed *rtp) {
unsigned char *r;
unsigned char *w = rtp->payload; // header goes here
unsigned int count = 0;
@ -196,7 +207,7 @@ static void add_extmap_hdr_long(struct sk_buff *skb, struct rtpengine_output *o,
rtp->extension = (void *) hdr;
rtp->extension_len = 0;
unsigned char *r = w;
r = w;
add_extmap_exts_long(&w, &count, o, rtp, skb);
@ -204,6 +215,7 @@ static void add_extmap_hdr_long(struct sk_buff *skb, struct rtpengine_output *o,
}
static void add_extmap_hdr_short(struct sk_buff *skb, struct rtpengine_output *o, struct rtp_parsed *rtp) {
unsigned char *r;
unsigned char *w = rtp->payload; // header goes here
unsigned int count = 0;
@ -217,7 +229,7 @@ static void add_extmap_hdr_short(struct sk_buff *skb, struct rtpengine_output *o
rtp->extension = (void *) hdr;
rtp->extension_len = 0;
unsigned char *r = w;
r = w;
add_extmap_exts_short(&w, &count, o, rtp, skb);


+ 22
- 15
kernel-module/xt_RTPENGINE.c View File

@ -1161,7 +1161,7 @@ static void table_put(struct rtpengine_table *t) {
t->dest_addr_hash.addrs[k] = NULL;
}
for (unsigned int i = 0; i < t->nshms; i++)
for (i = 0; i < t->nshms; i++)
release_shm(&t->shms[i]);
clear_table_proc_files(t);
@ -1315,14 +1315,13 @@ static struct rtpengine_table *get_table(unsigned int id) {
static int proc_status_show(struct seq_file *m, void *v) {
unsigned long flags;
struct inode *inode = m->private;
uint32_t id = (uint32_t) (unsigned long) PDE_DATA(inode);
struct rtpengine_table *t = get_table(id);
if (!t)
return -ENOENT;
unsigned long flags;
read_lock_irqsave(&t->target_lock, flags);
seq_printf(m, "Refcount: %u\n", atomic_read(&t->refcnt) - 1);
seq_printf(m, "Control PID: %u\n", t->pid);
@ -2041,11 +2040,12 @@ static int search_shm(const void *p, const void *m) {
}
static void *shm_map_resolve(struct rtpengine_table *t, void *p, size_t size) {
spin_lock(&t->shm_lock);
struct re_shm *rmm;
void *ret = NULL;
struct re_shm *rmm = bsearch(p, &t->shms, t->nshms, sizeof(t->shms[0]), search_shm);
spin_lock(&t->shm_lock);
void *ret = NULL;
rmm = bsearch(p, &t->shms, t->nshms, sizeof(t->shms[0]), search_shm);
if (!rmm)
goto out;
@ -3758,6 +3758,11 @@ static int cmp_shm(const void *a, const void *b) {
}
static int cmd_pin_memory(struct rtpengine_table *t, struct rtpengine_pin_memory_info *mi) {
unsigned long addr;
int npages;
struct re_shm rmm = {0};
int ret;
// verify size
if (mi->size == 0)
return -EINVAL;
@ -3767,18 +3772,15 @@ static int cmd_pin_memory(struct rtpengine_table *t, struct rtpengine_pin_memory
return -EIO;
// address is page-aligned?
unsigned long addr = (unsigned long) mi->addr;
addr = (unsigned long) mi->addr;
if ((addr & (PAGE_SIZE - 1)) != 0)
return -ENXIO;
// full pages?
int npages = mi->size / PAGE_SIZE;
npages = mi->size / PAGE_SIZE;
if (npages <= 0)
return -EMSGSIZE;
// primary object
struct re_shm rmm = {0};
// fill in basics
rmm.uaddr = addr;
rmm.size = mi->size;
@ -3791,7 +3793,7 @@ static int cmd_pin_memory(struct rtpengine_table *t, struct rtpengine_pin_memory
}
// pin pages
int ret = pin_user_pages_fast(addr, npages, WRITE, rmm.pages);
ret = pin_user_pages_fast(addr, npages, WRITE, rmm.pages);
// successful?
if (ret != npages) {
@ -6292,11 +6294,13 @@ static void rtp_stats(struct rtpengine_target *g, struct rtp_parsed *rtp, s64 ar
static unsigned int rtp_mid_ext_media_find(const char *mid, size_t len,
const struct rtpengine_target_info *tg)
{
unsigned int i;
if (len == 0)
return -1u;
// XXX not an efficient search
for (unsigned int i = 0; i < RTPE_NUM_OUTPUT_MEDIA; i++) {
for (i = 0; i < RTPE_NUM_OUTPUT_MEDIA; i++) {
if (len != tg->mid_output[i].len)
continue;
if (!memcmp(tg->mid_output[i].mid, mid, len))
@ -6312,14 +6316,17 @@ static unsigned int rtp_mid_ext_media_short(const struct rtp_parsed *rtp,
unsigned char *r = rtp->extension;
// XXX duplicates filter code somewhat
while (left >= 1) {
uint8_t id;
uint8_t len;
if (*r == 0) {
r++;
left--;
continue;
}
uint8_t id = *r >> 4;
uint8_t len = (*r & 0xf) + 1;
id = *r >> 4;
len = (*r & 0xf) + 1;
r++;
left--;
if (len > left)


Loading…
Cancel
Save