diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2022-03-10 19:00:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-10 19:00:45 +0100 |
| commit | f1bfeadcc19d995f99bc692db2ea2cb376ef853b (patch) | |
| tree | 640c536521e5a8a98f60bc50cc7ec0acd0f07679 /pimd/pim_msg.h | |
| parent | 82aca4ae4f995e5ff38202641ac47e127cd3c738 (diff) | |
| parent | e782863dfcfe489c363d1989f95968a8fd5020c6 (diff) | |
Merge pull request #10707 from mobash-rasool/pimv6-register-recv
Diffstat (limited to 'pimd/pim_msg.h')
| -rw-r--r-- | pimd/pim_msg.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pimd/pim_msg.h b/pimd/pim_msg.h index 522e94504a..456c356d9f 100644 --- a/pimd/pim_msg.h +++ b/pimd/pim_msg.h @@ -21,6 +21,9 @@ #define PIM_MSG_H #include <netinet/in.h> +#if PIM_IPV == 6 +#include <netinet/ip6.h> +#endif #include "pim_jp_agg.h" @@ -181,6 +184,30 @@ struct pim_jp { struct pim_jp_groups groups[1]; } __attribute__((packed)); +#if PIM_IPV == 4 +static inline pim_sgaddr pim_sgaddr_from_iphdr(const void *iphdr) +{ + const struct ip *ipv4_hdr = iphdr; + pim_sgaddr sg; + + sg.src = ipv4_hdr->ip_src; + sg.grp = ipv4_hdr->ip_dst; + + return sg; +} +#else +static inline pim_sgaddr pim_sgaddr_from_iphdr(const void *iphdr) +{ + const struct ip6_hdr *ipv6_hdr = iphdr; + pim_sgaddr sg; + + sg.src = ipv6_hdr->ip6_src; + sg.grp = ipv6_hdr->ip6_dst; + + return sg; +} +#endif + void pim_msg_build_header(uint8_t *pim_msg, size_t pim_msg_size, uint8_t pim_msg_type, bool no_fwd); uint8_t *pim_msg_addr_encode_ipv4_ucast(uint8_t *buf, struct in_addr addr); |
