mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
shell: ifconfig add capability to (un)set IPHC
This commit is contained in:
parent
63cf9a3d4b
commit
58d6f124b0
@ -33,6 +33,7 @@
|
||||
#include "net/ng_pkt.h"
|
||||
#include "net/ng_pktbuf.h"
|
||||
#include "net/ng_netif/hdr.h"
|
||||
#include "net/ng_sixlowpan/netif.h"
|
||||
|
||||
/**
|
||||
* @brief The maximal expected link layer address length in byte
|
||||
@ -90,7 +91,7 @@ static void _set_usage(char *cmd_name)
|
||||
|
||||
static void _flag_usage(char *cmd_name)
|
||||
{
|
||||
printf("usage: %s <if_id> [-]{promisc|autoack|preload}\n", cmd_name);
|
||||
printf("usage: %s <if_id> [-]{promisc|autoack|preload|6lo|iphc}\n", cmd_name);
|
||||
}
|
||||
|
||||
static void _add_usage(char *cmd_name)
|
||||
@ -264,6 +265,15 @@ static void _netif_list(kernel_pid_t dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MODULE_NG_SIXLOWPAN_NETIF) && defined(MODULE_NG_SIXLOWPAN_IPHC)
|
||||
ng_sixlowpan_netif_t *sixlo_entry = ng_sixlowpan_netif_get(dev);
|
||||
|
||||
if ((sixlo_entry != NULL) && (sixlo_entry->iphc_enabled)) {
|
||||
printf("IPHC ");
|
||||
linebreak = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (linebreak) {
|
||||
printf("\n ");
|
||||
}
|
||||
@ -536,6 +546,29 @@ static int _netif_flag(char *cmd, kernel_pid_t dev, char *flag)
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
else if (strcmp(flag, "iphc") == 0) {
|
||||
#if defined(MODULE_NG_SIXLOWPAN_NETIF) && defined(MODULE_NG_SIXLOWPAN_IPHC)
|
||||
ng_sixlowpan_netif_t *entry = ng_sixlowpan_netif_get(dev);
|
||||
|
||||
if (entry == NULL) {
|
||||
puts("error: unable to (un)set IPHC");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (set) {
|
||||
entry->iphc_enabled = true;
|
||||
printf("success: enable IPHC on interface %" PRIkernel_pid "\n", dev);
|
||||
}
|
||||
else {
|
||||
entry->iphc_enabled = false;
|
||||
printf("success: disable IPHC on interface %" PRIkernel_pid "\n", dev);
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
puts("error: unable to (un)set IPHC.");
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
_flag_usage(cmd);
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user