Example #1
0
static int sl_version(lua_State * L)
{
    const struct syslinux_version *sv;

    sv = syslinux_version();
    lua_pushstring(L, sv->version_string);

    return 1;
}
Example #2
0
int main(void)
{
    int rv= -1;
    const struct syslinux_version *sv;

    console_ansi_raw();
    sv = syslinux_version();
    if (sv->filesystem != SYSLINUX_FS_PXELINUX) {
	printf("%s: May only run in PXELINUX\n", app_name_str);
	return -2;
    }
    print_dhcp_pkt_all();
    return rv;
}
Example #3
0
bool is_gpxe(void)
{
    const struct syslinux_version *sv;
    com32sys_t reg;
    struct s_PXENV_FILE_CHECK_API *fca;
    bool gpxe;

    sv = syslinux_version();
    if (sv->filesystem != SYSLINUX_FS_PXELINUX)
        return false;           /* Not PXELINUX */

    fca = lzalloc(sizeof *fca);
    if (!fca)
	return false;
    fca->Size = sizeof *fca;
    fca->Magic = 0x91d447b2;

    memset(&reg, 0, sizeof reg);
    reg.eax.w[0] = 0x0009;
    reg.ebx.w[0] = 0x00e6;      /* PXENV_FILE_API_CHECK */
    /* reg.edi.w[0] = OFFS(fca); */
    reg.es = SEG(fca);

    __intcall(0x22, &reg, &reg);

    gpxe = true;

    if (reg.eflags.l & EFLAGS_CF)
	gpxe = false;           /* Cannot invoke PXE stack */

    if (reg.eax.w[0] || fca->Status)
        gpxe = false;           /* PXE failure */

    if (fca->Magic != 0xe9c17b20)
        gpxe = false;           /* Incorrect magic */

    if (fca->Size < sizeof *fca)
        gpxe = false;           /* Short return */

    /* XXX: The APIs to test for should be a passed-in option */
    if (!(fca->APIMask & (1 << 5)))
	gpxe = false;           /* No FILE EXEC */

    lfree(fca);
    return gpxe;
}
Example #4
0
static bool is_gpxe(void)
{
    const struct syslinux_version *sv;
    com32sys_t reg;
    struct s_PXENV_FILE_CHECK_API *fca;

    sv = syslinux_version();
    if (sv->filesystem != SYSLINUX_FS_PXELINUX)
	return false;		/* Not PXELINUX */

    fca = __com32.cs_bounce;
    memset(fca, 0, sizeof *fca);
    fca->Size = sizeof *fca;
    fca->Magic = 0x91d447b2;

    memset(&reg, 0, sizeof reg);
    reg.eax.w[0] = 0x0009;
    reg.ebx.w[0] = 0x00e6;	/* PXENV_FILE_API_CHECK */
    reg.edi.w[0] = OFFS(fca);
    reg.es = SEG(fca);

    __intcall(0x22, &reg, &reg);

    if (reg.eflags.l & EFLAGS_CF)
	return false;		/* Cannot invoke PXE stack */

    if (reg.eax.w[0] || fca->Status)
	return false;		/* PXE failure */

    if (fca->Magic != 0xe9c17b20)
	return false;		/* Incorrect magic */

    if (fca->Size < sizeof *fca)
	return false;		/* Short return */

    if (!(fca->APIMask & (1 << 5)))
	return false;		/* No FILE EXEC */

    return true;
}
Example #5
0
static int sl_derivative(lua_State * L)
{
    const struct syslinux_version *sv;

    sv = syslinux_version();

    switch (sv->filesystem) {
    case SYSLINUX_FS_SYSLINUX:
	lua_pushstring(L, "SYSLINUX");
	break;
    case SYSLINUX_FS_PXELINUX:
	lua_pushstring(L, "PXELINUX");
	break;
    case SYSLINUX_FS_ISOLINUX:
	lua_pushstring(L, "ISOLINUX");
	break;
    case SYSLINUX_FS_UNKNOWN:
    default:
	lua_pushstring(L, "Unknown Syslinux derivative");
	break;
    }

    return 1;
}