Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifications to work with kernel 4.4.0. #442

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
347 changes: 186 additions & 161 deletions doc/testie.1

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions elements/icmp/icmppingrewriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@ ICMPPingRewriter::add_handlers()
add_rewriter_handlers(true);
}

void
ICMPPingRewriter::destroy_flow(IPRewriterFlow *flow)
{
unmap_flow(flow, _map);
static_cast<ICMPPingFlow *>(flow)->~ICMPPingFlow();
_allocator.deallocate(flow);
}

CLICK_ENDDECLS
ELEMENT_REQUIRES(IPRewriterBase)
EXPORT_ELEMENT(ICMPPingRewriter)
8 changes: 1 addition & 7 deletions elements/icmp/icmppingrewriter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,7 @@ class ICMPPingRewriter : public IPRewriterBase { public:
};


inline void
ICMPPingRewriter::destroy_flow(IPRewriterFlow *flow)
{
unmap_flow(flow, _map);
static_cast<ICMPPingFlow *>(flow)->~ICMPPingFlow();
_allocator.deallocate(flow);
}


CLICK_ENDDECLS
#endif
8 changes: 8 additions & 0 deletions elements/ip/ipaddrpairrewriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ IPAddrPairRewriter::add_handlers()
add_rewriter_handlers(true);
}

void
IPAddrPairRewriter::destroy_flow(IPRewriterFlow *flow)
{
unmap_flow(flow, _map);
static_cast<IPAddrPairFlow *>(flow)->~IPAddrPairFlow();
_allocator.deallocate(flow);
}

ELEMENT_REQUIRES(IPRewriterBase)
EXPORT_ELEMENT(IPAddrPairRewriter)
CLICK_ENDDECLS
8 changes: 1 addition & 7 deletions elements/ip/ipaddrpairrewriter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,7 @@ class IPAddrPairRewriter : public IPRewriterBase { public:
};


inline void
IPAddrPairRewriter::destroy_flow(IPRewriterFlow *flow)
{
unmap_flow(flow, _map);
static_cast<IPAddrPairFlow *>(flow)->~IPAddrPairFlow();
_allocator.deallocate(flow);
}


CLICK_ENDDECLS
#endif
8 changes: 8 additions & 0 deletions elements/ip/ipaddrrewriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ IPAddrRewriter::add_handlers()
add_rewriter_handlers(true);
}

void
IPAddrRewriter::destroy_flow(IPRewriterFlow *flow)
{
unmap_flow(flow, _map);
static_cast<IPAddrFlow *>(flow)->~IPAddrFlow();
_allocator.deallocate(flow);
}

ELEMENT_REQUIRES(IPRewriterBase)
EXPORT_ELEMENT(IPAddrRewriter)
CLICK_ENDDECLS
10 changes: 2 additions & 8 deletions elements/ip/ipaddrrewriter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class IPAddrRewriter : public IPRewriterBase { public:
int configure(Vector<String> &conf, ErrorHandler *errh) CLICK_COLD;
//void take_state(Element *, ErrorHandler *);

inline IPRewriterEntry *get_entry(int ip_p, const IPFlowID &flowid, int input);
IPRewriterEntry *get_entry(int ip_p, const IPFlowID &flowid, int input);
IPRewriterEntry *add_flow(int ip_p, const IPFlowID &flowid,
const IPFlowID &rewritten_flowid, int input);
void destroy_flow(IPRewriterFlow *flow);
Expand All @@ -158,13 +158,7 @@ class IPAddrRewriter : public IPRewriterBase { public:
};


inline void
IPAddrRewriter::destroy_flow(IPRewriterFlow *flow)
{
unmap_flow(flow, _map);
static_cast<IPAddrFlow *>(flow)->~IPAddrFlow();
_allocator.deallocate(flow);
}


CLICK_ENDDECLS
#endif
11 changes: 10 additions & 1 deletion elements/linuxmodule/fromhost.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,20 @@ static void fromhost_inet_setup(struct net_device *dev)
}
#endif

/* include/uapi/linux/netdevice.h */
/* interface name assignment types (sysfs name_assign_type attribute) */
/* #define NET_NAME_UNKNOWN 0 unknown origin (not exposed to userspace) */
/* #define NET_NAME_ENUM 1 enumerated by kernel */
/* #define NET_NAME_PREDICTABLE 2 predictably named by the kernel */
/* #define NET_NAME_USER 3 provided by user-space */
/* #define NET_NAME_RENAMED 4 renamed by user-space */
net_device *
FromHost::new_device(const char *name)
{
void (*setup)(struct net_device *) = (_macaddr ? ether_setup : fromhost_inet_setup);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
net_device *dev = alloc_netdev(0, name, NET_NAME_UNKNOWN, setup);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
net_device *dev = alloc_netdev(0, name, setup);
#else
int errcode;
Expand Down
14 changes: 13 additions & 1 deletion elements/tcpudp/iprewriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ IPRewriter::configure(Vector<String> &conf, ErrorHandler *errh)
return TCPRewriter::configure(conf, errh);
}

inline IPRewriterEntry *
IPRewriterEntry *
IPRewriter::get_entry(int ip_p, const IPFlowID &flowid, int input)
{
if (ip_p == IP_PROTO_TCP)
Expand Down Expand Up @@ -189,6 +189,18 @@ IPRewriter::add_handlers()
add_rewriter_handlers(true);
}

void
IPRewriter::destroy_flow(IPRewriterFlow *flow)
{
if (flow->ip_p() == IP_PROTO_TCP)
TCPRewriter::destroy_flow(flow);
else {
unmap_flow(flow, _udp_map, &reply_udp_map(flow->owner()));
flow->~IPRewriterFlow();
_udp_allocator.deallocate(flow);
}
}

CLICK_ENDDECLS
ELEMENT_REQUIRES(TCPRewriter UDPRewriter)
EXPORT_ELEMENT(IPRewriter)
12 changes: 1 addition & 11 deletions elements/tcpudp/iprewriter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -274,17 +274,7 @@ class IPRewriter : public TCPRewriter { public:
};


inline void
IPRewriter::destroy_flow(IPRewriterFlow *flow)
{
if (flow->ip_p() == IP_PROTO_TCP)
TCPRewriter::destroy_flow(flow);
else {
unmap_flow(flow, _udp_map, &reply_udp_map(flow->owner()));
flow->~IPRewriterFlow();
_udp_allocator.deallocate(flow);
}
}


CLICK_ENDDECLS
#endif
8 changes: 8 additions & 0 deletions elements/tcpudp/tcprewriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,14 @@ TCPRewriter::add_handlers()
add_rewriter_handlers(true);
}

void
TCPRewriter::destroy_flow(IPRewriterFlow *flow)
{
unmap_flow(flow, _map);
static_cast<TCPFlow *>(flow)->~TCPFlow();
_allocator.deallocate(flow);
}

CLICK_ENDDECLS
ELEMENT_REQUIRES(IPRewriterBase)
EXPORT_ELEMENT(TCPRewriter)
8 changes: 1 addition & 7 deletions elements/tcpudp/tcprewriter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,7 @@ class TCPRewriter : public IPRewriterBase { public:

};

inline void
TCPRewriter::destroy_flow(IPRewriterFlow *flow)
{
unmap_flow(flow, _map);
static_cast<TCPFlow *>(flow)->~TCPFlow();
_allocator.deallocate(flow);
}


inline tcp_seq_t
TCPRewriter::TCPFlow::new_seq(bool direction, tcp_seq_t seqno) const
Expand Down
8 changes: 8 additions & 0 deletions elements/tcpudp/udprewriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ UDPRewriter::add_handlers()
add_rewriter_handlers(true);
}

void
UDPRewriter::destroy_flow(IPRewriterFlow *flow)
{
unmap_flow(flow, _map);
flow->~IPRewriterFlow();
_allocator.deallocate(flow);
}

CLICK_ENDDECLS
ELEMENT_REQUIRES(IPRewriterBase)
EXPORT_ELEMENT(UDPRewriter)
8 changes: 1 addition & 7 deletions elements/tcpudp/udprewriter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,7 @@ class UDPRewriter : public IPRewriterBase { public:
};


inline void
UDPRewriter::destroy_flow(IPRewriterFlow *flow)
{
unmap_flow(flow, _map);
flow->~IPRewriterFlow();
_allocator.deallocate(flow);
}


CLICK_ENDDECLS
#endif
3 changes: 2 additions & 1 deletion include/click/cxxprotect.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# define delete linux_delete
# define class linux_class
# define virtual linux_virtual
# define typename linux_typename
// error: linux_typename does not name a type
//# define typename linux_typename
# define protected linux_protected
# define public linux_public
# define namespace linux_namespace
Expand Down
14 changes: 1 addition & 13 deletions include/click/hashcode.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CLICK_HASHCODE_HH
CLICK_DECLS


// Notes about the hashcode template: On GCC 4.3.0, "template <>" is required
// on the specializations or they aren't used. Just plain overloaded
// functions aren't used. The specializations must be e.g. "const char &",
Expand All @@ -20,70 +21,57 @@ inline hashcode_t hashcode(T const &x) {
return x.hashcode();
}

template <>
inline hashcode_t hashcode(char const &x) {
return x;
}

template <>
inline hashcode_t hashcode(signed char const &x) {
return x;
}

template <>
inline hashcode_t hashcode(unsigned char const &x) {
return x;
}

template <>
inline hashcode_t hashcode(short const &x) {
return x;
}

template <>
inline hashcode_t hashcode(unsigned short const &x) {
return x;
}

template <>
inline hashcode_t hashcode(int const &x) {
return x;
}

template <>
inline hashcode_t hashcode(unsigned const &x) {
return x;
}

template <>
inline hashcode_t hashcode(long const &x) {
return x;
}

template <>
inline hashcode_t hashcode(unsigned long const &x) {
return x;
}

#if HAVE_LONG_LONG
template <>
inline hashcode_t hashcode(long long const &x) {
return (x >> 32) ^ x;
}

template <>
inline hashcode_t hashcode(unsigned long long const &x) {
return (x >> 32) ^ x;
}
#endif

#if HAVE_INT64_TYPES && !HAVE_INT64_IS_LONG && !HAVE_INT64_IS_LONG_LONG
template <>
inline hashcode_t hashcode(int64_t const &x) {
return (x >> 32) ^ x;
}

template <>
inline hashcode_t hashcode(uint64_t const &x) {
return (x >> 32) ^ x;
}
Expand Down
13 changes: 4 additions & 9 deletions include/click/string.hh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class String { public:
static String make_numeric(uintmax_t x, int base = 10, bool uppercase = true);

inline const char* data() const;
inline int length() const;
int length() const;

inline const char *c_str() const;

Expand Down Expand Up @@ -312,7 +312,7 @@ class StringRef {
inline StringRef(const String &x);

inline const char *data() const;
inline int length() const;
int length() const;

inline const char *begin() const;
inline const char *end() const;
Expand Down Expand Up @@ -479,10 +479,7 @@ inline const char *String::data() const {
return _r.data;
}

/** @brief Return the string's length. */
inline int String::length() const {
return _r.length;
}


/** @brief Null-terminate the string.

Expand Down Expand Up @@ -869,9 +866,7 @@ inline const char *StringRef::data() const {
return data_;
}

inline int StringRef::length() const {
return len_;
}


inline const char *StringRef::begin() const {
return data();
Expand Down
16 changes: 2 additions & 14 deletions include/click/timestamp.hh
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class Timestamp { public:
#endif
}

inline seconds_type sec() const;
seconds_type sec() const;
inline uint32_t subsec() const;
inline uint32_t msec() const;
inline uint32_t usec() const;
Expand Down Expand Up @@ -1024,19 +1024,7 @@ Timestamp::set_subsec(uint32_t subsec)
#endif
}

/** @brief Return this timestamp's seconds component. */
inline Timestamp::seconds_type
Timestamp::sec() const
{
#if TIMESTAMP_REP_FLAT64
if (unlikely(_t.x < 0))
return -value_div(-(_t.x + 1), subsec_per_sec) - 1;
else
return value_div(_t.x, subsec_per_sec);
#else
return _t.sec;
#endif
}


/** @brief Return this timestamp's subseconds component. */
inline uint32_t
Expand Down
Loading